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_people_page', function() { | 5 cr.define('settings_people_page', function() { |
6 /** | 6 /** |
7 * @constructor | 7 * @constructor |
8 * @implements {settings.ProfileInfoBrowserProxy} | 8 * @implements {settings.ProfileInfoBrowserProxy} |
9 * @extends {settings.TestBrowserProxy} | 9 * @extends {settings.TestBrowserProxy} |
10 */ | 10 */ |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 MockInteractions.tap(disconnectButton); | 158 MockInteractions.tap(disconnectButton); |
159 Polymer.dom.flush(); | 159 Polymer.dom.flush(); |
160 | 160 |
161 assertTrue(peoplePage.$.disconnectDialog.open); | 161 assertTrue(peoplePage.$.disconnectDialog.open); |
162 assertFalse(peoplePage.$.deleteProfile.hidden); | 162 assertFalse(peoplePage.$.deleteProfile.hidden); |
163 | 163 |
164 var disconnectConfirm = peoplePage.$.disconnectConfirm; | 164 var disconnectConfirm = peoplePage.$.disconnectConfirm; |
165 assertTrue(!!disconnectConfirm); | 165 assertTrue(!!disconnectConfirm); |
166 assertFalse(disconnectConfirm.hidden); | 166 assertFalse(disconnectConfirm.hidden); |
| 167 |
| 168 // Wait for exit of dialog route. |
| 169 var dialogExitPromise = new Promise(function(resolve) { |
| 170 window.addEventListener('popstate', function callback() { |
| 171 window.removeEventListener('popstate', callback); |
| 172 resolve(); |
| 173 }); |
| 174 }); |
| 175 |
167 MockInteractions.tap(disconnectConfirm); | 176 MockInteractions.tap(disconnectConfirm); |
168 | 177 |
| 178 return dialogExitPromise; |
| 179 }).then(function() { |
169 return browserProxy.whenCalled('signOut'); | 180 return browserProxy.whenCalled('signOut'); |
170 }).then(function(deleteProfile) { | 181 }).then(function(deleteProfile) { |
171 Polymer.dom.flush(); | |
172 | |
173 assertFalse(deleteProfile); | 182 assertFalse(deleteProfile); |
174 | 183 |
175 cr.webUIListenerCallback('sync-status-changed', { | 184 cr.webUIListenerCallback('sync-status-changed', { |
176 signedIn: true, | 185 signedIn: true, |
177 domain: 'example.com', | 186 domain: 'example.com', |
178 }); | 187 }); |
179 Polymer.dom.flush(); | 188 Polymer.dom.flush(); |
180 | 189 |
181 assertFalse(peoplePage.$.disconnectDialog.open); | 190 assertFalse(peoplePage.$.disconnectDialog.open); |
182 MockInteractions.tap(disconnectButton); | 191 MockInteractions.tap(disconnectButton); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 return browserProxy.whenCalled('getSyncStatus').then(function() { | 230 return browserProxy.whenCalled('getSyncStatus').then(function() { |
222 cr.webUIListenerCallback('sync-status-changed', { | 231 cr.webUIListenerCallback('sync-status-changed', { |
223 signedIn: true, | 232 signedIn: true, |
224 syncSystemEnabled: true, | 233 syncSystemEnabled: true, |
225 }); | 234 }); |
226 Polymer.dom.flush(); | 235 Polymer.dom.flush(); |
227 | 236 |
228 var customizeSync = peoplePage.$$('#customize-sync'); | 237 var customizeSync = peoplePage.$$('#customize-sync'); |
229 assertTrue(!!customizeSync); | 238 assertTrue(!!customizeSync); |
230 assertTrue(customizeSync.hasAttribute('actionable')); | 239 assertTrue(customizeSync.hasAttribute('actionable')); |
231 }).then(function() { | 240 |
232 cr.webUIListenerCallback('sync-status-changed', { | 241 cr.webUIListenerCallback('sync-status-changed', { |
233 managed: true, | 242 managed: true, |
234 signedIn: true, | 243 signedIn: true, |
235 syncSystemEnabled: true, | 244 syncSystemEnabled: true, |
236 }); | 245 }); |
237 Polymer.dom.flush(); | 246 Polymer.dom.flush(); |
238 | 247 |
239 var customizeSync = peoplePage.$$('#customize-sync'); | 248 var customizeSync = peoplePage.$$('#customize-sync'); |
240 assertTrue(!!customizeSync); | 249 assertTrue(!!customizeSync); |
241 assertFalse(customizeSync.hasAttribute('actionable')); | 250 assertFalse(customizeSync.hasAttribute('actionable')); |
242 }); | 251 }); |
243 }); | 252 }); |
244 }); | 253 }); |
245 } | 254 } |
246 | 255 |
247 return { | 256 return { |
248 registerTests: function() { | 257 registerTests: function() { |
249 registerProfileInfoTests(); | 258 registerProfileInfoTests(); |
250 if (!cr.isChromeOS) | 259 if (!cr.isChromeOS) |
251 registerSyncStatusTests(); | 260 registerSyncStatusTests(); |
252 }, | 261 }, |
253 }; | 262 }; |
254 }); | 263 }); |
OLD | NEW |