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

Unified Diff: chrome/test/data/extensions/api_test/bluetooth/get_devices/runtest.js

Issue 177113013: Bluetooth: add Device events, and cleanup JS API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@arman-patch
Patch Set: I suck at rebase Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/bluetooth/get_devices/runtest.js
diff --git a/chrome/test/data/extensions/api_test/bluetooth/get_devices/runtest.js b/chrome/test/data/extensions/api_test/bluetooth/get_devices/runtest.js
index e6c453cb1bfe134025c659ad774b636d05eacbb2..a6c29103f5e068c203f139a2f56471c071370bfa 100644
--- a/chrome/test/data/extensions/api_test/bluetooth/get_devices/runtest.js
+++ b/chrome/test/data/extensions/api_test/bluetooth/get_devices/runtest.js
@@ -3,26 +3,14 @@
// found in the LICENSE file.
function testGetDevices() {
- chrome.test.assertEq(2, devices['all'].length);
- chrome.test.assertEq('d1', devices['all'][0].name);
- chrome.test.assertEq('d2', devices['all'][1].name);
-
- chrome.test.assertEq(1, devices['uuid'].length);
- chrome.test.assertEq('d2', devices['uuid'][0].name);
+ chrome.test.assertEq(2, devices.length);
+ chrome.test.assertEq('d1', devices[0].name);
+ chrome.test.assertEq('d2', devices[1].name);
chrome.test.succeed();
}
-var devices = {
- 'all': [],
- 'uuid': []
-};
-
-function recordDevicesInto(arrayKey) {
- return function(device) {
- devices[arrayKey].push(device);
- };
-}
+var devices = null;
function failOnError() {
if (chrome.runtime.lastError) {
@@ -31,19 +19,11 @@ function failOnError() {
}
chrome.bluetooth.getDevices(
- {deviceCallback: recordDevicesInto('all')},
- function() {
+ function(result) {
failOnError();
- chrome.bluetooth.getDevices(
- {
- profile: {uuid: '00000010-0000-1000-8000-00805f9b34fb'},
- deviceCallback: recordDevicesInto('uuid')
- },
- function() {
- failOnError();
- chrome.test.sendMessage('ready',
- function(message) {
- chrome.test.runTests([testGetDevices]);
- });
+ devices = result;
+ chrome.test.sendMessage('ready',
+ function(message) {
+ chrome.test.runTests([testGetDevices]);
});
});

Powered by Google App Engine
This is Rietveld 408576698