| Index: chrome/test/data/extensions/api_test/bluetooth/test_discovery.js
|
| diff --git a/chrome/test/data/extensions/api_test/bluetooth/test_discovery.js b/chrome/test/data/extensions/api_test/bluetooth/test_discovery.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f8e5b6e64d76e944c1633a2f298f842f7592d806
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/bluetooth/test_discovery.js
|
| @@ -0,0 +1,36 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +function testDiscovery() {
|
| + chrome.test.assertEq(kExpectedDeviceNames.length,
|
| + discoveredDevices.length);
|
| + for (var i = 0; i < kExpectedDeviceNames.length; ++i) {
|
| + chrome.test.assertEq(kExpectedDeviceNames[i], discoveredDevices[i].name);
|
| + }
|
| +
|
| + chrome.test.succeed();
|
| +}
|
| +
|
| +function startTests() {
|
| + chrome.test.runTests([testDiscovery]);
|
| +}
|
| +
|
| +function sendReady(callback) {
|
| + chrome.test.sendMessage('ready', callback);
|
| +}
|
| +
|
| +function stopDiscoveryAndContinue() {
|
| + chrome.experimental.bluetooth.stopDiscovery();
|
| + sendReady(startTests);
|
| +}
|
| +
|
| +var kExpectedDeviceNames = ["d1"];
|
| +var discoveredDevices = [];
|
| +function recordDevice(device) {
|
| + discoveredDevices.push(device);
|
| +}
|
| +
|
| +chrome.experimental.bluetooth.startDiscovery(
|
| + { deviceCallback:recordDevice },
|
| + function() { sendReady(stopDiscoveryAndContinue); });
|
|
|