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

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

Issue 1849543006: MD Settings: validate startup URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@startup-browser-proxy
Patch Set: compile fix Created 4 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/test/data/webui/settings/cr_settings_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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 cr.define('settings_startup_urls_page', function() {
6 /**
7 * @constructor
8 * @implements {settings.StartupUrlsPageBrowserProxy}
9 * @extends {settings.TestBrowserProxy}
10 */
11 function TestStartupUrlsPageBrowserProxy() {
12 settings.TestBrowserProxy.call(this, [
13 'validateStartupPage',
14 'addStartupPage',
15 ]);
16 }
17
18 TestStartupUrlsPageBrowserProxy.prototype = {
19 __proto__: settings.TestBrowserProxy.prototype,
20
21 urlsAreValid: false,
22
23 /** @override */
24 loadStartupPages: function() {},
25
26 /** @override */
27 validateStartupPage: function(url) {
28 this.methodCalled('validateStartupPage');
29 var resolver = new PromiseResolver;
30 resolver.promise = Promise.resolve(this.urlsAreValid);
31 return resolver;
32 },
33
34 /** @override */
35 addStartupPage: function(url) {
36 this.methodCalled('addStartupPage');
37 },
38 };
39
40 suite('StartupUrlsPage', function() {
41 /** @type {?SettingsStartupUrlsPageElement} */
42 var page = null;
43
44 var browserProxy = null;
45
46 setup(function() {
47 browserProxy = new TestStartupUrlsPageBrowserProxy();
48 settings.StartupUrlsPageBrowserProxyImpl.instance_ = browserProxy;
49 PolymerTest.clearBody();
50 page = document.createElement('settings-startup-urls-page');
51 document.body.appendChild(page);
52 });
53
54 teardown(function() { page.remove(); });
55
56 test('validate', function() {
57 browserProxy.whenCalled('validateStartupPage').then(function() {
58 var addButton = page.$.add;
59 assertTrue(!!addButton);
60 assertFalse(browserProxy.urlsAreValid);
61 assertTrue(addButton.disabled);
62
63 browserProxy.resetResolver('validateStartupPage');
64 browserProxy.whenCalled('validateStartupPage').then(function() {
65 page.async(function() {
66 assertFalse(addButton.disabled);
67 MockInteractions.tap(addButton);
68 });
69 });
70
71 browserProxy.urlsAreValid = true;
72 page.$.newUrl.value = "overriding validation anyway";
73 });
74
75 return browserProxy.whenCalled('addStartupPage');
76 });
77 });
78 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698