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

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

Issue 1568703002: Add Bluetooth settings dialog tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: .. Created 4 years, 11 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 64e646eb1bea8884a0f28dee665b109faed7f9e1..06f5923a0ec188617a9832547db2218997e424bf 100644
--- a/chrome/test/data/webui/settings/fake_bluetooth.js
+++ b/chrome/test/data/webui/settings/fake_bluetooth.js
@@ -12,7 +12,13 @@ cr.define('settings', function() {
* @implements {Bluetooth}
*/
function FakeBluetooth() {
- /** @type {boolean} */ this.enabled = false;
+ /** @type {!chrome.bluettoth.AdapterState} */ this.adapterState = {
+ address: '00:11:22:33:44:55:66',
+ name: 'Fake Adapter',
+ powered: false,
+ available: true,
+ discovering: false
+ };
/** @type {!Array<!chrome.bluetooth.Device>} */ this.devices = [];
}
@@ -20,6 +26,14 @@ cr.define('settings', function() {
FakeBluetooth.prototype = {
// Public testing methods.
/**
+ * @param {boolean} enabled
+ */
+ setEnabled: function(enabled) {
+ this.adapterState.powered = enabled;
+ this.onAdapterStateChanged.callListeners(this.adapterState);
+ },
+
+ /**
* @param {!Array<!chrome.bluetooth.Device>} devices
*/
setDevicesForTest: function(devices) {
@@ -34,13 +48,7 @@ cr.define('settings', function() {
/** @override */
getAdapterState: function(callback) {
setTimeout(function() {
- callback({
- address: '00:11:22:33:44:55:66',
- name: 'Fake Adapter',
- powered: this.enabled,
- available: true,
- discovering: false
- });
+ callback(this.adapterState);
}.bind(this));
},

Powered by Google App Engine
This is Rietveld 408576698