OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 function testDiscovery() { | |
6 chrome.test.assertEq(kExpectedDeviceNames.length, | |
7 discoveredDevices.length); | |
8 for (var i = 0; i < kExpectedDeviceNames.length; ++i) { | |
9 chrome.test.assertEq(kExpectedDeviceNames[i], discoveredDevices[i].name); | |
10 } | |
11 | |
12 chrome.test.succeed(); | |
13 } | |
14 | |
15 function startTests() { | |
16 chrome.test.runTests([ testDiscovery ]); | |
miket_OOO
2012/07/11 21:49:46
We're not super-consistent about whitespace on sin
bryeung
2012/07/12 01:02:40
Oops. Good catch.
| |
17 } | |
18 | |
19 function sendReady(callback) { | |
20 chrome.test.sendMessage('ready', callback); | |
21 } | |
22 | |
23 function stopDiscoveryAndContinue() { | |
24 chrome.experimental.bluetooth.stopDiscovery(); | |
25 sendReady(startTests); | |
26 } | |
27 | |
28 var kExpectedDeviceNames = ["d1"]; | |
29 var discoveredDevices = []; | |
30 function recordDevice(device) { | |
31 console.log('Got device: ' + device.name); | |
miket_OOO
2012/07/11 21:49:46
oops -- if you want to keep this in, please indent
bryeung
2012/07/12 01:02:40
Yep: another oops. Thanks.
| |
32 discoveredDevices.push(device); | |
33 } | |
34 | |
35 chrome.experimental.bluetooth.startDiscovery( | |
36 { deviceCallback:recordDevice }, | |
37 function() { sendReady(stopDiscoveryAndContinue); }); | |
OLD | NEW |