OLD | NEW |
---|---|
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 Loading... | |
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('showOtherFormsOfBrowsingHistoryNotice', 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 // The callback should have triggered the condition to create | |
168 // the notice, but we must spin the message loop again until | |
169 // the dom-if template is notified and actually creates it. | |
dschuyler
2016/06/25 01:34:54
Can a Polymer.dom.flush() be used rather than
spin
msramek
2016/06/27 15:24:59
Yes! Thanks :)
| |
170 }).then(function() { | |
171 var notice = element.$$('#notice'); | |
172 assertTrue(!!notice); | |
173 var noticeActionButton = notice.$$('.action-button'); | |
174 assertTrue(!!noticeActionButton); | |
175 | |
176 assertTrue(element.$.dialog.opened); | |
177 assertTrue(notice.$.dialog.opened); | |
178 | |
179 MockInteractions.tap(noticeActionButton); | |
180 }).then(function() { | |
181 var notice = element.$$('#notice'); | |
182 assertFalse(!!notice); | |
183 assertFalse(element.$.dialog.opened); | |
184 }); | |
185 }); | |
186 | |
147 test('Counters', function() { | 187 test('Counters', function() { |
148 assertTrue(element.$.dialog.opened); | 188 assertTrue(element.$.dialog.opened); |
149 | 189 |
150 // Initialize the browsing history pref, which should belong to the | 190 // Initialize the browsing history pref, which should belong to the |
151 // first checkbox in the dialog. | 191 // first checkbox in the dialog. |
152 element.set('prefs', { | 192 element.set('prefs', { |
153 browser: { | 193 browser: { |
154 clear_data: { | 194 clear_data: { |
155 browsing_history: { | 195 browsing_history: { |
156 key: 'browser.clear_data.browsing_history', | 196 key: 'browser.clear_data.browsing_history', |
(...skipping 23 matching lines...) Expand all Loading... | |
180 | 220 |
181 return { | 221 return { |
182 registerTests: function() { | 222 registerTests: function() { |
183 if (cr.isMac || cr.isWin) | 223 if (cr.isMac || cr.isWin) |
184 registerNativeCertificateManagerTests(); | 224 registerNativeCertificateManagerTests(); |
185 | 225 |
186 registerClearBrowsingDataTests(); | 226 registerClearBrowsingDataTests(); |
187 }, | 227 }, |
188 }; | 228 }; |
189 }); | 229 }); |
OLD | NEW |