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

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: move home url buttons test to its own suite 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
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 232 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
262 appearanceBrowserProxy.reset();
dpapad 2017/03/31 20:38:52 Nit: There is no need to reset() the proxy if you
scottchen 2017/03/31 21:02:46 Done.
263 PolymerTest.clearBody();
264
265 homeUrlInput = document.createElement('home-url-input');
266 homeUrlInput.set(
267 'pref', {type: chrome.settingsPrivate.PrefType.URL, value: 'test'});
268
269 document.body.appendChild(homeUrlInput);
270 Polymer.dom.flush();
271 });
253 272
254 test('home button urls', function() { 273 test('home button urls', function() {
255 appearancePage.set('prefs', { 274 assertFalse(homeUrlInput.invalid);
256 browser: {show_home_button: {value: true}}, 275 assertEquals(homeUrlInput.value, 'test');
257 homepage: {type: chrome.settingsPrivate.PrefType.URL, value: 'test'}
258 });
259 276
260 Polymer.dom.flush(); 277 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); 278 appearanceBrowserProxy.setValidStartupPageResponse(false);
269 input.fire('input'); 279 homeUrlInput.$.input.fire('input');
270 280
271 return appearanceBrowserProxy.whenCalled('validateStartupPage') 281 return appearanceBrowserProxy.whenCalled('validateStartupPage')
272 .then(function() { 282 .then(function() {
dpapad 2017/03/31 20:38:52 Can you add an assertion that checks that the stri
scottchen 2017/03/31 21:02:46 The Promise only resolves with a boolean value, it
dpapad 2017/03/31 21:05:08 Need to change this line, https://cs.chromium.org/
scottchen 2017/03/31 21:20:43 Done.
273 Polymer.dom.flush(); 283 Polymer.dom.flush();
274 assertEquals(input.value, '@@@'); 284 assertEquals(homeUrlInput.value, '@@@');
275 assertTrue(input.invalid); 285 assertTrue(homeUrlInput.invalid);
276 286
277 // Should reset to default value on change event. 287 // Should reset to default value on change event.
278 input.$$('paper-input').fire('change'); 288 homeUrlInput.$.input.fire('change');
279 Polymer.dom.flush(); 289 Polymer.dom.flush();
280 assertEquals(input.value, 'test'); 290 assertEquals(homeUrlInput.value, 'test');
281 }); 291 });
282 }); 292 });
283 }); 293 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698