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

Unified Diff: chrome/test/data/webui/settings/fake_bluetooth_private.js

Issue 1466433002: Add Settings bluetooth page test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + Use FakeBluetooth + add device list tests Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/settings/fake_bluetooth_private.js
diff --git a/chrome/test/data/webui/settings/fake_bluetooth_private.js b/chrome/test/data/webui/settings/fake_bluetooth_private.js
new file mode 100644
index 0000000000000000000000000000000000000000..39b4f680fe7d88b66a2f1b5def00b091b316a5c9
--- /dev/null
+++ b/chrome/test/data/webui/settings/fake_bluetooth_private.js
@@ -0,0 +1,71 @@
+// Copyright 2015 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.
+
+/**
+ * @fileoverview Fake implementations of chrome.bluetoothPrivate for testing.
+ */
+cr.define('settings', function() {
+ /**
+ * Fake of the chrome.bluetooth API.
+ * @param {Bluetooth} bluetoothApi
dpapad 2015/12/16 22:07:49 !Bluetooth
stevenjb 2015/12/17 00:13:35 Done.
+ * @constructor
+ * @implements {BluetoothPrivate}
+ */
+ function FakeBluetoothPrivate(bluetoothApi) {
+ this.bluetoothApi_ = bluetoothApi;
dpapad 2015/12/16 22:07:49 /** @private {!Bluetooth} */
stevenjb 2015/12/17 00:13:35 Done.
+ }
+
+ FakeBluetoothPrivate.prototype = {
+ /**
+ * @param {!chrome.bluetoothPrivate.NewAdapterState} adapterState
+ * @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.
+ */
+ setAdapterState: function(state, callback) {
+ this.bluetoothApi_.enabled = state.powered;
+ 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
+ },
+
+ /**
+ * @param {!chrome.bluetoothPrivate.SetPairingResponseOptions} options
+ * @param {function():void=} callback
+ */
+ setPairingResponse: assertNotReached,
+
+ /**
+ * @param {string} deviceAddress
+ * @param {function():void=} callback
+ */
+ disconnectAll: assertNotReached,
+
+ /**
+ * @param {string} deviceAddress
+ * @param {function():void=} callback
+ */
+ forgetDevice: assertNotReached,
+
+ /**
+ * @param {!chrome.bluetoothPrivate.DiscoveryFilter} discoveryFilter
+ * @param {function():void=} callback
+ */
+ setDiscoveryFilter: assertNotReached,
+
+ /**
+ * @param {string} deviceAddress
+ * @param {function(!chrome.bluetoothPrivate.ConnectResultType):void=}
+ * callback
+ */
+ connect: assertNotReached,
+
+ /**
+ * @param {string} deviceAddress
+ * @param {function():void=} callback
+ */
+ pair: assertNotReached,
+
+ /** @type {!FakeChromeEvent} */
+ 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
+ };
+
+ return {FakeBluetoothPrivate: FakeBluetoothPrivate};
+});

Powered by Google App Engine
This is Rietveld 408576698