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

Unified Diff: chrome/test/data/extensions/api_test/bluetooth_private/disconnect/test.js

Issue 819713002: bluetoothPrivate: Add disconnectAll function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comment by jyasskin@ Created 5 years, 11 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_private/disconnect/test.js
diff --git a/chrome/test/data/extensions/api_test/bluetooth_private/disconnect/test.js b/chrome/test/data/extensions/api_test/bluetooth_private/disconnect/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..ad9afea94b6ed90b0076d8bb6b6e12b1a5d3d77e
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/bluetooth_private/disconnect/test.js
@@ -0,0 +1,38 @@
+// Copyright 2014 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.
+
+var deviceAddress = '11:12:13:14:15:16';
+var errorNotConnected = 'Device is not connected';
+var errorDisconnectFailed = 'Failed to disconnect device';
+
+var btp = chrome.bluetoothPrivate;
+
+function testDisconnect() {
+ btp.disconnectAll(deviceAddress, function() {
+ assertFailure(errorNotConnected);
+ btp.disconnectAll(deviceAddress, function() {
+ assertFailure(errorNotConnected);
+ btp.disconnectAll(deviceAddress, function() {
+ assertFailure(errorDisconnectFailed);
+ btp.disconnectAll(deviceAddress, function() {
+ chrome.test.assertNoLastError();
+ chrome.test.succeed();
+ });
+ });
+ });
+ });
+}
+
+function assertFailure(message) {
+ if (!chrome.runtime.lastError)
+ chrome.test.fail('Expected failure but got success.');
+
+ if (chrome.runtime.lastError.message == message)
+ return;
+
+ chrome.test.fail('Expected error "' + message + '" but got "' +
+ chrome.runtime.lastError.message + '" instead.');
+}
+
+chrome.test.runTests([testDisconnect]);

Powered by Google App Engine
This is Rietveld 408576698