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

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

Issue 2676103002: MD Settings: Move bluetooth UI from dialog to subpage (Closed)
Patch Set: Feedback Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/settings/fake_bluetooth.js
diff --git a/chrome/test/data/webui/settings/fake_bluetooth.js b/chrome/test/data/webui/settings/fake_bluetooth.js
index bda3e4daa40d43a59fb0e52019868a48b746dec7..8af4983c626b66ab21535380f2751487cd084003 100644
--- a/chrome/test/data/webui/settings/fake_bluetooth.js
+++ b/chrome/test/data/webui/settings/fake_bluetooth.js
@@ -25,17 +25,13 @@ cr.define('settings', function() {
FakeBluetooth.prototype = {
// Public testing methods.
- /**
- * @param {boolean} enabled
- */
+ /** @param {boolean} enabled */
setEnabled: function(enabled) {
this.adapterState.powered = enabled;
this.onAdapterStateChanged.callListeners(this.adapterState);
},
- /**
- * @param {!Array<!chrome.bluetooth.Device>} devices
- */
+ /** @param {!Array<!chrome.bluetooth.Device>} devices */
setDevicesForTest: function(devices) {
for (var d of this.devices)
this.onDeviceRemoved.callListeners(d);
@@ -44,6 +40,30 @@ cr.define('settings', function() {
this.onDeviceAdded.callListeners(d);
},
+ /**
+ * @param {string}
+ * @return {!chrome.bluetooth.Device}
+ */
+ getDeviceForTest: function(address) {
+ return this.devices.find(function(d) {
+ return d.address == address;
+ });
+ },
+
+ /** @param {!chrome.bluetooth.Device} device */
+ updateDeviceForTest: function(device, opt_callback) {
+ var index = this.devices.findIndex(function(d) {
+ return d.address == device.address;
+ });
+ if (index == -1) {
+ this.devices.push(device);
+ this.onDeviceAdded.callListeners(device);
+ return;
+ }
+ this.devices[index] = device;
+ this.onDeviceChanged.callListeners(device);
+ },
+
// Bluetooth overrides.
/** @override */
getAdapterState: function(callback) {
« no previous file with comments | « chrome/test/data/webui/settings/bluetooth_page_tests.js ('k') | chrome/test/data/webui/settings/fake_bluetooth_private.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698