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

Unified Diff: chrome/test/data/webui/settings/downloads_page_test.js

Issue 2713343003: MD Settings: Add "Auto Open" setting to Downloads page UI. (Closed)
Patch Set: format Created 3 years, 10 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/downloads_page_test.js
diff --git a/chrome/test/data/webui/settings/downloads_page_test.js b/chrome/test/data/webui/settings/downloads_page_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..c8af19cce18ce68829e9113e63d7357b86b46ced
--- /dev/null
+++ b/chrome/test/data/webui/settings/downloads_page_test.js
@@ -0,0 +1,85 @@
+// Copyright 2017 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.
+
+/**
+ * @constructor
+ * @implements {settings.DownloadsBrowserProxy}
+ * @extends {settings.TestBrowserProxy}
+ */
+var TestDownloadsBrowserProxy = function() {
+ settings.TestBrowserProxy.call(this, [
+ 'initializeDownloads',
+ 'selectDownloadLocation',
+ 'resetAutoOpenFileTypes',
+ ]);
+};
+
+TestDownloadsBrowserProxy.prototype = {
+ __proto__: settings.TestBrowserProxy.prototype,
+
+ /** @override */
+ initializeDownloads: function() {
+ this.methodCalled('initializeDownloads');
+ },
+
+ /** @override */
+ selectDownloadLocation: function() {
+ this.methodCalled('selectDownloadLocation');
+ },
+
+ /** @override */
+ resetAutoOpenFileTypes: function() {
+ this.methodCalled('resetAutoOpenFileTypes');
+ },
+};
+
+var downloadsPage = null;
+
+/** @type {?TestDownloadsBrowserProxy} */
+var DownloadsBrowserProxy = null;
+
+suite('DownloadsHandler', function() {
+ setup(function() {
+ DownloadsBrowserProxy = new TestDownloadsBrowserProxy();
+ settings.DownloadsBrowserProxyImpl.instance_ = DownloadsBrowserProxy;
+
+ PolymerTest.clearBody();
+
+ downloadsPage = document.createElement('settings-downloads-page');
+ document.body.appendChild(downloadsPage);
+
+ // Page element must call 'initializeDownloads' upon attachment to the DOM.
+ return DownloadsBrowserProxy.whenCalled('initializeDownloads');
+ });
+
+ teardown(function() {
+ downloadsPage.remove();
+ });
+
+ test('select downloads location', function() {
+ var button = downloadsPage.$$('#changeDownloadsPath');
+ assertTrue(!!button);
+ MockInteractions.tap(button);
+ return DownloadsBrowserProxy.whenCalled('selectDownloadLocation');
+ });
+
+ test('openAdvancedDownloadsettings', function() {
+ var button = downloadsPage.$$('#resetAutoOpenFileTypes');
+ assertTrue(!button);
+
+ cr.webUIListenerCallback('auto-open-downloads-changed', true);
+ Polymer.dom.flush();
+ var button = downloadsPage.$$('#resetAutoOpenFileTypes');
+ assertTrue(!!button);
+
+ MockInteractions.tap(button);
+ return DownloadsBrowserProxy.whenCalled('resetAutoOpenFileTypes')
+ .then(function() {
+ cr.webUIListenerCallback('auto-open-downloads-changed', false);
+ Polymer.dom.flush();
+ var button = downloadsPage.$$('#resetAutoOpenFileTypes');
+ assertTrue(!button);
+ });
+ });
+});
« 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