mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Bug 1006320 - Add a marionette test for verifying the functionality BluetoothManager based on bluetooth API v2. r=btian
This commit is contained in:
parent
1f24c3b60b
commit
d045f724ae
@ -2,3 +2,5 @@
|
||||
b2g = true
|
||||
browser = false
|
||||
qemu = false
|
||||
|
||||
[test_dom_BluetoothManager_API2.js]
|
||||
|
@ -0,0 +1,48 @@
|
||||
/* 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 the basic functionality of BluetoothManager.
|
||||
//
|
||||
// Test Coverage:
|
||||
// - BluetoothManager.defaultAdapter
|
||||
// - BluetoothManager.getAdapters()
|
||||
// TODO:
|
||||
// - BluetoothManager.onattributechanged()
|
||||
// - BluetoothManager.onadapteradded()
|
||||
// - BluetoothManager.onadapterremoved()
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
// TODO: Listens to 'onattributechanged' when B2G supports the feature that
|
||||
// allows user to add/remove Bluetooth adapter.
|
||||
// Currently, B2G recognizes build-in Bluetooth chip as default adapter and
|
||||
// don't support adding additional Bluetooth dongles in gonk layer.
|
||||
// Therefore, the 'onattributechanged' would be triggered *only* when the
|
||||
// instance of BluetoothManager is created.
|
||||
function waitForManagerAttributeChanged() {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
bluetoothManager.onattributechanged = function(aEvent) {
|
||||
if(aEvent.attrs.indexOf("defaultAdapter")) {
|
||||
bluetoothManager.onattributechanged = null;
|
||||
ok(true, "BluetoothManager event 'onattributechanged' got.");
|
||||
deferred.resolve(aEvent);
|
||||
}
|
||||
};
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
startBluetoothTestBase(["settings-read", "settings-write"],
|
||||
function testCaseMain() {
|
||||
let adapters = bluetoothManager.getAdapters();
|
||||
ok(Array.isArray(adapters), "Can not got the array of adapters");
|
||||
ok(adapters.length, "The number of adapters should not be zero");
|
||||
ok(bluetoothManager.defaultAdapter, "defaultAdapter should not be null.");
|
||||
});
|
Loading…
Reference in New Issue
Block a user