| 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]);
|
|
|