Bug 968709 - Add a marionette test for pairing APIs of BluetoothAdapter. r=echou, f=vyang
--- a/dom/bluetooth/tests/marionette/head.js
+++ b/dom/bluetooth/tests/marionette/head.js
@@ -1,11 +1,9 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 sts=2 et filetype=javascript
- * This Source Code Form is subject to the terms of the Mozilla Public
+/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://github.com/mozilla-b2g/platform_external_qemu/blob/master/vl-android.c#L765
// static int bt_hci_parse(const char *str) {
// ...
// bdaddr.b[0] = 0x52;
// bdaddr.b[1] = 0x54;
@@ -31,17 +29,24 @@ const EMULATOR_CLASS = 0x58020c;
// Use same definition in QEMU for special bluetooth address,
// which were defined at external/qemu/hw/bt.h:
const BDADDR_ANY = "00:00:00:00:00:00";
const BDADDR_ALL = "ff:ff:ff:ff:ff:ff";
const BDADDR_LOCAL = "ff:ff:ff:00:00:00";
// A user friendly name for remote BT device.
-const REMOTE_DEVICE_NAME = "Remote BT Device";
+const REMOTE_DEVICE_NAME = "Remote_BT_Device";
+
+// A system message signature of pairing request event
+const BT_PAIRING_REQ = "bluetooth-pairing-request";
+
+// Passkey and pincode used to reply pairing requst
+const BT_PAIRING_PASSKEY = 123456;
+const BT_PAIRING_PINCODE = "ABCDEFG";
let Promise =
SpecialPowers.Cu.import("resource://gre/modules/Promise.jsm").Promise;
let bluetoothManager;
let pendingEmulatorCmdCount = 0;
@@ -76,16 +81,43 @@ function runEmulatorCmdSafe(aCommand) {
deferred.reject(aResult);
}
});
return deferred.promise;
}
/**
+ * Wrap DOMRequest onsuccess/onerror events to Promise resolve/reject.
+ *
+ * Fulfill params: A DOMEvent.
+ * Reject params: A DOMEvent.
+ *
+ * @param aRequest
+ * A DOMRequest instance.
+ *
+ * @return A deferred promise.
+ */
+function wrapDomRequestAsPromise(aRequest) {
+ let deferred = Promise.defer();
+
+ ok(aRequest instanceof DOMRequest,
+ "aRequest is instanceof " + aRequest.constructor);
+
+ aRequest.onsuccess = function(aEvent) {
+ deferred.resolve(aEvent);
+ };
+ aRequest.onerror = function(aEvent) {
+ deferred.reject(aEvent);
+ };
+
+ return deferred.promise;
+}
+
+/**
* Add a Bluetooth remote device to scatternet and set its properties.
*
* Use QEMU command 'bt remote add' to add a virtual Bluetooth remote
* and set its properties by setEmulatorDeviceProperty().
*
* Fulfill params:
* result -- bluetooth address of the remote device.
* Reject params: (none)
@@ -183,144 +215,291 @@ function setEmulatorDeviceProperty(aAddr
* @param aPropertyName
* The property name of Bluetooth device.
*
* @return A deferred promise.
*/
function getEmulatorDeviceProperty(aAddress, aPropertyName) {
let cmd = "bt property " + aAddress + " " + aPropertyName;
return runEmulatorCmdSafe(cmd)
- .then(function(aResults) {
- return aResults[0];
- });
+ .then(aResults => aResults[0]);
}
/**
- * Start dicovering Bluetooth devices.
+ * Start discovering Bluetooth devices.
*
* Allows the device's adapter to start seeking for remote devices.
*
* Fulfill params: (none)
* Reject params: a DOMError
*
* @param aAdapter
- * A BluetoothAdapter which is used to interact with local BT dev
+ * A BluetoothAdapter which is used to interact with local BT device.
*
* @return A deferred promise.
*/
function startDiscovery(aAdapter) {
- let deferred = Promise.defer();
+ let request = aAdapter.startDiscovery();
- let request = aAdapter.startDiscovery();
- request.onsuccess = function () {
- log(" Start discovery - Success");
- // TODO (bug 892207): Make Bluetooth APIs available for 3rd party apps.
- // Currently, discovering state wouldn't change immediately here.
- // We would turn on this check when the redesigned API are landed.
- // is(aAdapter.discovering, true, "BluetoothAdapter.discovering");
- deferred.resolve();
- }
- request.onerror = function (aEvent) {
- ok(false, "Start discovery - Fail");
- deferred.reject(aEvent.target.error);
- }
-
- return deferred.promise;
+ return wrapDomRequestAsPromise(request)
+ .then(function resolve() {
+ // TODO (bug 892207): Make Bluetooth APIs available for 3rd party apps.
+ // Currently, discovering state wouldn't change immediately here.
+ // We would turn on this check when the redesigned API are landed.
+ // is(aAdapter.discovering, false, "BluetoothAdapter.discovering");
+ log(" Start discovery - Success");
+ }, function reject(aEvent) {
+ ok(false, "Start discovery - Fail");
+ throw aEvent.target.error;
+ });
}
/**
- * Stop dicovering Bluetooth devices.
+ * Stop discovering Bluetooth devices.
*
* Allows the device's adapter to stop seeking for remote devices.
*
* Fulfill params: (none)
* Reject params: a DOMError
*
* @param aAdapter
* A BluetoothAdapter which is used to interact with local BT device.
*
* @return A deferred promise.
*/
function stopDiscovery(aAdapter) {
+ let request = aAdapter.stopDiscovery();
+
+ return wrapDomRequestAsPromise(request)
+ .then(function resolve() {
+ // TODO (bug 892207): Make Bluetooth APIs available for 3rd party apps.
+ // Currently, discovering state wouldn't change immediately here.
+ // We would turn on this check when the redesigned API are landed.
+ // is(aAdapter.discovering, false, "BluetoothAdapter.discovering");
+ log(" Stop discovery - Success");
+ }, function reject(aEvent) {
+ ok(false, "Stop discovery - Fail");
+ throw aEvent.target.error;
+ });
+}
+
+/**
+ * Wait for 'devicefound' event of specified devices.
+ *
+ * Resolve if that every specified devices has been found. Never reject.
+ *
+ * Fulfill params: an array which contains addresses of remote devices.
+ *
+ * @param aAdapter
+ * A BluetoothAdapter which is used to interact with local BT device.
+ * @param aRemoteAddresses
+ * An array which contains addresses of remote devices.
+ *
+ * @return A deferred promise.
+ */
+function waitForDevicesFound(aAdapter, aRemoteAddresses) {
let deferred = Promise.defer();
- let request = aAdapter.stopDiscovery();
- request.onsuccess = function () {
- log(" Stop discovery - Success");
- // TODO (bug 892207): Make Bluetooth APIs available for 3rd party apps.
- // Currently, discovering state wouldn't change immediately here.
- // We would turn on this check when the redesigned API are landed.
- // is(aAdapter.discovering, false, "BluetoothAdapter.discovering");
- deferred.resolve();
- }
- request.onerror = function (aEvent) {
- ok(false, "Stop discovery - Fail");
- deferred.reject(aEvent.target.error);
- }
+ var addrArray = [];
+ aAdapter.addEventListener("devicefound", function onevent(aEvent) {
+ if(aRemoteAddresses.indexOf(aEvent.device.address) != -1) {
+ addrArray.push(aEvent.device.address);
+ }
+ if(addrArray.length == aRemoteAddresses.length) {
+ aAdapter.removeEventListener("devicefound", onevent);
+ ok(true, "BluetoothAdapter has found all remote devices.");
+
+ deferred.resolve(addrArray);
+ }
+ });
+
return deferred.promise;
}
/**
+ * Start discovering Bluetooth devices and wait for 'devicefound' events.
+ *
+ * Allows the device's adapter to start seeking for remote devices and wait for
+ * the 'devicefound' events of specified devices.
+ *
+ * Fulfill params: an array of addresses of found devices.
+ *
+ * @param aAdapter
+ * A BluetoothAdapter which is used to interact with local BT device.
+ * @param aRemoteAddresses
+ * An array which contains addresses of remote devices.
+ *
+ * @return A deferred promise.
+ */
+function startDiscoveryAndWaitDevicesFound(aAdapter, aRemoteAddresses) {
+ let promises = [];
+
+ promises.push(waitForDevicesFound(aAdapter, aRemoteAddresses));
+ promises.push(startDiscovery(aAdapter));
+ return Promise.all(promises)
+ .then(aResults => aResults[0]);
+}
+
+/**
+ * Start pairing a remote device.
+ *
+ * Start pairing a remote device with the device's adapter.
+ *
+ * Fulfill params: (none)
+ * Reject params: a DOMError
+ *
+ * @param aAdapter
+ * A BluetoothAdapter which is used to interact with local BT device.
+ * @param aDeviceAddress
+ * The string of remote Bluetooth address with format xx:xx:xx:xx:xx:xx.
+ *
+ * @return A deferred promise.
+ */
+function pair(aAdapter, aDeviceAddress) {
+ let request = aAdapter.pair(aDeviceAddress);
+
+ return wrapDomRequestAsPromise(request)
+ .then(function resolve() {
+ log(" Pair - Success");
+ }, function reject(aEvent) {
+ ok(false, "Pair - Fail");
+ throw aEvent.target.error;
+ });
+}
+
+/**
+ * Remove the paired device from the paired device list.
+ *
+ * Remove the paired device from the paired device list of the device's adapter.
+ *
+ * Fulfill params: (none)
+ * Reject params: a DOMError
+ *
+ * @param aAdapter
+ * A BluetoothAdapter which is used to interact with local BT device.
+ * @param aDeviceAddress
+ * The string of remote Bluetooth address with format xx:xx:xx:xx:xx:xx.
+ *
+ * @return A deferred promise.
+ */
+function unpair(aAdapter, aDeviceAddress) {
+ let request = aAdapter.unpair(aDeviceAddress);
+
+ return wrapDomRequestAsPromise(request)
+ .then(function resolve() {
+ log(" Unpair - Success");
+ }, function reject(aEvent) {
+ ok(false, "Unpair - Fail");
+ throw aEvent.target.error;
+ });
+}
+
+/**
+ * Start pairing a remote device and wait for "pairedstatuschanged" event.
+ *
+ * Start pairing a remote device with the device's adapter and wait for
+ * "pairedstatuschanged" event.
+ *
+ * Fulfill params: an array of promise results contains the fulfilled params of
+ * 'waitForAdapterEvent' and 'pair'.
+ *
+ * @param aAdapter
+ * A BluetoothAdapter which is used to interact with local BT device.
+ * @param aDeviceAddress
+ * The string of remote Bluetooth address with format xx:xx:xx:xx:xx:xx.
+ *
+ * @return A deferred promise.
+ */
+function pairDeviceAndWait(aAdapter, aDeviceAddress) {
+ let promises = [];
+ promises.push(waitForAdapterEvent(aAdapter, "pairedstatuschanged"));
+ promises.push(pair(aAdapter, aDeviceAddress));
+ return Promise.all(promises);
+}
+
+/**
+ * Get paried Bluetooth devices.
+ *
+ * The getPairedDevices method is used to retrieve the full list of all devices
+ * paired with the device's adapter.
+ *
+ * Fulfill params: a shallow copy of the Array of paired BluetoothDevice
+ * objects.
+ * Reject params: a DOMError
+ *
+ * @param aAdapter
+ * A BluetoothAdapter which is used to interact with local BT device.
+ *
+ * @return A deferred promise.
+ */
+function getPairedDevices(aAdapter) {
+ let request = aAdapter.getPairedDevices();
+
+ return wrapDomRequestAsPromise(request)
+ .then(function resolve() {
+ log(" getPairedDevices - Success");
+ let pairedDevices = request.result.slice();
+ return pairedDevices;
+ }, function reject(aEvent) {
+ ok(false, "getPairedDevices - Fail");
+ throw aEvent.target.error;
+ });
+}
+
+/**
* Get mozSettings value specified by @aKey.
*
* Resolve if that mozSettings value is retrieved successfully, reject
* otherwise.
*
* Fulfill params:
* The corresponding mozSettings value of the key.
* Reject params: (none)
*
* @param aKey
* A string.
*
* @return A deferred promise.
*/
function getSettings(aKey) {
- let deferred = Promise.defer();
+ let request = navigator.mozSettings.createLock().get(aKey);
- let request = navigator.mozSettings.createLock().get(aKey);
- request.addEventListener("success", function(aEvent) {
- ok(true, "getSettings(" + aKey + ")");
- deferred.resolve(aEvent.target.result[aKey]);
- });
- request.addEventListener("error", function() {
- ok(false, "getSettings(" + aKey + ")");
- deferred.reject();
- });
-
- return deferred.promise;
+ return wrapDomRequestAsPromise(request)
+ .then(function resolve(aEvent) {
+ ok(true, "getSettings(" + aKey + ")");
+ return aEvent.target.result[aKey];
+ }, function reject(aEvent) {
+ ok(false, "getSettings(" + aKey + ")");
+ throw aEvent.target.error;
+ });
}
/**
* Set mozSettings values.
*
* Resolve if that mozSettings value is set successfully, reject otherwise.
*
* Fulfill params: (none)
* Reject params: (none)
*
* @param aSettings
* An object of format |{key1: value1, key2: value2, ...}|.
*
* @return A deferred promise.
*/
function setSettings(aSettings) {
- let deferred = Promise.defer();
+ let request = navigator.mozSettings.createLock().set(aSettings);
- let request = navigator.mozSettings.createLock().set(aSettings);
- request.addEventListener("success", function() {
- ok(true, "setSettings(" + JSON.stringify(aSettings) + ")");
- deferred.resolve();
- });
- request.addEventListener("error", function() {
- ok(false, "setSettings(" + JSON.stringify(aSettings) + ")");
- deferred.reject();
- });
-
- return deferred.promise;
+ return wrapDomRequestAsPromise(request)
+ .then(function resolve() {
+ ok(true, "setSettings(" + JSON.stringify(aSettings) + ")");
+ }, function reject(aEvent) {
+ ok(false, "setSettings(" + JSON.stringify(aSettings) + ")");
+ throw aEvent.target.error;
+ });
}
/**
* Get mozSettings value of 'bluetooth.enabled'.
*
* Resolve if that mozSettings value is retrieved successfully, reject
* otherwise.
*
@@ -433,17 +612,17 @@ function waitForManagerEvent(aEventName)
/**
* Wait for one named BluetoothAdapter event.
*
* Resolve if that named event occurs. Never reject.
*
* Fulfill params: the DOMEvent passed.
*
* @param aAdapter
- * The BluetoothAdapter you want to use.
+ * A BluetoothAdapter which is used to interact with local BT device.
* @param aEventName
* The name of the EventHandler.
*
* @return A deferred promise.
*/
function waitForAdapterEvent(aAdapter, aEventName) {
let deferred = Promise.defer();
@@ -458,17 +637,18 @@ function waitForAdapterEvent(aAdapter, a
}
/**
* Convenient function for setBluetoothEnabled and waitForManagerEvent
* combined.
*
* Resolve if that named event occurs. Reject if we can't set settings.
*
- * Fulfill params: the DOMEvent passed.
+ * Fulfill params: an array of promise results contains the fulfill params of
+ * 'waitForManagerEvent' and 'setBluetoothEnabled'.
* Reject params: (none)
*
* @return A deferred promise.
*/
function setBluetoothEnabledAndWait(aEnabled) {
let promises = [];
// Bug 969109 - Intermittent test_dom_BluetoothManager_adapteradded.js
--- a/dom/bluetooth/tests/marionette/manifest.ini
+++ b/dom/bluetooth/tests/marionette/manifest.ini
@@ -4,8 +4,9 @@ browser = false
qemu = true
[test_navigate_to_default_url.py]
[test_dom_BluetoothManager_enabled.js]
[test_dom_BluetoothManager_adapteradded.js]
[test_dom_BluetoothAdapter_setters.js]
[test_dom_BluetoothAdapter_getters.js]
[test_dom_BluetoothAdapter_discovery.js]
+[test_dom_BluetoothAdapter_pair.js]
--- a/dom/bluetooth/tests/marionette/test_dom_BluetoothAdapter_discovery.js
+++ b/dom/bluetooth/tests/marionette/test_dom_BluetoothAdapter_discovery.js
@@ -1,43 +1,35 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 sts=2 et filetype=javascript
- * This Source Code Form is subject to the terms of the Mozilla Public
+/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
///////////////////////////////////////////////////////////////////////////////
// Test Purpose:
// To verify that discovery process of BluetoothAdapter is correct.
-// Use B2G emulator commands to add/remote remote devices to simulate
+// Use B2G emulator commands to add/remove remote devices to simulate
// discovering behavior.
//
// Test Coverage:
// - BluetoothAdapter.startDiscovery()
// - BluetoothAdapter.stopDiscovery()
// - BluetoothAdapter.ondevicefound()
// - BluetoothAdapter.discovering [Temporarily turned off until BT API update]
//
///////////////////////////////////////////////////////////////////////////////
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = 'head.js';
startBluetoothTest(true, function testCaseMain(aAdapter) {
log("Testing the discovery process of BluetoothAdapter ...");
- // The properties of remote device.
- let theProperties = {
- "name": REMOTE_DEVICE_NAME,
- "discoverable": true
- };
-
return Promise.resolve()
.then(() => removeEmulatorRemoteDevice(BDADDR_ALL))
- .then(() => addEmulatorRemoteDevice(/*theProperties*/ null))
+ .then(() => addEmulatorRemoteDevice(null))
.then(function(aRemoteAddress) {
let promises = [];
promises.push(waitForAdapterEvent(aAdapter, "devicefound"));
promises.push(startDiscovery(aAdapter));
return Promise.all(promises)
.then(function(aResults) {
is(aResults[0].device.address, aRemoteAddress, "BluetoothDevice.address");
});
--- a/dom/bluetooth/tests/marionette/test_dom_BluetoothAdapter_getters.js
+++ b/dom/bluetooth/tests/marionette/test_dom_BluetoothAdapter_getters.js
@@ -1,11 +1,9 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 sts=2 et filetype=javascript
- * This Source Code Form is subject to the terms of the Mozilla Public
+/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
///////////////////////////////////////////////////////////////////////////////
// Test Purpose:
// To verify that the properties of BluetoothAdapter can be updated and
// retrieved correctly. Use B2G emulator commands to set properties for this
// test case.
new file mode 100644
--- /dev/null
+++ b/dom/bluetooth/tests/marionette/test_dom_BluetoothAdapter_pair.js
@@ -0,0 +1,66 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+///////////////////////////////////////////////////////////////////////////////
+// Test Purpose:
+// To verify that pairing process of BluetoothAdapter is correct.
+// Use B2G emulator commands to add/remove remote devices to simulate
+// discovering behavior. With current emulator implemation, the pair method
+// between adapter and remote device would be 'confirmation'.
+//
+// Test Coverage:
+// - BluetoothAdapter.startDiscovery()
+// - BluetoothAdapter.stopDiscovery()
+// - BluetoothAdapter.pair()
+// - BluetoothAdapter.unpair()
+// - BluetoothAdapter.onpairedstatuschanged()
+// - BluetoothAdapter.setPairingConfirmation()
+//
+///////////////////////////////////////////////////////////////////////////////
+
+MARIONETTE_TIMEOUT = 60000;
+MARIONETTE_HEAD_JS = 'head.js';
+
+function replyPairingReq(aAdapter, aPairingEvent) {
+ switch (aPairingEvent.method) {
+ case 'confirmation':
+ log("The pairing passkey is " + aPairingEvent.passkey);
+ aAdapter.setPairingConfirmation(aPairingEvent.address, true);
+ break;
+ case 'pincode':
+ let pincode = BT_PAIRING_PINCODE;
+ aAdapter.setPinCode(aPairingEvent.address, pincode);
+ break;
+ case 'passkey':
+ let passkey = BT_PAIRING_PASSKEY;
+ aAdapter.setPasskey(aPairingEvent.address, passkey);
+ break;
+ default:
+ ok(false, "Unsupported pairing method. [" + aPairingEvent.method + "]");
+ }
+}
+
+startBluetoothTest(true, function testCaseMain(aAdapter) {
+ log("Testing the pairing process of BluetoothAdapter ...");
+
+ // listens to the system message BT_PAIRING_REQ
+ navigator.mozSetMessageHandler(BT_PAIRING_REQ,
+ (evt) => replyPairingReq(aAdapter, evt));
+
+ return Promise.resolve()
+ .then(() => removeEmulatorRemoteDevice(BDADDR_ALL))
+ .then(() => addEmulatorRemoteDevice())
+ .then((aRemoteAddress) =>
+ startDiscoveryAndWaitDevicesFound(aAdapter, [aRemoteAddress]))
+ .then((aRemoteAddresses) =>
+ stopDiscovery(aAdapter).then(() => aRemoteAddresses))
+ // 'aRemoteAddresses' is an arrary which contains addresses of discovered
+ // remote devices.
+ // Pairs with the first device in 'aRemoteAddresses' to test the functionality
+ // of BluetoothAdapter.pair and BluetoothAdapter.onpairedstatuschanged.
+ .then((aRemoteAddresses) => pairDeviceAndWait(aAdapter, aRemoteAddresses.pop()))
+ .then(() => getPairedDevices(aAdapter))
+ .then((aPairedDevices) => unpair(aAdapter, aPairedDevices.pop().address))
+ .then(() => removeEmulatorRemoteDevice(BDADDR_ALL));
+});
--- a/dom/bluetooth/tests/marionette/test_dom_BluetoothAdapter_setters.js
+++ b/dom/bluetooth/tests/marionette/test_dom_BluetoothAdapter_setters.js
@@ -1,11 +1,9 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 sts=2 et filetype=javascript
- * This Source Code Form is subject to the terms of the Mozilla Public
+/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
///////////////////////////////////////////////////////////////////////////////
// Test Purpose:
// To verify that all setters of BluetoothAdapter (except for pairing related
// APIs) can change properties correctly.
//
--- a/dom/bluetooth/tests/marionette/test_dom_BluetoothManager_adapteradded.js
+++ b/dom/bluetooth/tests/marionette/test_dom_BluetoothManager_adapteradded.js
@@ -1,11 +1,9 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 sts=2 et filetype=javascript
- * This Source Code Form is subject to the terms of the Mozilla Public
+/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = 'head.js';
startBluetoothTest(true, function testCaseMain(aAdapter) {
log("Checking adapter attributes ...");
--- a/dom/bluetooth/tests/marionette/test_dom_BluetoothManager_enabled.js
+++ b/dom/bluetooth/tests/marionette/test_dom_BluetoothManager_enabled.js
@@ -1,11 +1,9 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 sts=2 et filetype=javascript
- * This Source Code Form is subject to the terms of the Mozilla Public
+/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = 'head.js';
function waitEitherEnabledOrDisabled() {
let deferred = Promise.defer();