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

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

Issue 2098633002: Migrate the one-time notice into the MD settings CBD dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_counters
Patch Set: Initialize to false. 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // completed. 134 // completed.
135 promiseResolver.resolve(); 135 promiseResolver.resolve();
136 // Yields to the message loop to allow the callback chain of the 136 // Yields to the message loop to allow the callback chain of the
137 // Promise that was just resolved to execute before the 137 // Promise that was just resolved to execute before the
138 // assertions. 138 // assertions.
139 }).then(function() { 139 }).then(function() {
140 assertFalse(element.$.dialog.opened); 140 assertFalse(element.$.dialog.opened);
141 assertFalse(cancelButton.disabled); 141 assertFalse(cancelButton.disabled);
142 assertFalse(actionButton.disabled); 142 assertFalse(actionButton.disabled);
143 assertFalse(spinner.active); 143 assertFalse(spinner.active);
144 assertFalse(!!element.$$('#notice'));
144 }); 145 });
145 }); 146 });
146 147
148 test('showHistoryDeletionDialog', function() {
149 assertTrue(element.$.dialog.opened);
150 var actionButton = element.$$('.action-button');
151 assertTrue(!!actionButton);
152
153 var promiseResolver = new PromiseResolver();
154 testBrowserProxy.setClearBrowsingDataPromise(promiseResolver.promise);
155 MockInteractions.tap(actionButton);
156
157 return testBrowserProxy.whenCalled('clearBrowsingData').then(
158 function() {
159 // Passing showNotice = true should trigger the notice about other
160 // forms of browsing history to open, and the dialog to stay open.
161 promiseResolver.resolve(true /* showNotice */);
162
163 // Yields to the message loop to allow the callback chain of the
164 // Promise that was just resolved to execute before the
165 // assertions.
166 }).then(function() {
167 Polymer.dom.flush();
168 var notice = element.$$('#notice');
169 assertTrue(!!notice);
170 var noticeActionButton = notice.$$('.action-button');
171 assertTrue(!!noticeActionButton);
172
173 assertTrue(element.$.dialog.opened);
174 assertTrue(notice.$.dialog.opened);
175
176 MockInteractions.tap(noticeActionButton);
177
178 // Tapping the action button will close the notice. Move to the
179 // end of the message loop to allow the closing event to propagate
180 // to the parent dialog. The parent dialog should subsequently
181 // close as well.
182 setTimeout(function() {
183 var notice = element.$$('#notice');
184 assertFalse(!!notice);
185 assertFalse(element.$.dialog.opened);
186 }, 0);
187 });
188 });
189
147 test('Counters', function() { 190 test('Counters', function() {
148 assertTrue(element.$.dialog.opened); 191 assertTrue(element.$.dialog.opened);
149 192
150 // Initialize the browsing history pref, which should belong to the 193 // Initialize the browsing history pref, which should belong to the
151 // first checkbox in the dialog. 194 // first checkbox in the dialog.
152 element.set('prefs', { 195 element.set('prefs', {
153 browser: { 196 browser: {
154 clear_data: { 197 clear_data: {
155 browsing_history: { 198 browsing_history: {
156 key: 'browser.clear_data.browsing_history', 199 key: 'browser.clear_data.browsing_history',
(...skipping 23 matching lines...) Expand all
180 223
181 return { 224 return {
182 registerTests: function() { 225 registerTests: function() {
183 if (cr.isMac || cr.isWin) 226 if (cr.isMac || cr.isWin)
184 registerNativeCertificateManagerTests(); 227 registerNativeCertificateManagerTests();
185 228
186 registerClearBrowsingDataTests(); 229 registerClearBrowsingDataTests();
187 }, 230 },
188 }; 231 };
189 }); 232 });
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