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

Unified Diff: chrome/browser/resources/settings/bluetooth_page/bluetooth_page.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/browser/resources/settings/bluetooth_page/bluetooth_page.js
diff --git a/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js b/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js
index 6ba77e0252bf4139979e707f05c3c7fac017d46a..986598cef445391f75a08e85c8898defbfa66b54 100644
--- a/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js
+++ b/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js
@@ -17,6 +17,19 @@
* @group Chrome Settings Elements
* @element settings-bluetooth-page
*/
+
+/**
+ * Set this to provide a fake implementation for testing.
+ * @type {Bluetooth}
+ */
+var bluetoothApiForTest;
+
+/**
+ * Set this to provide a fake implementation for testing.
+ * @type {BluetoothPrivate}
+ */
+var bluetoothPrivateApiForTest;
+
Polymer({
is: 'settings-bluetooth-page',
@@ -83,6 +96,13 @@ Polymer({
*/
bluetoothDeviceRemovedListener_: undefined,
+ /** @override */
+ ready: function() {
+ if (bluetoothApiForTest)
+ this.bluetooth = bluetoothApiForTest;
+ if (bluetoothPrivateApiForTest)
+ this.bluetoothPrivate = bluetoothPrivateApiForTest;
+ },
/** @override */
attached: function() {
@@ -231,11 +251,13 @@ Polymer({
},
/**
- * @param {!Array<!chrome.bluetooth.Device>} deviceList
+ * @param {Object} deviceListChanges
* @return {boolean} True if deviceList is not empty.
* @private
*/
- haveDevices_: function(deviceList) { return !!deviceList.length; },
+ haveDevices_: function(deviceListChanges) {
+ return !!this.deviceList.length;
+ },
/**
* @param {number} selectedDevice

Powered by Google App Engine
This is Rietveld 408576698