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

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

Issue 10915148: Change getDevices to use a DeviceCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test breakage Created 8 years, 3 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
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 testGetDevices() {
6 chrome.test.assertEq(2, devices['all'].length);
7 chrome.test.assertEq('d1', devices['all'][0].name);
8 chrome.test.assertEq('d2', devices['all'][1].name);
9
10 chrome.test.assertEq(1, devices['name'].length);
11 chrome.test.assertEq('d1', devices['name'][0].name);
12
13 chrome.test.assertEq(1, devices['uuid'].length);
14 chrome.test.assertEq('d2', devices['uuid'][0].name);
15
16 chrome.test.succeed();
17 }
18
19 var devices = {
20 'all': [],
21 'name': [],
22 'uuid': []
23 };
24 function recordDevicesInto(arrayKey) {
25 return function(device) {
26 devices[arrayKey].push(device);
27 };
28 }
29
30 chrome.experimental.bluetooth.getDevices(
31 {
32 deviceCallback:recordDevicesInto('all')
33 },
34 function() {
35 chrome.experimental.bluetooth.getDevices(
36 {
37 name:'fooservice',
38 deviceCallback:recordDevicesInto('name')
39 },
40 function() {
41 chrome.experimental.bluetooth.getDevices(
42 {
43 uuid:'00000010-0000-1000-8000-00805f9b34fb',
44 deviceCallback:recordDevicesInto('uuid')
45 },
46 function() {
47 chrome.test.sendMessage('ready',
48 function(message) {
49 chrome.test.runTests([
50 testGetDevices
51 ]);
52 });
53 });
54 });
55 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698