diff --git a/dom/nfc/tests/marionette/head.js b/dom/nfc/tests/marionette/head.js index a7d91198168..67d38b74556 100644 --- a/dom/nfc/tests/marionette/head.js +++ b/dom/nfc/tests/marionette/head.js @@ -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() {