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

Unified Diff: chrome/test/data/webui/settings/prefs_tests.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/webui/settings/passwords_and_forms_browsertest.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/prefs_tests.js
diff --git a/chrome/test/data/webui/settings/prefs_tests.js b/chrome/test/data/webui/settings/prefs_tests.js
index b20f6573d0940aaad5b7d5b364ab5a4db59b6821..71144d7d04a51b1a4a846e42e77f99b9a20343b5 100644
--- a/chrome/test/data/webui/settings/prefs_tests.js
+++ b/chrome/test/data/webui/settings/prefs_tests.js
@@ -17,7 +17,7 @@ cr.define('settings_prefs', function() {
suite('CrSettingsPrefs', function() {
/**
* Prefs instance created before each test.
- * @type {CrSettingsPrefsElement|undefined}
+ * @type {SettingsPrefsElement|undefined}
*/
var prefs;
@@ -70,13 +70,7 @@ cr.define('settings_prefs', function() {
}
}
- /**
- * List of CrSettingsPref elements created for testing.
- * @type {!Array<!CrSettingsPrefs>}
- */
- var createdElements = [];
-
- // Initialize <settings-prefs> elements before each test.
+ // Initialize a <settings-prefs> before each test.
setup(function() {
// Override chrome.settingsPrivate with FakeSettingsPrivate.
fakeApi = new settings.FakeSettingsPrivate(
@@ -85,18 +79,8 @@ cr.define('settings_prefs', function() {
}));
CrSettingsPrefs.deferInitialization = true;
- // Create and attach the <settings-prefs> elements. Make several of
- // them to test that the shared state model scales correctly.
- createdElements = [];
- for (var i = 0; i < 100; i++) {
- var prefsInstance = document.createElement('settings-prefs');
- document.body.appendChild(prefsInstance);
- createdElements.push(prefsInstance);
- prefsInstance.initializeForTesting(fakeApi);
- }
- // For simplicity, only use one prefs element in the tests. Use an
- // arbitrary index instead of the first or last element created.
- prefs = createdElements[42];
+ prefs = document.createElement('settings-prefs');
+ prefs.initialize(fakeApi);
// getAllPrefs is asynchronous, so return the prefs promise.
return CrSettingsPrefs.initialized;
@@ -105,11 +89,7 @@ cr.define('settings_prefs', function() {
teardown(function() {
CrSettingsPrefs.resetForTesting();
CrSettingsPrefs.deferInitialization = false;
-
- // Reset each <settings-prefs>. TODO(michaelpg): make settings-prefs
- // less dependent on testing state so we don't have to do this.
- for (var i = 0; i < createdElements.length; i++)
- createdElements[i].resetForTesting();
+ prefs.resetForTesting();
PolymerTest.clearBody();
});
« no previous file with comments | « chrome/test/data/webui/settings/passwords_and_forms_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698