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

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

Issue 1899853004: MD Settings: Clear Browsing Data dialog, dismiss when clearing is done. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('settings_privacy_page', function() { 5 cr.define('settings_privacy_page', function() {
6 /** 6 /**
7 * @constructor 7 * @constructor
8 * @extends {TestBrowserProxy} 8 * @extends {TestBrowserProxy}
9 * @implements {settings.PrivacyPageBrowserProxy} 9 * @implements {settings.PrivacyPageBrowserProxy}
10 */ 10 */
11 function TestPrivacyPageBrowserProxy() { 11 function TestPrivacyPageBrowserProxy() {
12 settings.TestBrowserProxy.call(this, ['showManageSSLCertificates']); 12 settings.TestBrowserProxy.call(this, ['showManageSSLCertificates']);
13 } 13 }
14 14
15 TestPrivacyPageBrowserProxy.prototype = { 15 TestPrivacyPageBrowserProxy.prototype = {
16 __proto__: settings.TestBrowserProxy.prototype, 16 __proto__: settings.TestBrowserProxy.prototype,
17 17
18 /** @override */ 18 /** @override */
19 showManageSSLCertificates: function() { 19 showManageSSLCertificates: function() {
20 this.methodCalled('showManageSSLCertificates'); 20 this.methodCalled('showManageSSLCertificates');
21 }, 21 },
22 }; 22 };
23 23
24 suite('PrivacyPage', function() { 24 /**
25 /** @type {settings.TestPrivacyPageBrowserProxy} */ 25 * @constructor
26 var testBrowserProxy; 26 * @extends {TestBrowserProxy}
27 * @implements {settings.ClearBrowsingDataBrowserProxy}
28 */
29 function TestClearBrowsingDataBrowserProxy() {
30 settings.TestBrowserProxy.call(this, ['clearBrowsingData']);
31 }
27 32
28 /** @type {SettingsPrivacyPageElement} */ 33 TestClearBrowsingDataBrowserProxy.prototype = {
29 var page; 34 __proto__: settings.TestBrowserProxy.prototype,
30 35
31 setup(function() { 36 /** @override */
32 testBrowserProxy = new TestPrivacyPageBrowserProxy(); 37 clearBrowsingData: function() {
33 settings.PrivacyPageBrowserProxyImpl.instance_ = testBrowserProxy; 38 this.methodCalled('clearBrowsingData');
34 PolymerTest.clearBody(); 39 return Promise.resolve();
35 page = document.createElement('settings-privacy-page'); 40 },
36 document.body.appendChild(page); 41 };
42
43 function registerNativeCertificateManagerTests() {
44 suite('NativeCertificateManager', function() {
45 /** @type {settings.TestPrivacyPageBrowserProxy} */
46 var testBrowserProxy;
47
48 /** @type {SettingsPrivacyPageElement} */
49 var page;
50
51 setup(function() {
52 testBrowserProxy = new TestPrivacyPageBrowserProxy();
53 settings.PrivacyPageBrowserProxyImpl.instance_ = testBrowserProxy;
54 PolymerTest.clearBody();
55 page = document.createElement('settings-privacy-page');
56 document.body.appendChild(page);
57 });
58
59 teardown(function() { page.remove(); });
60
61 test('NativeCertificateManager', function() {
62 MockInteractions.tap(page.$.manageCertificates);
63 return testBrowserProxy.whenCalled('showManageSSLCertificates');
64 });
37 }); 65 });
66 }
38 67
39 teardown(function() { page.remove(); }); 68 function registerClearBrowsingDataTests() {
69 suite('ClearBrowsingData', function() {
70 /** @type {settings.TestClearBrowsingDataBrowserProxy} */
71 var testBrowserProxy;
40 72
41 test('NativeCertificateManager', function() { 73 /** @type {SettingsClearBrowsingDataDialogElement} */
42 MockInteractions.tap(page.$.manageCertificates); 74 var element;
43 return testBrowserProxy.whenCalled('showManageSSLCertificates'); 75
76 setup(function() {
77 testBrowserProxy = new TestClearBrowsingDataBrowserProxy();
78 settings.ClearBrowsingDataBrowserProxyImpl.instance_ = testBrowserProxy;
79 PolymerTest.clearBody();
80 element = document.createElement('settings-clear-browsing-data-dialog');
81 document.body.appendChild(element);
82 });
83
84 teardown(function() { element.remove(); });
85
86 test('ClearBrowsingDataTap', function() {
87 element.open();
88 assertTrue(element.$.dialog.opened);
89 var clearBrowsingDataButton = element.$.clearBrowsingData;
90 assertTrue(!!clearBrowsingDataButton);
91
92 MockInteractions.tap(clearBrowsingDataButton);
93 return testBrowserProxy.whenCalled('clearBrowsingData').then(
94 function() {
95 assertFalse(element.$.dialog.opened);
96 });
97 });
44 }); 98 });
45 }); 99 }
100
101 return {
102 registerTests: function() {
103 if (cr.isMac || cr.isWin)
104 registerNativeCertificateManagerTests();
105
106 registerClearBrowsingDataTests();
107 },
108 };
46 }); 109 });
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