Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview Fake implementations of chrome.bluetoothPrivate for testing. | |
| 7 */ | |
| 8 cr.define('settings', function() { | |
| 9 /** | |
| 10 * Fake of the chrome.bluetooth API. | |
| 11 * @param {Bluetooth} bluetoothApi | |
|
dpapad
2015/12/16 22:07:49
!Bluetooth
stevenjb
2015/12/17 00:13:35
Done.
| |
| 12 * @constructor | |
| 13 * @implements {BluetoothPrivate} | |
| 14 */ | |
| 15 function FakeBluetoothPrivate(bluetoothApi) { | |
| 16 this.bluetoothApi_ = bluetoothApi; | |
|
dpapad
2015/12/16 22:07:49
/** @private {!Bluetooth} */
stevenjb
2015/12/17 00:13:35
Done.
| |
| 17 } | |
| 18 | |
| 19 FakeBluetoothPrivate.prototype = { | |
| 20 /** | |
| 21 * @param {!chrome.bluetoothPrivate.NewAdapterState} adapterState | |
| 22 * @param {function():void=} callback | |
|
dpapad
2015/12/16 22:07:49
The convention is that optional parameters are nam
stevenjb
2015/12/17 00:13:35
Removed in favor of @override.
| |
| 23 */ | |
| 24 setAdapterState: function(state, callback) { | |
| 25 this.bluetoothApi_.enabled = state.powered; | |
| 26 setTimeout(callback); | |
|
dpapad
2015/12/16 22:07:49
The 2nd param to setTimeout is required according
stevenjb
2015/12/17 00:13:35
Hmm, not according to https://developer.mozilla.or
dpapad
2015/12/17 01:12:54
Ah, I see that is fine then. There is a mismatch i
| |
| 27 }, | |
| 28 | |
| 29 /** | |
| 30 * @param {!chrome.bluetoothPrivate.SetPairingResponseOptions} options | |
| 31 * @param {function():void=} callback | |
| 32 */ | |
| 33 setPairingResponse: assertNotReached, | |
| 34 | |
| 35 /** | |
| 36 * @param {string} deviceAddress | |
| 37 * @param {function():void=} callback | |
| 38 */ | |
| 39 disconnectAll: assertNotReached, | |
| 40 | |
| 41 /** | |
| 42 * @param {string} deviceAddress | |
| 43 * @param {function():void=} callback | |
| 44 */ | |
| 45 forgetDevice: assertNotReached, | |
| 46 | |
| 47 /** | |
| 48 * @param {!chrome.bluetoothPrivate.DiscoveryFilter} discoveryFilter | |
| 49 * @param {function():void=} callback | |
| 50 */ | |
| 51 setDiscoveryFilter: assertNotReached, | |
| 52 | |
| 53 /** | |
| 54 * @param {string} deviceAddress | |
| 55 * @param {function(!chrome.bluetoothPrivate.ConnectResultType):void=} | |
| 56 * callback | |
| 57 */ | |
| 58 connect: assertNotReached, | |
| 59 | |
| 60 /** | |
| 61 * @param {string} deviceAddress | |
| 62 * @param {function():void=} callback | |
| 63 */ | |
| 64 pair: assertNotReached, | |
| 65 | |
| 66 /** @type {!FakeChromeEvent} */ | |
| 67 onPairing: new FakeChromeEvent(), | |
|
dpapad
2015/12/16 22:07:49
Shouldn't this be placed in the constructor instea
stevenjb
2015/12/17 00:13:35
Let's discuss this here: https://codereview.chromi
| |
| 68 }; | |
| 69 | |
| 70 return {FakeBluetoothPrivate: FakeBluetoothPrivate}; | |
| 71 }); | |
| OLD | NEW |