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

Side by Side Diff: chrome/test/data/extensions/api_test/bluetooth_private/pair/test.js

Issue 1419023004: Add bluetoothPrivate.connect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_543294_bluetooth_options_2b_props
Patch Set: Rebase Created 5 years, 1 month 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 deviceAddress = '11:12:13:14:15:16'; 5 var deviceAddress = '11:12:13:14:15:16';
6 var errorPairingNotEnabled = 'Pairing not enabled';
6 7
7 function testPair() { 8 function testPair() {
8 chrome.bluetoothPrivate.onPairing.addListener(function(pairingEvent) { 9 chrome.bluetoothPrivate.pair(deviceAddress, function() {
9 chrome.test.assertEq('confirmPasskey', pairingEvent.pairing); 10 chrome.test.assertEq(
10 chrome.bluetoothPrivate.setPairingResponse({ 11 errorPairingNotEnabled, chrome.runtime.lastError.message);
12
13 // onPairing listener must be provided for pair to succeed.
14 chrome.bluetoothPrivate.onPairing.addListener(function(pairingEvent) {
15 chrome.test.assertEq('confirmPasskey', pairingEvent.pairing);
16 chrome.bluetoothPrivate.setPairingResponse({
11 device: pairingEvent.device, 17 device: pairingEvent.device,
12 response: 'confirm', 18 response: 'confirm',
13 }, function() { 19 }, function() {
20 chrome.test.assertNoLastError();
21 });
22 });
23
24 chrome.bluetoothPrivate.pair(deviceAddress, function() {
14 chrome.test.assertNoLastError(); 25 chrome.test.assertNoLastError();
26 chrome.test.succeed();
15 }); 27 });
16 }); 28 });
17
18 chrome.bluetoothPrivate.pair(deviceAddress, function() {
19 chrome.test.assertNoLastError();
20 chrome.test.succeed();
21 });
22 } 29 }
23 30
24 chrome.test.runTests([testPair]); 31 chrome.test.runTests([testPair]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698