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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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 var deviceAddress = '11:12:13:14:15:16';
6 var errorNotConnected = 'Device is not connected';
7 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
8
9 var btp = chrome.bluetoothPrivate;
10
11 function testDisconnect() {
12 btp.disconnect(deviceAddress, function() {
13 assertFailure(errorNotConnected);
14 btp.disconnect(deviceAddress, function() {
15 assertFailure(errorDisconnectFailed);
16 btp.disconnect(deviceAddress, function() {
17 chrome.test.assertNoLastError();
18 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
19 chrome.test.fail(chrome.runtime.lastError);
20 chrome.test.succeed();
21 });
22 });
23 });
24 }
25
26 function assertFailure(message) {
27 if (!chrome.runtime.lastError)
28 chrome.test.fail('Expected failure but got success.');
29
30 if (chrome.runtime.lastError.message == message)
31 return;
32
33 chrome.test.fail('Expected error "' + message + '" but got "' +
34 chrome.runtime.lastError.message + '" instead.');
35 }
36
37 chrome.test.runTests([testDisconnect]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698