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

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: upload against correct base 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]);
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 discoveredDevices.push(device);
32 }
33
34 chrome.experimental.bluetooth.startDiscovery(
35 { deviceCallback:recordDevice },
36 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