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 {TestBrowserProxy} | 9 * @extends {TestBrowserProxy} |
10 */ | 10 */ |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // Close the disconnect dialog. | 274 // Close the disconnect dialog. |
275 MockInteractions.tap(peoplePage.$$('#disconnectConfirm')); | 275 MockInteractions.tap(peoplePage.$$('#disconnectConfirm')); |
276 return new Promise(function(resolve) { | 276 return new Promise(function(resolve) { |
277 listenOnce(window, 'popstate', resolve); | 277 listenOnce(window, 'popstate', resolve); |
278 }); | 278 }); |
279 }); | 279 }); |
280 }); | 280 }); |
281 | 281 |
282 test('NavigateDirectlyToSignOutURL', function() { | 282 test('NavigateDirectlyToSignOutURL', function() { |
283 // Navigate to chrome://md-settings/signOut | 283 // Navigate to chrome://md-settings/signOut |
284 settings.navigateTo(settings.Route.SIGN_OUT); | 284 settings.navigateTo(settings.routes.SIGN_OUT); |
285 | 285 |
286 return new Promise( | 286 return new Promise( |
287 function(resolve) { peoplePage.async(resolve); }).then(function() { | 287 function(resolve) { peoplePage.async(resolve); }).then(function() { |
288 assertTrue(peoplePage.$$('#disconnectDialog').open); | 288 assertTrue(peoplePage.$$('#disconnectDialog').open); |
289 return profileInfoBrowserProxy.whenCalled('getProfileStatsCount'); | 289 return profileInfoBrowserProxy.whenCalled('getProfileStatsCount'); |
290 }).then(function() { | 290 }).then(function() { |
291 // 'getProfileStatsCount' can be the first message sent to the handler | 291 // 'getProfileStatsCount' can be the first message sent to the handler |
292 // if the user navigates directly to chrome://md-settings/signOut. if | 292 // if the user navigates directly to chrome://md-settings/signOut. if |
293 // so, it should not cause a crash. | 293 // so, it should not cause a crash. |
294 new settings.ProfileInfoBrowserProxyImpl().getProfileStatsCount(); | 294 new settings.ProfileInfoBrowserProxyImpl().getProfileStatsCount(); |
295 | 295 |
296 // Close the disconnect dialog. | 296 // Close the disconnect dialog. |
297 MockInteractions.tap(peoplePage.$$('#disconnectConfirm')); | 297 MockInteractions.tap(peoplePage.$$('#disconnectConfirm')); |
298 }).then(function() { | 298 }).then(function() { |
299 return new Promise(function(resolve) { | 299 return new Promise(function(resolve) { |
300 listenOnce(window, 'popstate', resolve); | 300 listenOnce(window, 'popstate', resolve); |
301 }); | 301 }); |
302 }); | 302 }); |
303 }); | 303 }); |
304 | 304 |
305 test('Signout dialog suppressed when not signed in', function() { | 305 test('Signout dialog suppressed when not signed in', function() { |
306 return browserProxy.whenCalled('getSyncStatus').then(function() { | 306 return browserProxy.whenCalled('getSyncStatus').then(function() { |
307 settings.navigateTo(settings.Route.SIGN_OUT); | 307 settings.navigateTo(settings.routes.SIGN_OUT); |
308 return new Promise(function(resolve) { peoplePage.async(resolve); }); | 308 return new Promise(function(resolve) { peoplePage.async(resolve); }); |
309 }).then(function() { | 309 }).then(function() { |
310 assertTrue(peoplePage.$$('#disconnectDialog').open); | 310 assertTrue(peoplePage.$$('#disconnectDialog').open); |
311 | 311 |
312 var popstatePromise = new Promise(function(resolve) { | 312 var popstatePromise = new Promise(function(resolve) { |
313 listenOnce(window, 'popstate', resolve); | 313 listenOnce(window, 'popstate', resolve); |
314 }); | 314 }); |
315 | 315 |
316 cr.webUIListenerCallback('sync-status-changed', { | 316 cr.webUIListenerCallback('sync-status-changed', { |
317 signedIn: false, | 317 signedIn: false, |
318 }); | 318 }); |
319 | 319 |
320 return popstatePromise; | 320 return popstatePromise; |
321 }).then(function() { | 321 }).then(function() { |
322 var popstatePromise = new Promise(function(resolve) { | 322 var popstatePromise = new Promise(function(resolve) { |
323 listenOnce(window, 'popstate', resolve); | 323 listenOnce(window, 'popstate', resolve); |
324 }); | 324 }); |
325 | 325 |
326 settings.navigateTo(settings.Route.SIGN_OUT); | 326 settings.navigateTo(settings.routes.SIGN_OUT); |
327 | 327 |
328 return popstatePromise; | 328 return popstatePromise; |
329 }); | 329 }); |
330 }); | 330 }); |
331 | 331 |
332 test('syncStatusNotActionableForManagedAccounts', function() { | 332 test('syncStatusNotActionableForManagedAccounts', function() { |
333 assertFalse(!!peoplePage.$$('#sync-status')); | 333 assertFalse(!!peoplePage.$$('#sync-status')); |
334 | 334 |
335 return browserProxy.whenCalled('getSyncStatus').then(function() { | 335 return browserProxy.whenCalled('getSyncStatus').then(function() { |
336 cr.webUIListenerCallback('sync-status-changed', { | 336 cr.webUIListenerCallback('sync-status-changed', { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 } | 389 } |
390 | 390 |
391 return { | 391 return { |
392 registerTests: function() { | 392 registerTests: function() { |
393 registerProfileInfoTests(); | 393 registerProfileInfoTests(); |
394 if (!cr.isChromeOS) | 394 if (!cr.isChromeOS) |
395 registerSyncStatusTests(); | 395 registerSyncStatusTests(); |
396 }, | 396 }, |
397 }; | 397 }; |
398 }); | 398 }); |
OLD | NEW |