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

Side by Side Diff: chrome/test/data/extensions/api_test/bluetooth_low_energy/connect_in_progress/runtest.js

Issue 1287753002: bluetooth: Remove callback from BluetoothGattConnection::Disconnect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge TOT Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var deviceAddress0 = '11:22:33:44:55:66'; 5 var deviceAddress0 = '11:22:33:44:55:66';
6 var ble = chrome.bluetoothLowEnergy; 6 var ble = chrome.bluetoothLowEnergy;
7 7
8 var errorInProgress = 'In progress'; 8 var errorInProgress = 'In progress';
9 var errorNotConnected = 'Not connected';
9 10
10 function expectError(message) { 11 function expectError(message) {
11 if (!chrome.runtime.lastError || 12 if (!chrome.runtime.lastError ||
12 chrome.runtime.lastError.message != message) 13 chrome.runtime.lastError.message != message)
13 chrome.test.sendMessage('Expected error: <' + message + '> got <' 14 chrome.test.sendMessage('Expected error: <' + message + '> got <'
14 + chrome.runtime.lastError.message + '>'); 15 + chrome.runtime.lastError.message + '>');
15 } 16 }
16 17
17 function expectSuccess() { 18 function expectSuccess() {
18 if (chrome.runtime.lastError) 19 if (chrome.runtime.lastError)
19 chrome.test.sendMessage('Unexpected error: ' 20 chrome.test.sendMessage('Unexpected error: '
20 + chrome.runtime.lastError.message); 21 + chrome.runtime.lastError.message);
21 } 22 }
22 23
23 ble.connect(deviceAddress0, function () { 24 ble.connect(deviceAddress0, function () {
24 expectSuccess(); 25 expectSuccess();
25 ble.disconnect(deviceAddress0, function () { 26 ble.disconnect(deviceAddress0, function () {
26 chrome.test.succeed(); 27 chrome.test.succeed();
27 }); 28 });
28 29
29 ble.disconnect(deviceAddress0, function () { 30 ble.disconnect(deviceAddress0, function () {
30 expectError(errorInProgress); 31 expectError(errorNotConnected);
31 chrome.test.sendMessage('ready'); 32 chrome.test.sendMessage(
33 'After 2nd call to disconnect.');
32 }); 34 });
33 }); 35 });
34 36
35 ble.connect(deviceAddress0, function () { 37 ble.connect(deviceAddress0, function () {
36 expectError(errorInProgress); 38 expectError(errorInProgress);
37 chrome.test.sendMessage('ready'); 39 chrome.test.sendMessage(
40 'After 2nd connect fails due to 1st connect being in progress.');
38 }); 41 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698