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

Side by Side Diff: chrome/test/data/webui/settings/fake_settings_private.js

Issue 2254113002: MD Settings: reduce complexity and overhead of prefs singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SimplifyLanguages
Patch Set: Nit Created 4 years, 4 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
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 /** @fileoverview Fake implementation of chrome.settingsPrivate for testing. */ 5 /** @fileoverview Fake implementation of chrome.settingsPrivate for testing. */
6 cr.define('settings', function() { 6 cr.define('settings', function() {
7 /** 7 /**
8 * Creates a deep copy of the object. 8 * Creates a deep copy of the object.
9 * @param {!Object} obj 9 * @param {!Object} obj
10 * @return {!Object} 10 * @return {!Object}
11 */ 11 */
12 function deepCopy(obj) { 12 function deepCopy(obj) {
13 return JSON.parse(JSON.stringify(obj)); 13 return JSON.parse(JSON.stringify(obj));
14 } 14 }
15 15
16 /** 16 /**
17 * Fake of chrome.settingsPrivate API. Use by setting 17 * Fake of chrome.settingsPrivate API. Use by setting
18 * CrSettingsPrefs.deferInitialization to true, then passing a 18 * CrSettingsPrefs.deferInitialization to true, then passing a
19 * FakeSettingsPrivate to SettingsPrefs.initializeForTesting. 19 * FakeSettingsPrivate to settings-prefs#initialize().
20 * @constructor 20 * @constructor
21 * @param {Array<!settings.FakeSettingsPrivate.Pref>=} opt_initialPrefs 21 * @param {Array<!settings.FakeSettingsPrivate.Pref>=} opt_initialPrefs
22 * @implements {SettingsPrivate} 22 * @implements {SettingsPrivate}
23 */ 23 */
24 function FakeSettingsPrivate(opt_initialPrefs) { 24 function FakeSettingsPrivate(opt_initialPrefs) {
25 this.prefs = {}; 25 this.prefs = {};
26 26
27 if (!opt_initialPrefs) 27 if (!opt_initialPrefs)
28 return; 28 return;
29 for (var pref of opt_initialPrefs) 29 for (var pref of opt_initialPrefs)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 return {FakeSettingsPrivate: FakeSettingsPrivate}; 123 return {FakeSettingsPrivate: FakeSettingsPrivate};
124 }); 124 });
125 125
126 /** 126 /**
127 * @type {Array<{key: string, 127 * @type {Array<{key: string,
128 * type: chrome.settingsPrivate.PrefType, 128 * type: chrome.settingsPrivate.PrefType,
129 * values: !Array<*>}>} 129 * values: !Array<*>}>}
130 */ 130 */
131 settings.FakeSettingsPrivate.Pref; 131 settings.FakeSettingsPrivate.Pref;
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/prefs/prefs.js ('k') | chrome/test/data/webui/settings/languages_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698