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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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 /**
6 * @constructor
7 * @implements {settings.DownloadsBrowserProxy}
8 * @extends {settings.TestBrowserProxy}
9 */
10 var TestDownloadsBrowserProxy = function() {
11 settings.TestBrowserProxy.call(this, [
12 'initializeDownloads',
13 'selectDownloadLocation',
14 'resetAutoOpenFileTypes',
15 ]);
16 };
17
18 TestDownloadsBrowserProxy.prototype = {
19 __proto__: settings.TestBrowserProxy.prototype,
20
21 /** @override */
22 initializeDownloads: function() {
23 this.methodCalled('initializeDownloads');
24 },
25
26 /** @override */
27 selectDownloadLocation: function() {
28 this.methodCalled('selectDownloadLocation');
29 },
30
31 /** @override */
32 resetAutoOpenFileTypes: function() {
33 this.methodCalled('resetAutoOpenFileTypes');
34 },
35 };
36
37 var DownloadsPage = null;
Dan Beam 2017/02/28 02:36:42 jsVarsLikeThis (start with lower)
tommycli 2017/02/28 17:06:39 Done.
38
39 /** @type {?TestDownloadsBrowserProxy} */
40 var DownloadsBrowserProxy = null;
41
42 suite('DownloadsHandler', function() {
43 setup(function() {
44 DownloadsBrowserProxy = new TestDownloadsBrowserProxy();
45 settings.DownloadsBrowserProxyImpl.instance_ = DownloadsBrowserProxy;
46
47 PolymerTest.clearBody();
48
49 DownloadsPage = document.createElement('settings-downloads-page');
50 document.body.appendChild(DownloadsPage);
51
52 // Page element must call 'initializeDownloads' upon attachment to the DOM.
53 return DownloadsBrowserProxy.whenCalled('initializeDownloads');
54 });
55
56 teardown(function() {
57 DownloadsPage.remove();
58 });
59
60 test('select downloads location', function() {
61 var button = DownloadsPage.$$('#changeDownloadsPath');
62 assert(!!button);
Dan Beam 2017/02/28 02:36:42 nit: assert -> assertTrue
tommycli 2017/02/28 17:06:39 Done.
63 MockInteractions.tap(button);
64 return DownloadsBrowserProxy.whenCalled('selectDownloadLocation');
65 });
66
67 test('openAdvancedDownloadsettings', function() {
68 var button = DownloadsPage.$$('#resetAutoOpenFileTypes');
69 assert(!button);
70
71 cr.webUIListenerCallback('auto-open-downloads-changed', true);
72 Polymer.dom.flush();
73 var button = DownloadsPage.$$('#resetAutoOpenFileTypes');
74 assert(!!button);
75
76 MockInteractions.tap(button);
77 return DownloadsBrowserProxy.whenCalled('resetAutoOpenFileTypes')
78 .then(function() {
79 cr.webUIListenerCallback('auto-open-downloads-changed', false);
80 Polymer.dom.flush();
81 var button = DownloadsPage.$$('#resetAutoOpenFileTypes');
82 assert(!button);
83 });
84 });
85 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698