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

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

Issue 2861443003: MD Settings: Fix subpage visibility and add appearance page tests (Closed)
Patch Set: Restore showPage_ Created 3 years, 7 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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {settings.AppearanceBrowserProxy} 7 * @implements {settings.AppearanceBrowserProxy}
8 * @extends {settings.TestBrowserProxy} 8 * @extends {settings.TestBrowserProxy}
9 */ 9 */
10 var TestAppearanceBrowserProxy = function() { 10 var TestAppearanceBrowserProxy = function() {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 theme: { 103 theme: {
104 id: { 104 id: {
105 value: '', 105 value: '',
106 }, 106 },
107 use_system: { 107 use_system: {
108 value: false, 108 value: false,
109 }, 109 },
110 }, 110 },
111 }, 111 },
112 }); 112 });
113 appearancePage.set('pageVisibility', {});
113 114
114 document.body.appendChild(appearancePage); 115 document.body.appendChild(appearancePage);
115 Polymer.dom.flush(); 116 Polymer.dom.flush();
116 } 117 }
117 118
119 suite('AppearancePageVisibility', function() {
120 setup(function() {
121 appearanceBrowserProxy = new TestAppearanceBrowserProxy();
122 settings.AppearanceBrowserProxyImpl.instance_ = appearanceBrowserProxy;
123 createAppearancePage();
124 });
125
126 teardown(function() {
127 appearancePage.remove();
128 });
129
130 test('setWallpaper', function() {
131 assertTrue(!!appearancePage.$$('#setWallpaper'));
132 if (cr.isChromeOS) {
133 assertFalse(appearancePage.$$('#setWallpaper').hidden);
134 } else {
135 assertTrue(appearancePage.$$('#setWallpaper').hidden);
136 }
137 });
138
139 test('setTheme', function() {
140 assertTrue(!!appearancePage.$$('#setTheme'));
141 assertFalse(appearancePage.$$('#setTheme').hidden);
142 });
143
144 test('homeButton', function() {
145 assertTrue(!!appearancePage.$$('#homeButton'));
146 assertFalse(appearancePage.$$('#homeButton').hidden);
147 });
148
149 test('bookmarksBar', function() {
150 assertTrue(!!appearancePage.$$('#bookmarksBar'));
151 assertFalse(appearancePage.$$('#bookmarksBar').hidden);
152 });
153 });
154
118 suite('AppearanceHandler', function() { 155 suite('AppearanceHandler', function() {
119 setup(function() { 156 setup(function() {
120 appearanceBrowserProxy = new TestAppearanceBrowserProxy(); 157 appearanceBrowserProxy = new TestAppearanceBrowserProxy();
121 settings.AppearanceBrowserProxyImpl.instance_ = appearanceBrowserProxy; 158 settings.AppearanceBrowserProxyImpl.instance_ = appearanceBrowserProxy;
122 createAppearancePage(); 159 createAppearancePage();
123 }); 160 });
124 161
125 teardown(function() { appearancePage.remove(); }); 162 teardown(function() { appearancePage.remove(); });
126 163
127 if (cr.isChromeOS) { 164 if (cr.isChromeOS) {
128 test('wallpaperManager', function() { 165 test('wallpaperManager', function() {
129 var button = appearancePage.$.wallpaperButton; 166 var button = appearancePage.$$('#setWallpaper');
130 assertTrue(!!button); 167 assertTrue(!!button);
131 MockInteractions.tap(button); 168 MockInteractions.tap(button);
132 return appearanceBrowserProxy.whenCalled('openWallpaperManager'); 169 return appearanceBrowserProxy.whenCalled('openWallpaperManager');
133 }); 170 });
134 } else { 171 } else {
135 test('noWallpaperManager', function() { 172 test('noWallpaperManager', function() {
136 // The wallpaper button should not be present. 173 // The wallpaper button should not be present.
137 var button = appearancePage.$.wallpaperButton; 174 var button = appearancePage.$$('#setWallpaper');
138 assertFalse(!!button); 175 assertFalse(!!button);
139 }); 176 });
140 } 177 }
141 178
142 var THEME_ID_PREF = 'prefs.extensions.theme.id.value'; 179 var THEME_ID_PREF = 'prefs.extensions.theme.id.value';
143 180
144 if (cr.isLinux && !cr.isChromeOS) { 181 if (cr.isLinux && !cr.isChromeOS) {
145 var USE_SYSTEM_PREF = 'prefs.extensions.theme.use_system.value'; 182 var USE_SYSTEM_PREF = 'prefs.extensions.theme.use_system.value';
146 183
147 test('useDefaultThemeLinux', function() { 184 test('useDefaultThemeLinux', function() {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 var button = appearancePage.$$('#useDefault'); 245 var button = appearancePage.$$('#useDefault');
209 assertTrue(!!button); 246 assertTrue(!!button);
210 247
211 MockInteractions.tap(button); 248 MockInteractions.tap(button);
212 return appearanceBrowserProxy.whenCalled('useDefaultTheme'); 249 return appearanceBrowserProxy.whenCalled('useDefaultTheme');
213 }); 250 });
214 } 251 }
215 252
216 test('default zoom handling', function() { 253 test('default zoom handling', function() {
217 function getDefaultZoomText() { 254 function getDefaultZoomText() {
218 var zoomLevel = appearancePage.$.zoomLevel; 255 var zoomLevel = appearancePage.$$('#zoomLevel');
219 return zoomLevel.options[zoomLevel.selectedIndex].textContent.trim(); 256 return zoomLevel.options[zoomLevel.selectedIndex].textContent.trim();
220 } 257 }
221 258
222 return appearanceBrowserProxy.whenCalled('getDefaultZoom').then(function() { 259 return appearanceBrowserProxy.whenCalled('getDefaultZoom').then(function() {
223 assertEquals('100%', getDefaultZoomText()); 260 assertEquals('100%', getDefaultZoomText());
224 261
225 appearanceBrowserProxy.setDefaultZoom(2 / 3); 262 appearanceBrowserProxy.setDefaultZoom(2 / 3);
226 createAppearancePage(); 263 createAppearancePage();
227 return appearanceBrowserProxy.whenCalled('getDefaultZoom'); 264 return appearanceBrowserProxy.whenCalled('getDefaultZoom');
228 }).then(function() { 265 }).then(function() {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 Polymer.dom.flush(); 319 Polymer.dom.flush();
283 assertEquals(homeUrlInput.value, '@@@'); // Value hasn't changed. 320 assertEquals(homeUrlInput.value, '@@@'); // Value hasn't changed.
284 assertTrue(homeUrlInput.invalid); 321 assertTrue(homeUrlInput.invalid);
285 322
286 // Should reset to default value on change event. 323 // Should reset to default value on change event.
287 homeUrlInput.$.input.fire('change'); 324 homeUrlInput.$.input.fire('change');
288 Polymer.dom.flush(); 325 Polymer.dom.flush();
289 assertEquals(homeUrlInput.value, 'test'); 326 assertEquals(homeUrlInput.value, 'test');
290 }); 327 });
291 }); 328 });
292 }); 329 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698