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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/bluetooth/test_discovery.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/bluetooth/test_discovery.js
diff --git a/chrome/test/data/extensions/api_test/bluetooth/test_discovery.js b/chrome/test/data/extensions/api_test/bluetooth/test_discovery.js
new file mode 100644
index 0000000000000000000000000000000000000000..f8e5b6e64d76e944c1633a2f298f842f7592d806
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/bluetooth/test_discovery.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function testDiscovery() {
+ chrome.test.assertEq(kExpectedDeviceNames.length,
+ discoveredDevices.length);
+ for (var i = 0; i < kExpectedDeviceNames.length; ++i) {
+ chrome.test.assertEq(kExpectedDeviceNames[i], discoveredDevices[i].name);
+ }
+
+ chrome.test.succeed();
+}
+
+function startTests() {
+ chrome.test.runTests([testDiscovery]);
+}
+
+function sendReady(callback) {
+ chrome.test.sendMessage('ready', callback);
+}
+
+function stopDiscoveryAndContinue() {
+ chrome.experimental.bluetooth.stopDiscovery();
+ sendReady(startTests);
+}
+
+var kExpectedDeviceNames = ["d1"];
+var discoveredDevices = [];
+function recordDevice(device) {
+ discoveredDevices.push(device);
+}
+
+chrome.experimental.bluetooth.startDiscovery(
+ { deviceCallback:recordDevice },
+ function() { sendReady(stopDiscoveryAndContinue); });
« 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