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

Unified 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, 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/startup_urls_page_test.js
diff --git a/chrome/test/data/webui/settings/startup_urls_page_test.js b/chrome/test/data/webui/settings/startup_urls_page_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..1c4490aa0365a441bd5c69b0c48adbfddf5c8dd5
--- /dev/null
+++ b/chrome/test/data/webui/settings/startup_urls_page_test.js
@@ -0,0 +1,78 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('settings_startup_urls_page', function() {
+ /**
+ * @constructor
+ * @implements {settings.StartupUrlsPageBrowserProxy}
+ * @extends {settings.TestBrowserProxy}
+ */
+ function TestStartupUrlsPageBrowserProxy() {
+ settings.TestBrowserProxy.call(this, [
+ 'validateStartupPage',
+ 'addStartupPage',
+ ]);
+ }
+
+ TestStartupUrlsPageBrowserProxy.prototype = {
+ __proto__: settings.TestBrowserProxy.prototype,
+
+ urlsAreValid: false,
+
+ /** @override */
+ loadStartupPages: function() {},
+
+ /** @override */
+ validateStartupPage: function(url) {
+ this.methodCalled('validateStartupPage');
+ var resolver = new PromiseResolver;
+ resolver.promise = Promise.resolve(this.urlsAreValid);
+ return resolver;
+ },
+
+ /** @override */
+ addStartupPage: function(url) {
+ this.methodCalled('addStartupPage');
+ },
+ };
+
+ suite('StartupUrlsPage', function() {
+ /** @type {?SettingsStartupUrlsPageElement} */
+ var page = null;
+
+ var browserProxy = null;
+
+ setup(function() {
+ browserProxy = new TestStartupUrlsPageBrowserProxy();
+ settings.StartupUrlsPageBrowserProxyImpl.instance_ = browserProxy;
+ PolymerTest.clearBody();
+ page = document.createElement('settings-startup-urls-page');
+ document.body.appendChild(page);
+ });
+
+ teardown(function() { page.remove(); });
+
+ test('validate', function() {
+ browserProxy.whenCalled('validateStartupPage').then(function() {
+ var addButton = page.$.add;
+ assertTrue(!!addButton);
+ assertFalse(browserProxy.urlsAreValid);
+ assertTrue(addButton.disabled);
+
+ browserProxy.resetResolver('validateStartupPage');
+ browserProxy.whenCalled('validateStartupPage').then(function() {
+ page.async(function() {
+ assertFalse(addButton.disabled);
+ MockInteractions.tap(addButton);
+ });
+ });
+
+ browserProxy.urlsAreValid = true;
+ page.$.newUrl.value = "overriding validation anyway";
+ });
+
+ return browserProxy.whenCalled('addStartupPage');
+ });
+ });
+});
« 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