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

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

Issue 2773233002: MD Settings: change settings-input to home-url-input due to reduced usage. (Closed)
Patch Set: updates based on comments Created 3 years, 8 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/browser/resources/settings/settings_resources.grd ('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 /** 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 setDefaultZoom: function(defaultZoom) { 68 setDefaultZoom: function(defaultZoom) {
69 this.defaultZoom_ = defaultZoom; 69 this.defaultZoom_ = defaultZoom;
70 }, 70 },
71 71
72 /** @param {boolean} Whether the user is supervised */ 72 /** @param {boolean} Whether the user is supervised */
73 setIsSupervised: function(isSupervised) { 73 setIsSupervised: function(isSupervised) {
74 this.isSupervised_ = isSupervised; 74 this.isSupervised_ = isSupervised;
75 }, 75 },
76 76
77 /** @override */ 77 /** @override */
78 validateStartupPage: function(value) { 78 validateStartupPage: function(url) {
79 this.methodCalled('validateStartupPage'); 79 this.methodCalled('validateStartupPage', url);
80 return Promise.resolve(this.isHomeUrlValid_); 80 return Promise.resolve(this.isHomeUrlValid_);
81 }, 81 },
82 82
83 /** 83 /**
84 * @param {boolean} isValid 84 * @param {boolean} isValid
85 */ 85 */
86 setValidStartupPageResponse: function(isValid) { 86 setValidStartupPageResponse: function(isValid) {
87 this.isHomeUrlValid_ = isValid; 87 this.isHomeUrlValid_ = isValid;
88 } 88 }
89 }; 89 };
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 }); 243 });
244 244
245 test('show home button toggling', function() { 245 test('show home button toggling', function() {
246 assertFalse(!!appearancePage.$$('.list-frame')); 246 assertFalse(!!appearancePage.$$('.list-frame'));
247 appearancePage.set('prefs', {browser: {show_home_button: {value: true}}}); 247 appearancePage.set('prefs', {browser: {show_home_button: {value: true}}});
248 248
249 Polymer.dom.flush(); 249 Polymer.dom.flush();
250 250
251 assertTrue(!!appearancePage.$$('.list-frame')); 251 assertTrue(!!appearancePage.$$('.list-frame'));
252 }); 252 });
253 });
254
255 suite('HomeUrlInput', function() {
256 var homeUrlInput;
257
258 setup(function() {
259 appearanceBrowserProxy = new TestAppearanceBrowserProxy();
260 settings.AppearanceBrowserProxyImpl.instance_ = appearanceBrowserProxy;
261 PolymerTest.clearBody();
262
263 homeUrlInput = document.createElement('home-url-input');
264 homeUrlInput.set(
265 'pref', {type: chrome.settingsPrivate.PrefType.URL, value: 'test'});
266
267 document.body.appendChild(homeUrlInput);
268 Polymer.dom.flush();
269 });
253 270
254 test('home button urls', function() { 271 test('home button urls', function() {
255 appearancePage.set('prefs', { 272 assertFalse(homeUrlInput.invalid);
256 browser: {show_home_button: {value: true}}, 273 assertEquals(homeUrlInput.value, 'test');
257 homepage: {type: chrome.settingsPrivate.PrefType.URL, value: 'test'}
258 });
259 274
260 Polymer.dom.flush(); 275 homeUrlInput.value = '@@@';
261
262 var input = appearancePage.$$('#customHomePage');
263 assertTrue(!!input);
264 assertFalse(input.invalid);
265 assertEquals(input.value, 'test');
266
267 input.value = '@@@';
268 appearanceBrowserProxy.setValidStartupPageResponse(false); 276 appearanceBrowserProxy.setValidStartupPageResponse(false);
269 input.fire('input'); 277 homeUrlInput.$.input.fire('input');
270 278
271 return appearanceBrowserProxy.whenCalled('validateStartupPage') 279 return appearanceBrowserProxy.whenCalled('validateStartupPage')
272 .then(function() { 280 .then(function(url) {
281 assertEquals(homeUrlInput.value, url);
273 Polymer.dom.flush(); 282 Polymer.dom.flush();
274 assertEquals(input.value, '@@@'); 283 assertEquals(homeUrlInput.value, '@@@'); // Value hasn't changed.
275 assertTrue(input.invalid); 284 assertTrue(homeUrlInput.invalid);
276 285
277 // Should reset to default value on change event. 286 // Should reset to default value on change event.
278 input.$$('paper-input').fire('change'); 287 homeUrlInput.$.input.fire('change');
279 Polymer.dom.flush(); 288 Polymer.dom.flush();
280 assertEquals(input.value, 'test'); 289 assertEquals(homeUrlInput.value, 'test');
281 }); 290 });
282 }); 291 });
283 }); 292 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/settings_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698