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('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 Loading... |
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 }); |
OLD | NEW |