mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 933595 - Part 2: Adding promise to toggleNFC, adding enableRE0. r=allstars.chh
This commit is contained in:
parent
3533cdf74a
commit
fb2871d672
@ -37,7 +37,7 @@ let emulator = (function() {
|
||||
}());
|
||||
|
||||
function toggleNFC(enabled, callback) {
|
||||
isnot(callback, null);
|
||||
let deferred = Promise.defer();
|
||||
|
||||
let req;
|
||||
if (enabled) {
|
||||
@ -47,13 +47,32 @@ function toggleNFC(enabled, callback) {
|
||||
}
|
||||
|
||||
req.onsuccess = function() {
|
||||
callback();
|
||||
if(callback) {
|
||||
callback();
|
||||
}
|
||||
|
||||
deferred.resolve();
|
||||
};
|
||||
|
||||
req.onerror = function() {
|
||||
ok(false, 'operation failed, error ' + req.error.name);
|
||||
deferred.reject();
|
||||
finish();
|
||||
};
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function enableRE0() {
|
||||
let deferred = Promise.defer();
|
||||
let cmd = 'nfc nci rf_intf_activated_ntf 0';
|
||||
|
||||
emulator.run(cmd, function(result) {
|
||||
is(result.pop(), 'OK', 'check activation of RE0');
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
|
Loading…
Reference in New Issue
Block a user