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

Side by Side Diff: chrome/browser/resources/settings/prefs/prefs.js

Issue 1827823003: MD Settings: Rename and fix confusing prefs test function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PrefsTests
Patch Set: simplify Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/prefs_tests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright 2015 The Chromium Authors. All rights reserved. 1 /* Copyright 2015 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. */ 3 * found in the LICENSE file. */
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-prefs' exposes a singleton model of Chrome settings and 7 * 'settings-prefs' exposes a singleton model of Chrome settings and
8 * preferences, which listens to changes to Chrome prefs whitelisted in 8 * preferences, which listens to changes to Chrome prefs whitelisted in
9 * chrome.settingsPrivate. When changing prefs in this element's 'prefs' 9 * chrome.settingsPrivate. When changing prefs in this element's 'prefs'
10 * property via the UI, the singleton model tries to set those preferences in 10 * property via the UI, the singleton model tries to set those preferences in
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 /** 232 /**
233 * Used to initialize the singleton with a fake SettingsPrivate. 233 * Used to initialize the singleton with a fake SettingsPrivate.
234 * @param {SettingsPrivate} settingsApi Fake implementation to use. 234 * @param {SettingsPrivate} settingsApi Fake implementation to use.
235 */ 235 */
236 initializeForTesting: function(settingsApi) { 236 initializeForTesting: function(settingsApi) {
237 this.singleton_.initialize(settingsApi); 237 this.singleton_.initialize(settingsApi);
238 }, 238 },
239 239
240 /** 240 /**
241 * Uninitializes this element to remove it from tests. Also resets 241 * Uninitializes this element to render it inert in tests. Also resets
242 * settings-prefs-singleton, allowing newly created elements to 242 * settings-prefs-singleton, allowing newly created elements to
243 * re-initialize it. 243 * re-initialize it.
244 */ 244 */
245 resetForTesting: function() { 245 uninitializeForTesting: function() {
246 this.stopListening_();
246 this.singleton_.resetForTesting(); 247 this.singleton_.resetForTesting();
247 }, 248 },
248 }); 249 });
249 250
250 /** 251 /**
251 * Privately used element that contains, listens to and updates the shared 252 * Privately used element that contains, listens to and updates the shared
252 * prefs state. 253 * prefs state.
253 */ 254 */
254 Polymer({ 255 Polymer({
255 is: 'settings-prefs-singleton', 256 is: 'settings-prefs-singleton',
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 this.prefs = undefined; 432 this.prefs = undefined;
432 this.lastPrefValues_ = {}; 433 this.lastPrefValues_ = {};
433 this.initialized_ = false; 434 this.initialized_ = false;
434 // Remove the listener added in initialize(). 435 // Remove the listener added in initialize().
435 this.settingsApi_.onPrefsChanged.removeListener(this.boundPrefsChanged_); 436 this.settingsApi_.onPrefsChanged.removeListener(this.boundPrefsChanged_);
436 this.settingsApi_ = 437 this.settingsApi_ =
437 /** @type {SettingsPrivate} */(chrome.settingsPrivate); 438 /** @type {SettingsPrivate} */(chrome.settingsPrivate);
438 }, 439 },
439 }); 440 });
440 })(); 441 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/prefs_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698