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

Unified Diff: chrome/browser/resources/settings/prefs/prefs.js

Issue 1447103002: MD Settings: FakeSettingsPrivate for tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mock -> fake Created 5 years, 1 month 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/prefs/prefs.js
diff --git a/chrome/browser/resources/settings/prefs/prefs.js b/chrome/browser/resources/settings/prefs/prefs.js
index d46ff88776ceb394d102f6c2f641427a904f0ea9..4d39adc5b7f3fa0cb384e7563d204654ff0a676b 100644
--- a/chrome/browser/resources/settings/prefs/prefs.js
+++ b/chrome/browser/resources/settings/prefs/prefs.js
@@ -267,22 +267,15 @@
'prefs-changed': 'prefsChanged_',
},
- settingsApi_: chrome.settingsPrivate,
-
initialize: function() {
// Only initialize once (or after resetForTesting() is called).
if (this.initialized_)
return;
this.initialized_ = true;
- // Set window.mockApi to pass a custom settings API, i.e. for tests.
- // TODO(michaelpg): don't use a global.
- if (window.mockApi)
- this.settingsApi_ = window.mockApi;
-
- this.settingsApi_.onPrefsChanged.addListener(
+ chrome.settingsPrivate.onPrefsChanged.addListener(
Dan Beam 2015/11/17 23:01:15 why are you [able to] undo this?
michaelpg 2015/11/17 23:51:51 I don't like this because: * checking for a glob
this.onSettingsPrivatePrefsChanged_.bind(this));
- this.settingsApi_.getAllPrefs(
+ chrome.settingsPrivate.getAllPrefs(
this.onSettingsPrivatePrefsFetched_.bind(this));
},
@@ -308,7 +301,7 @@
if (deepEqual(prefStoreValue, prefObj.value))
return;
- this.settingsApi_.setPref(
+ chrome.settingsPrivate.setPref(
key,
prefObj.value,
/* pageId */ '',
@@ -348,7 +341,7 @@
// Get the current pref value from chrome.settingsPrivate to ensure the
// UI stays up to date.
- this.settingsApi_.getPref(key, function(pref) {
+ chrome.settingsPrivate.getPref(key, function(pref) {
this.updatePrefs_([pref]);
}.bind(this));
},

Powered by Google App Engine
This is Rietveld 408576698