michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=2 sts=2 et filetype=javascript michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /////////////////////////////////////////////////////////////////////////////// michael@0: // Test Purpose: michael@0: // To verify that the properties of BluetoothAdapter can be updated and michael@0: // retrieved correctly. Use B2G emulator commands to set properties for this michael@0: // test case. michael@0: // michael@0: // Test Coverage: michael@0: // - BluetoothAdapter.name michael@0: // - BluetoothAdapter.address michael@0: // - BluetoothAdapter.class michael@0: // - BluetoothAdapter.discoverable michael@0: // - BluetoothAdapter.discovering michael@0: // ( P.S. Don't include [BluetoothAdapter.uuids], [BluetoothAdapter.devices] ) michael@0: // michael@0: /////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: MARIONETTE_TIMEOUT = 60000; michael@0: MARIONETTE_HEAD_JS = 'head.js'; michael@0: michael@0: function testAdapterGetter(aAdapter, aPropertyName, aParamName, aExpected) { michael@0: let cmd = "bt property " + BDADDR_LOCAL + " " + aParamName; michael@0: return runEmulatorCmdSafe(cmd) michael@0: .then(function(aResults) { michael@0: is(aResults[1], "OK", "The status report from emulator command."); michael@0: log(" Got adapter " + aResults[0]); michael@0: is(aResults[0], aParamName + ": " + aExpected, "BluetoothAdapter." + aPropertyName); michael@0: }); michael@0: } michael@0: michael@0: startBluetoothTest(true, function testCaseMain(aAdapter) { michael@0: log("Checking the correctness of BluetoothAdapter properties ..."); michael@0: michael@0: return Promise.resolve() michael@0: .then(() => testAdapterGetter(aAdapter, "name", "name", aAdapter.name)) michael@0: .then(() => testAdapterGetter(aAdapter, "address", "address", aAdapter.address)) michael@0: .then(() => testAdapterGetter(aAdapter, "class", "cod", "0x" + aAdapter.class.toString(16))) michael@0: .then(() => testAdapterGetter(aAdapter, "discoverable", "discoverable", aAdapter.discoverable.toString())) michael@0: .then(() => testAdapterGetter(aAdapter, "discovering", "discovering", aAdapter.discovering.toString())); michael@0: });