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

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

Issue 2801403002: MD Settings: Bluetooth: Fix adapter state and discovery (Closed)
Patch Set: Use CHECK instead of early exit Created 3 years, 8 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 8af4983c626b66ab21535380f2751487cd084003..e6a5601985f16072f6ab891154be8e7a4524c2be 100644
--- a/chrome/test/data/webui/settings/fake_bluetooth.js
+++ b/chrome/test/data/webui/settings/fake_bluetooth.js
@@ -12,7 +12,7 @@ cr.define('settings', function() {
* @implements {Bluetooth}
*/
function FakeBluetooth() {
- /** @type {!chrome.bluetooth.AdapterState} */ this.adapterState = {
+ /** @type {!chrome.bluetooth.AdapterState} */ this.adapterState_ = {
address: '00:11:22:33:44:55:66',
name: 'Fake Adapter',
powered: false,
@@ -27,8 +27,19 @@ cr.define('settings', function() {
// Public testing methods.
/** @param {boolean} enabled */
setEnabled: function(enabled) {
- this.adapterState.powered = enabled;
- this.onAdapterStateChanged.callListeners(this.adapterState);
+ this.setAdapterState({powered: enabled});
+ },
+
+ /** @param {!chrome.bluetooth.AdapterState} state*/
+ setAdapterState: function(state) {
+ Object.assign(this.adapterState_, state);
+ this.onAdapterStateChanged.callListeners(
+ Object.assign({}, this.adapterState_));
+ },
+
+ /** @return {!chrome.bluetooth.AdapterState} */
+ getAdapterStateForTest: function() {
+ return Object.assign({}, this.adapterState_);
},
/** @param {!Array<!chrome.bluetooth.Device>} devices */
@@ -67,7 +78,7 @@ cr.define('settings', function() {
// Bluetooth overrides.
/** @override */
getAdapterState: function(callback) {
- callback(this.adapterState);
+ callback(Object.assign({}, this.adapterState_));
},
/** @override */
« 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