Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: chrome/test/data/extensions/api_test/bluetooth/test_discovery.js

Issue 10695161: Bluetooth API: test discovery callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix patch Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/extensions/api_test/bluetooth/test_discovery.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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); });
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/bluetooth/test_discovery.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698