| 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') |
| 307 settings.navigateTo(settings.Route.SIGN_OUT); | 307 .then(function() { |
| 308 return new Promise(function(resolve) { peoplePage.async(resolve); }); | 308 settings.navigateTo(settings.routes.SIGN_OUT); |
| 309 }).then(function() { | 309 return new Promise(function(resolve) { |
| 310 assertTrue(peoplePage.$$('#disconnectDialog').open); | 310 peoplePage.async(resolve); |
| 311 }); |
| 312 }) |
| 313 .then(function() { |
| 314 assertTrue(peoplePage.$$('#disconnectDialog').open); |
| 311 | 315 |
| 312 var popstatePromise = new Promise(function(resolve) { | 316 var popstatePromise = new Promise(function(resolve) { |
| 313 listenOnce(window, 'popstate', resolve); | 317 listenOnce(window, 'popstate', resolve); |
| 314 }); | 318 }); |
| 315 | 319 |
| 316 cr.webUIListenerCallback('sync-status-changed', { | 320 cr.webUIListenerCallback('sync-status-changed', { |
| 317 signedIn: false, | 321 signedIn: false, |
| 318 }); | 322 }); |
| 319 | 323 |
| 320 return popstatePromise; | 324 return popstatePromise; |
| 321 }).then(function() { | 325 }) |
| 322 var popstatePromise = new Promise(function(resolve) { | 326 .then(function() { |
| 323 listenOnce(window, 'popstate', resolve); | 327 var popstatePromise = new Promise(function(resolve) { |
| 324 }); | 328 listenOnce(window, 'popstate', resolve); |
| 329 }); |
| 325 | 330 |
| 326 settings.navigateTo(settings.Route.SIGN_OUT); | 331 settings.navigateTo(settings.routes.SIGN_OUT); |
| 327 | 332 |
| 328 return popstatePromise; | 333 return popstatePromise; |
| 329 }); | 334 }); |
| 330 }); | 335 }); |
| 331 | 336 |
| 332 test('syncStatusNotActionableForManagedAccounts', function() { | 337 test('syncStatusNotActionableForManagedAccounts', function() { |
| 333 assertFalse(!!peoplePage.$$('#sync-status')); | 338 assertFalse(!!peoplePage.$$('#sync-status')); |
| 334 | 339 |
| 335 return browserProxy.whenCalled('getSyncStatus').then(function() { | 340 return browserProxy.whenCalled('getSyncStatus').then(function() { |
| 336 cr.webUIListenerCallback('sync-status-changed', { | 341 cr.webUIListenerCallback('sync-status-changed', { |
| 337 signedIn: true, | 342 signedIn: true, |
| 338 syncSystemEnabled: true, | 343 syncSystemEnabled: true, |
| 339 }); | 344 }); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 } | 394 } |
| 390 | 395 |
| 391 return { | 396 return { |
| 392 registerTests: function() { | 397 registerTests: function() { |
| 393 registerProfileInfoTests(); | 398 registerProfileInfoTests(); |
| 394 if (!cr.isChromeOS) | 399 if (!cr.isChromeOS) |
| 395 registerSyncStatusTests(); | 400 registerSyncStatusTests(); |
| 396 }, | 401 }, |
| 397 }; | 402 }; |
| 398 }); | 403 }); |
| OLD | NEW |