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

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: fix string 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
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..fa4608dc5389e284948161b53cbfe87262e34338
--- /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;
Dan Beam 2017/02/28 02:36:42 jsVarsLikeThis (start with lower)
tommycli 2017/02/28 17:06:39 Done.
+
+/** @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');
+ assert(!!button);
Dan Beam 2017/02/28 02:36:42 nit: assert -> assertTrue
tommycli 2017/02/28 17:06:39 Done.
+ MockInteractions.tap(button);
+ return DownloadsBrowserProxy.whenCalled('selectDownloadLocation');
+ });
+
+ test('openAdvancedDownloadsettings', function() {
+ var button = DownloadsPage.$$('#resetAutoOpenFileTypes');
+ assert(!button);
+
+ cr.webUIListenerCallback('auto-open-downloads-changed', true);
+ Polymer.dom.flush();
+ var button = DownloadsPage.$$('#resetAutoOpenFileTypes');
+ assert(!!button);
+
+ MockInteractions.tap(button);
+ return DownloadsBrowserProxy.whenCalled('resetAutoOpenFileTypes')
+ .then(function() {
+ cr.webUIListenerCallback('auto-open-downloads-changed', false);
+ Polymer.dom.flush();
+ var button = DownloadsPage.$$('#resetAutoOpenFileTypes');
+ assert(!button);
+ });
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698