Chromium Code Reviews| 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 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 }); | |
| OLD | NEW |