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

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

Issue 2133893002: [MD settings] disable clear browsing data while it is running (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 5 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/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc ('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 */
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 __proto__: settings.TestBrowserProxy.prototype, 45 __proto__: settings.TestBrowserProxy.prototype,
46 46
47 /** @param {!Promise} promise */ 47 /** @param {!Promise} promise */
48 setClearBrowsingDataPromise: function(promise) { 48 setClearBrowsingDataPromise: function(promise) {
49 this.clearBrowsingDataPromise_ = promise; 49 this.clearBrowsingDataPromise_ = promise;
50 }, 50 },
51 51
52 /** @override */ 52 /** @override */
53 clearBrowsingData: function() { 53 clearBrowsingData: function() {
54 this.methodCalled('clearBrowsingData'); 54 this.methodCalled('clearBrowsingData');
55 cr.webUIListenerCallback('browsing-data-removing', true);
55 return this.clearBrowsingDataPromise_ !== null ? 56 return this.clearBrowsingDataPromise_ !== null ?
56 this.clearBrowsingDataPromise_ : Promise.resolve(); 57 this.clearBrowsingDataPromise_ : Promise.resolve();
57 }, 58 },
58 59
59 /** @override */ 60 /** @override */
60 initialize: function() { 61 initialize: function() {
61 this.methodCalled('initialize'); 62 this.methodCalled('initialize');
63 return Promise.resolve(false);
62 }, 64 },
63 }; 65 };
64 66
65 function registerNativeCertificateManagerTests() { 67 function registerNativeCertificateManagerTests() {
66 suite('NativeCertificateManager', function() { 68 suite('NativeCertificateManager', function() {
67 /** @type {settings.TestPrivacyPageBrowserProxy} */ 69 /** @type {settings.TestPrivacyPageBrowserProxy} */
68 var testBrowserProxy; 70 var testBrowserProxy;
69 71
70 /** @type {SettingsPrivacyPageElement} */ 72 /** @type {SettingsPrivacyPageElement} */
71 var page; 73 var page;
(...skipping 26 matching lines...) Expand all
98 100
99 /** @type {SettingsClearBrowsingDataDialogElement} */ 101 /** @type {SettingsClearBrowsingDataDialogElement} */
100 var element; 102 var element;
101 103
102 setup(function() { 104 setup(function() {
103 testBrowserProxy = new TestClearBrowsingDataBrowserProxy(); 105 testBrowserProxy = new TestClearBrowsingDataBrowserProxy();
104 settings.ClearBrowsingDataBrowserProxyImpl.instance_ = testBrowserProxy; 106 settings.ClearBrowsingDataBrowserProxyImpl.instance_ = testBrowserProxy;
105 PolymerTest.clearBody(); 107 PolymerTest.clearBody();
106 element = document.createElement('settings-clear-browsing-data-dialog'); 108 element = document.createElement('settings-clear-browsing-data-dialog');
107 document.body.appendChild(element); 109 document.body.appendChild(element);
110 return testBrowserProxy.whenCalled('initialize');
108 }); 111 });
109 112
110 teardown(function() { element.remove(); }); 113 teardown(function() { element.remove(); });
111 114
112 test('ClearBrowsingDataTap', function() { 115 test('ClearBrowsingDataTap', function() {
113 assertTrue(element.$.dialog.opened); 116 assertTrue(element.$.dialog.opened);
114 117
115 var cancelButton = element.$$('.cancel-button'); 118 var cancelButton = element.$$('.cancel-button');
116 assertTrue(!!cancelButton); 119 assertTrue(!!cancelButton);
117 var actionButton = element.$$('.action-button'); 120 var actionButton = element.$$('.action-button');
(...skipping 11 matching lines...) Expand all
129 132
130 return testBrowserProxy.whenCalled('clearBrowsingData').then( 133 return testBrowserProxy.whenCalled('clearBrowsingData').then(
131 function() { 134 function() {
132 assertTrue(element.$.dialog.opened); 135 assertTrue(element.$.dialog.opened);
133 assertTrue(cancelButton.disabled); 136 assertTrue(cancelButton.disabled);
134 assertTrue(actionButton.disabled); 137 assertTrue(actionButton.disabled);
135 assertTrue(spinner.active); 138 assertTrue(spinner.active);
136 139
137 // Simulate signal from browser indicating that clearing has 140 // Simulate signal from browser indicating that clearing has
138 // completed. 141 // completed.
142 cr.webUIListenerCallback('browsing-data-removing', false);
139 promiseResolver.resolve(); 143 promiseResolver.resolve();
140 // Yields to the message loop to allow the callback chain of the 144 // Yields to the message loop to allow the callback chain of the
141 // Promise that was just resolved to execute before the 145 // Promise that was just resolved to execute before the
142 // assertions. 146 // assertions.
143 }).then(function() { 147 }).then(function() {
144 assertFalse(element.$.dialog.opened); 148 assertFalse(element.$.dialog.opened);
145 assertFalse(cancelButton.disabled); 149 assertFalse(cancelButton.disabled);
146 assertFalse(actionButton.disabled); 150 assertFalse(actionButton.disabled);
147 assertFalse(spinner.active); 151 assertFalse(spinner.active);
148 assertFalse(!!element.$$('#notice')); 152 assertFalse(!!element.$$('#notice'));
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 231
228 return { 232 return {
229 registerTests: function() { 233 registerTests: function() {
230 if (cr.isMac || cr.isWin) 234 if (cr.isMac || cr.isWin)
231 registerNativeCertificateManagerTests(); 235 registerNativeCertificateManagerTests();
232 236
233 registerClearBrowsingDataTests(); 237 registerClearBrowsingDataTests();
234 }, 238 },
235 }; 239 };
236 }); 240 });
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698