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

Side by Side Diff: chrome/test/data/webui/settings/fake_bluetooth_private.js

Issue 2801403002: MD Settings: Bluetooth: Fix adapter state and discovery (Closed)
Patch Set: Use CHECK instead of early exit Created 3 years, 8 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
« no previous file with comments | « chrome/test/data/webui/settings/fake_bluetooth.js ('k') | extensions/browser/api/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** 5 /**
6 * @fileoverview Fake implementation of chrome.bluetoothPrivate for testing. 6 * @fileoverview Fake implementation of chrome.bluetoothPrivate for testing.
7 */ 7 */
8 cr.define('settings', function() { 8 cr.define('settings', function() {
9 /** 9 /**
10 * Fake of the chrome.bluetooth API. 10 * Fake of the chrome.bluetooth API.
11 * @param {!Bluetooth} bluetoothApi 11 * @param {!Bluetooth} bluetoothApi
12 * @constructor 12 * @constructor
13 * @implements {BluetoothPrivate} 13 * @implements {BluetoothPrivate}
14 */ 14 */
15 function FakeBluetoothPrivate(bluetoothApi) { 15 function FakeBluetoothPrivate(bluetoothApi) {
16 /** @private {!Bluetooth} */ this.bluetoothApi_ = bluetoothApi; 16 /** @private {!Bluetooth} */ this.bluetoothApi_ = bluetoothApi;
17 17
18 /** @type {!Set<string>} */ this.connectedDevices_ = new Set(); 18 /** @type {!Set<string>} */ this.connectedDevices_ = new Set();
19 19
20 /** @type {!Object<!chrome.bluetoothPrivate.SetPairingResponseOptions>} */ 20 /** @type {!Object<!chrome.bluetoothPrivate.SetPairingResponseOptions>} */
21 this.pairingResponses_ = {}; 21 this.pairingResponses_ = {};
22 } 22 }
23 23
24 FakeBluetoothPrivate.prototype = { 24 FakeBluetoothPrivate.prototype = {
25 /** @override */ 25 /** @override */
26 setAdapterState: function(state, opt_callback) { 26 setAdapterState: function(state, opt_callback) {
27 this.bluetoothApi_.adapterState = state; 27 this.bluetoothApi_.setAdapterState(state);
28 if (opt_callback) 28 if (opt_callback)
29 opt_callback(); 29 opt_callback();
30 }, 30 },
31 31
32 /** @override */ 32 /** @override */
33 setPairingResponse: function(options, opt_callback) { 33 setPairingResponse: function(options, opt_callback) {
34 this.pairingResponses_[options.device.address] = options; 34 this.pairingResponses_[options.device.address] = options;
35 if (opt_callback) 35 if (opt_callback)
36 opt_callback(); 36 opt_callback();
37 }, 37 },
(...skipping 20 matching lines...) Expand all
58 58
59 /** @override */ 59 /** @override */
60 pair: assertNotReached, 60 pair: assertNotReached,
61 61
62 /** @type {!FakeChromeEvent} */ 62 /** @type {!FakeChromeEvent} */
63 onPairing: new FakeChromeEvent(), 63 onPairing: new FakeChromeEvent(),
64 }; 64 };
65 65
66 return {FakeBluetoothPrivate: FakeBluetoothPrivate}; 66 return {FakeBluetoothPrivate: FakeBluetoothPrivate};
67 }); 67 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/fake_bluetooth.js ('k') | extensions/browser/api/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698