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

Side by Side Diff: chrome/test/data/webui/settings/appearance_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 | « no previous file | chrome/test/data/webui/settings/on_startup_browsertest.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 /** @fileoverview Runs Polymer Appearance Settings elements. */ 5 /** @fileoverview Runs Polymer Appearance Settings elements. */
6 6
7 GEN_INCLUDE(['settings_page_browsertest.js']); 7 GEN_INCLUDE(['settings_page_browsertest.js']);
8 8
9 /** 9 /**
10 * Test Polymer Appearance Settings elements. 10 * Test Polymer Appearance Settings elements.
(...skipping 24 matching lines...) Expand all
35 */ 35 */
36 var settingsPrefs; 36 var settingsPrefs;
37 var self = this; 37 var self = this;
38 38
39 var fontSize = function() { 39 var fontSize = function() {
40 return self.appearancePage( 40 return self.appearancePage(
41 '#defaultFontSize').$$('[class=iron-selected]').textContent.trim(); 41 '#defaultFontSize').$$('[class=iron-selected]').textContent.trim();
42 }; 42 };
43 43
44 suite('AppearanceHandler', function() { 44 suite('AppearanceHandler', function() {
45 var fakePrefs = [{
46 key: 'webkit.webprefs.default_font_size',
47 type: chrome.settingsPrivate.PrefType.NUMBER,
48 value: 1234,
49 }];
50
51 suiteSetup(function() { 45 suiteSetup(function() {
52 settingsPrefs = document.querySelector( 46 settingsPrefs = document.querySelector(
53 'cr-settings').$$('settings-prefs'); 47 'cr-settings').$$('settings-prefs');
54 assertTrue(!!settingsPrefs); 48 assertTrue(!!settingsPrefs);
55 CrSettingsPrefs.resetForTesting();
56 settingsPrefs.resetForTesting();
57 var fakeApi = new settings.FakeSettingsPrivate(fakePrefs);
58 settingsPrefs.initializeForTesting(fakeApi);
59 return CrSettingsPrefs.initialized; 49 return CrSettingsPrefs.initialized;
60 }); 50 });
61 51
62 test('very small font', function() { 52 test('very small font', function() {
63 settingsPrefs.set('prefs.webkit.webprefs.default_font_size.value', 9); 53 settingsPrefs.set('prefs.webkit.webprefs.default_font_size.value', 9);
64 assertEquals('Very small', fontSize()); 54 assertEquals('Very small', fontSize());
65 }); 55 });
66 56
67 test('large font', function() { 57 test('large font', function() {
68 settingsPrefs.set('prefs.webkit.webprefs.default_font_size.value', 20); 58 settingsPrefs.set('prefs.webkit.webprefs.default_font_size.value', 20);
69 assertEquals('Large', fontSize()); 59 assertEquals('Large', fontSize());
70 }); 60 });
71 61
72 /** 62 /**
73 * If the font size is not one of the preset options (e.g. 16, 20, etc.) 63 * If the font size is not one of the preset options (e.g. 16, 20, etc.)
74 * then the menu label will be 'Custom' (rather than 'Medium', 'Large', 64 * then the menu label will be 'Custom' (rather than 'Medium', 'Large',
75 * etc.). 65 * etc.).
76 */ 66 */
77 test('custom font size', function() { 67 test('custom font size', function() {
78 settingsPrefs.set( 68 settingsPrefs.set(
79 'prefs.webkit.webprefs.default_font_size', 19); 69 'prefs.webkit.webprefs.default_font_size.value', 19);
80 assertEquals('Custom', fontSize()); 70 assertEquals('Custom', fontSize());
81 }); 71 });
82 }); 72 });
83 mocha.run(); 73 mocha.run();
84 }); 74 });
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/on_startup_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698