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

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: Ran update_extension_functions.py Created 6 years 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..8c598224f96ec67163e1a1913f19aff55b9a58f7
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/bluetooth_private/disconnect/test.js
@@ -0,0 +1,37 @@
+// 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';
Jeffrey Yasskin 2014/12/20 00:53:48 This message has been really annoying when debuggi
armansito 2014/12/20 01:24:28 The only error that BlueZ returns is 'org.bluez.Er
Jeffrey Yasskin 2014/12/20 01:29:58 If this error case is impossible, you should proba
armansito 2014/12/20 01:43:38 No it's not impossible. I'm not sure I'm following
+
+var btp = chrome.bluetoothPrivate;
+
+function testDisconnect() {
+ btp.disconnect(deviceAddress, function() {
+ assertFailure(errorNotConnected);
+ btp.disconnect(deviceAddress, function() {
+ assertFailure(errorDisconnectFailed);
+ btp.disconnect(deviceAddress, function() {
+ chrome.test.assertNoLastError();
+ if (chrome.runtime.lastError)
Jeffrey Yasskin 2014/12/20 00:53:48 Isn't this redundant with the assertNoLastError()
armansito 2014/12/20 01:24:28 I'm not sure actually, as I mostly followed the ot
+ chrome.test.fail(chrome.runtime.lastError);
+ 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