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

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

Issue 10759006: Simple event tests for the Bluetooth API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_events.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 testPowerEvents() {
6 var numValues = kExpectedValues.length;
7
8 if (powerChangedValues.length != numValues ||
9 availabilityChangedValues.length != numValues) {
10 chrome.test.fail();
11 }
miket_OOO 2012/07/11 16:32:53 This is just a matter of style, but instead of tes
bryeung 2012/07/11 19:06:34 That's a great suggestion: thank you.
12
13 for (var i = 0; i < numValues; ++i) {
14 if (powerChangedValues[i] != kExpectedValues[i] ||
15 availabilityChangedValues[i] != kExpectedValues[i]) {
16 chrome.test.fail();
17 }
18 }
19
20 chrome.test.succeed();
21 }
22
23 var powerChangedValues = [];
24 var availabilityChangedValues = [];
25 var kExpectedValues = [true, false];
26 chrome.experimental.bluetooth.onPowerChanged.addListener(
27 function(result) {
28 powerChangedValues.push(result);
29 });
30 chrome.experimental.bluetooth.onAvailabilityChanged.addListener(
31 function(result) {
32 availabilityChangedValues.push(result);
33 });
34 chrome.test.sendMessage('ready',
35 function(message) {
36 chrome.test.runTests([
37 testPowerEvents
38 ]);
39 });
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/bluetooth/test_events.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698