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

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

Issue 1833613002: MD Settings: fix improper use of prefs in tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « chrome/test/data/webui/settings/appearance_browsertest.js ('k') | no next file » | 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 /** @fileoverview Runs Polymer OnStartup Settings tests. */ 5 /** @fileoverview Runs Polymer OnStartup Settings tests. */
6 6
7 GEN_INCLUDE(['settings_page_browsertest.js']); 7 GEN_INCLUDE(['settings_page_browsertest.js']);
8 8
9 /** 9 /**
10 * Radio button enum values for restore on startup. 10 * Radio button enum values for restore on startup.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 */ 45 */
46 var settingsPrefs; 46 var settingsPrefs;
47 var self = this; 47 var self = this;
48 48
49 var restoreOnStartup = function() { 49 var restoreOnStartup = function() {
50 return self.getPageElement('#onStartupRadioGroup').querySelector( 50 return self.getPageElement('#onStartupRadioGroup').querySelector(
51 '.iron-selected').textContent.trim(); 51 '.iron-selected').textContent.trim();
52 }; 52 };
53 53
54 suite('OnStartupHandler', function() { 54 suite('OnStartupHandler', function() {
55 var fakePrefs = [{
56 key: 'session.restore_on_startup',
57 type: chrome.settingsPrivate.PrefType.NUMBER,
58 value: 1234,
59 }];
60
61 suiteSetup(function() { 55 suiteSetup(function() {
62 settingsPrefs = document.querySelector('cr-settings').$$( 56 settingsPrefs = document.querySelector('cr-settings').$$(
63 'settings-prefs'); 57 'settings-prefs');
64 assertTrue(!!settingsPrefs); 58 assertTrue(!!settingsPrefs);
65 CrSettingsPrefs.resetForTesting();
66 settingsPrefs.resetForTesting();
67 var fakeApi = new settings.FakeSettingsPrivate(fakePrefs);
68 settingsPrefs.initializeForTesting(fakeApi);
69 return CrSettingsPrefs.initialized; 59 return CrSettingsPrefs.initialized;
70 }); 60 });
71 61
72 test('open-continue', function() { 62 test('open-continue', function() {
73 settingsPrefs.set('prefs.session.restore_on_startup.value', 63 settingsPrefs.set('prefs.session.restore_on_startup.value',
74 RestoreOnStartupEnum.CONTINUE); 64 RestoreOnStartupEnum.CONTINUE);
75 assertEquals('Continue where you left off', restoreOnStartup()); 65 assertEquals('Continue where you left off', restoreOnStartup());
76 }); 66 });
77 67
78 test('open-ntp', function() { 68 test('open-ntp', function() {
79 settingsPrefs.set('prefs.session.restore_on_startup.value', 69 settingsPrefs.set('prefs.session.restore_on_startup.value',
80 RestoreOnStartupEnum.OPEN_NEW_TAB); 70 RestoreOnStartupEnum.OPEN_NEW_TAB);
81 assertEquals('Open the New Tab page', restoreOnStartup()); 71 assertEquals('Open the New Tab page', restoreOnStartup());
82 }); 72 });
83 73
84 test('open-specific', function() { 74 test('open-specific', function() {
85 settingsPrefs.set('prefs.session.restore_on_startup.value', 75 settingsPrefs.set('prefs.session.restore_on_startup.value',
86 RestoreOnStartupEnum.OPEN_SPECIFIC); 76 RestoreOnStartupEnum.OPEN_SPECIFIC);
87 assertEquals('Open a specific page or set of pages', restoreOnStartup()); 77 assertEquals('Open a specific page or set of pages', restoreOnStartup());
88 }); 78 });
89 }); 79 });
90 mocha.run(); 80 mocha.run();
91 }); 81 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/appearance_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698