OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/webui/options/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/options/sync_setup_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 ON_CALL(*mock_pss_, GetRegisteredDataTypes()) | 292 ON_CALL(*mock_pss_, GetRegisteredDataTypes()) |
293 .WillByDefault(Return(syncer::ModelTypeSet())); | 293 .WillByDefault(Return(syncer::ModelTypeSet())); |
294 | 294 |
295 mock_pss_->Initialize(); | 295 mock_pss_->Initialize(); |
296 | 296 |
297 handler_.reset(new TestingSyncSetupHandler(&web_ui_, profile_.get())); | 297 handler_.reset(new TestingSyncSetupHandler(&web_ui_, profile_.get())); |
298 } | 298 } |
299 | 299 |
300 // Setup the expectations for calls made when displaying the config page. | 300 // Setup the expectations for calls made when displaying the config page. |
301 void SetDefaultExpectationsForConfigPage() { | 301 void SetDefaultExpectationsForConfigPage() { |
302 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()). | 302 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); |
303 WillRepeatedly(Return(true)); | |
304 EXPECT_CALL(*mock_pss_, GetRegisteredDataTypes()). | 303 EXPECT_CALL(*mock_pss_, GetRegisteredDataTypes()). |
305 WillRepeatedly(Return(GetAllTypes())); | 304 WillRepeatedly(Return(GetAllTypes())); |
306 EXPECT_CALL(*mock_pss_, GetPreferredDataTypes()). | 305 EXPECT_CALL(*mock_pss_, GetPreferredDataTypes()). |
307 WillRepeatedly(Return(GetAllTypes())); | 306 WillRepeatedly(Return(GetAllTypes())); |
308 EXPECT_CALL(*mock_pss_, GetActiveDataTypes()). | 307 EXPECT_CALL(*mock_pss_, GetActiveDataTypes()). |
309 WillRepeatedly(Return(GetAllTypes())); | 308 WillRepeatedly(Return(GetAllTypes())); |
310 EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed()). | 309 EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed()). |
311 WillRepeatedly(Return(true)); | 310 WillRepeatedly(Return(true)); |
312 EXPECT_CALL(*mock_pss_, EncryptEverythingEnabled()). | 311 EXPECT_CALL(*mock_pss_, EncryptEverythingEnabled()). |
313 WillRepeatedly(Return(false)); | 312 WillRepeatedly(Return(false)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 376 |
378 class SyncSetupHandlerFirstSigninTest : public SyncSetupHandlerTest { | 377 class SyncSetupHandlerFirstSigninTest : public SyncSetupHandlerTest { |
379 std::string GetTestUser() override { return std::string(); } | 378 std::string GetTestUser() override { return std::string(); } |
380 }; | 379 }; |
381 | 380 |
382 TEST_F(SyncSetupHandlerTest, Basic) { | 381 TEST_F(SyncSetupHandlerTest, Basic) { |
383 } | 382 } |
384 | 383 |
385 #if !defined(OS_CHROMEOS) | 384 #if !defined(OS_CHROMEOS) |
386 TEST_F(SyncSetupHandlerFirstSigninTest, DisplayBasicLogin) { | 385 TEST_F(SyncSetupHandlerFirstSigninTest, DisplayBasicLogin) { |
387 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 386 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(false)); |
388 .WillRepeatedly(Return(false)); | |
389 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) | 387 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
390 .WillRepeatedly(Return(false)); | 388 .WillRepeatedly(Return(false)); |
391 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 389 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
392 .WillRepeatedly(Return(false)); | 390 .WillRepeatedly(Return(false)); |
393 // Ensure that the user is not signed in before calling |HandleStartSignin()|. | 391 // Ensure that the user is not signed in before calling |HandleStartSignin()|. |
394 SigninManager* manager = static_cast<SigninManager*>(mock_signin_); | 392 SigninManager* manager = static_cast<SigninManager*>(mock_signin_); |
395 manager->SignOut(signin_metrics::SIGNOUT_TEST); | 393 manager->SignOut(signin_metrics::SIGNOUT_TEST); |
396 handler_->HandleStartSignin(NULL); | 394 handler_->HandleStartSignin(NULL); |
397 | 395 |
398 // Sync setup hands off control to the gaia login tab. | 396 // Sync setup hands off control to the gaia login tab. |
399 EXPECT_EQ(NULL, | 397 EXPECT_EQ(NULL, |
400 LoginUIServiceFactory::GetForProfile( | 398 LoginUIServiceFactory::GetForProfile( |
401 profile_.get())->current_login_ui()); | 399 profile_.get())->current_login_ui()); |
402 | 400 |
403 ASSERT_FALSE(handler_->is_configuring_sync()); | 401 ASSERT_FALSE(handler_->is_configuring_sync()); |
404 | 402 |
405 handler_->CloseSyncSetup(); | 403 handler_->CloseSyncSetup(); |
406 EXPECT_EQ(NULL, | 404 EXPECT_EQ(NULL, |
407 LoginUIServiceFactory::GetForProfile( | 405 LoginUIServiceFactory::GetForProfile( |
408 profile_.get())->current_login_ui()); | 406 profile_.get())->current_login_ui()); |
409 } | 407 } |
410 | 408 |
411 TEST_F(SyncSetupHandlerTest, ShowSyncSetupWhenNotSignedIn) { | 409 TEST_F(SyncSetupHandlerTest, ShowSyncSetupWhenNotSignedIn) { |
412 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 410 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(false)); |
413 .WillRepeatedly(Return(false)); | |
414 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) | 411 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
415 .WillRepeatedly(Return(false)); | 412 .WillRepeatedly(Return(false)); |
416 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 413 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
417 .WillRepeatedly(Return(false)); | 414 .WillRepeatedly(Return(false)); |
418 handler_->HandleShowSetupUI(NULL); | 415 handler_->HandleShowSetupUI(NULL); |
419 | 416 |
420 // We expect a call to SyncSetupOverlay.showSyncSetupPage. | 417 // We expect a call to SyncSetupOverlay.showSyncSetupPage. |
421 ASSERT_EQ(1U, web_ui_.call_data().size()); | 418 ASSERT_EQ(1U, web_ui_.call_data().size()); |
422 const TestWebUI::CallData& data = web_ui_.call_data()[0]; | 419 const TestWebUI::CallData& data = web_ui_.call_data()[0]; |
423 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); | 420 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); |
(...skipping 14 matching lines...) Expand all Loading... |
438 // Sync setup is closed when sync is disabled. | 435 // Sync setup is closed when sync is disabled. |
439 EXPECT_EQ(NULL, | 436 EXPECT_EQ(NULL, |
440 LoginUIServiceFactory::GetForProfile( | 437 LoginUIServiceFactory::GetForProfile( |
441 profile_.get())->current_login_ui()); | 438 profile_.get())->current_login_ui()); |
442 ASSERT_FALSE(handler_->is_configuring_sync()); | 439 ASSERT_FALSE(handler_->is_configuring_sync()); |
443 } | 440 } |
444 | 441 |
445 // Verifies that the handler correctly handles a cancellation when | 442 // Verifies that the handler correctly handles a cancellation when |
446 // it is displaying the spinner to the user. | 443 // it is displaying the spinner to the user. |
447 TEST_F(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndCancel) { | 444 TEST_F(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndCancel) { |
448 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 445 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); |
449 .WillRepeatedly(Return(true)); | |
450 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) | 446 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
451 .WillRepeatedly(Return(true)); | 447 .WillRepeatedly(Return(true)); |
452 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 448 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
453 .WillRepeatedly(Return(false)); | 449 .WillRepeatedly(Return(false)); |
454 error_ = GoogleServiceAuthError::AuthErrorNone(); | 450 error_ = GoogleServiceAuthError::AuthErrorNone(); |
455 EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); | 451 EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); |
456 | 452 |
457 // We're simulating a user setting up sync, which would cause the backend to | 453 // We're simulating a user setting up sync, which would cause the backend to |
458 // kick off initialization, but not download user data types. The sync | 454 // kick off initialization, but not download user data types. The sync |
459 // backend will try to download control data types (e.g encryption info), but | 455 // backend will try to download control data types (e.g encryption info), but |
460 // that won't finish for this test as we're simulating cancelling while the | 456 // that won't finish for this test as we're simulating cancelling while the |
461 // spinner is showing. | 457 // spinner is showing. |
462 handler_->HandleShowSetupUI(NULL); | 458 handler_->HandleShowSetupUI(NULL); |
463 | 459 |
464 EXPECT_EQ(handler_.get(), | 460 EXPECT_EQ(handler_.get(), |
465 LoginUIServiceFactory::GetForProfile( | 461 LoginUIServiceFactory::GetForProfile( |
466 profile_.get())->current_login_ui()); | 462 profile_.get())->current_login_ui()); |
467 | 463 |
468 ExpectSpinnerAndClose(); | 464 ExpectSpinnerAndClose(); |
469 } | 465 } |
470 | 466 |
471 // Verifies that the handler correctly transitions from showing the spinner | 467 // Verifies that the handler correctly transitions from showing the spinner |
472 // to showing a configuration page when sync setup completes successfully. | 468 // to showing a configuration page when sync setup completes successfully. |
473 TEST_F(SyncSetupHandlerTest, | 469 TEST_F(SyncSetupHandlerTest, |
474 DisplayConfigureWithBackendDisabledAndSyncStartupCompleted) { | 470 DisplayConfigureWithBackendDisabledAndSyncStartupCompleted) { |
475 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 471 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); |
476 .WillRepeatedly(Return(true)); | |
477 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) | 472 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
478 .WillRepeatedly(Return(true)); | 473 .WillRepeatedly(Return(true)); |
479 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 474 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
480 .WillRepeatedly(Return(false)); | 475 .WillRepeatedly(Return(false)); |
481 error_ = GoogleServiceAuthError::AuthErrorNone(); | 476 error_ = GoogleServiceAuthError::AuthErrorNone(); |
482 // Sync backend is stopped initially, and will start up. | 477 // Sync backend is stopped initially, and will start up. |
483 EXPECT_CALL(*mock_pss_, backend_initialized()) | 478 EXPECT_CALL(*mock_pss_, backend_initialized()) |
484 .WillRepeatedly(Return(false)); | 479 .WillRepeatedly(Return(false)); |
485 SetDefaultExpectationsForConfigPage(); | 480 SetDefaultExpectationsForConfigPage(); |
486 | 481 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 CheckBool(dictionary, "usePassphrase", false); | 514 CheckBool(dictionary, "usePassphrase", false); |
520 } | 515 } |
521 | 516 |
522 // Verifies the case where the user cancels after the sync backend has | 517 // Verifies the case where the user cancels after the sync backend has |
523 // initialized (meaning it already transitioned from the spinner to a proper | 518 // initialized (meaning it already transitioned from the spinner to a proper |
524 // configuration page, tested by | 519 // configuration page, tested by |
525 // DisplayConfigureWithBackendDisabledAndSigninSuccess), but before the user | 520 // DisplayConfigureWithBackendDisabledAndSigninSuccess), but before the user |
526 // before the user has continued on. | 521 // before the user has continued on. |
527 TEST_F(SyncSetupHandlerTest, | 522 TEST_F(SyncSetupHandlerTest, |
528 DisplayConfigureWithBackendDisabledAndCancelAfterSigninSuccess) { | 523 DisplayConfigureWithBackendDisabledAndCancelAfterSigninSuccess) { |
529 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 524 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); |
530 .WillRepeatedly(Return(true)); | |
531 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) | 525 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
532 .WillRepeatedly(Return(true)); | 526 .WillRepeatedly(Return(true)); |
533 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 527 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
534 .WillRepeatedly(Return(false)); | 528 .WillRepeatedly(Return(false)); |
535 error_ = GoogleServiceAuthError::AuthErrorNone(); | 529 error_ = GoogleServiceAuthError::AuthErrorNone(); |
536 EXPECT_CALL(*mock_pss_, backend_initialized()) | 530 EXPECT_CALL(*mock_pss_, backend_initialized()) |
537 .WillOnce(Return(false)) | 531 .WillOnce(Return(false)) |
538 .WillRepeatedly(Return(true)); | 532 .WillRepeatedly(Return(true)); |
539 SetDefaultExpectationsForConfigPage(); | 533 SetDefaultExpectationsForConfigPage(); |
540 handler_->OpenSyncSetup(); | 534 handler_->OpenSyncSetup(); |
541 | 535 |
542 // It's important to tell sync the user cancelled the setup flow before we | 536 // It's important to tell sync the user cancelled the setup flow before we |
543 // tell it we're through with the setup progress. | 537 // tell it we're through with the setup progress. |
544 testing::InSequence seq; | 538 testing::InSequence seq; |
545 EXPECT_CALL(*mock_pss_, DisableForUser()); | 539 EXPECT_CALL(*mock_pss_, DisableForUser()); |
546 EXPECT_CALL(*mock_pss_, SetSetupInProgress(false)); | 540 EXPECT_CALL(*mock_pss_, SetSetupInProgress(false)); |
547 | 541 |
548 handler_->CloseSyncSetup(); | 542 handler_->CloseSyncSetup(); |
549 EXPECT_EQ(NULL, | 543 EXPECT_EQ(NULL, |
550 LoginUIServiceFactory::GetForProfile( | 544 LoginUIServiceFactory::GetForProfile( |
551 profile_.get())->current_login_ui()); | 545 profile_.get())->current_login_ui()); |
552 } | 546 } |
553 | 547 |
554 TEST_F(SyncSetupHandlerTest, | 548 TEST_F(SyncSetupHandlerTest, |
555 DisplayConfigureWithBackendDisabledAndSigninFailed) { | 549 DisplayConfigureWithBackendDisabledAndSigninFailed) { |
556 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 550 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); |
557 .WillRepeatedly(Return(true)); | |
558 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) | 551 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
559 .WillRepeatedly(Return(true)); | 552 .WillRepeatedly(Return(true)); |
560 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 553 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
561 .WillRepeatedly(Return(false)); | 554 .WillRepeatedly(Return(false)); |
562 error_ = GoogleServiceAuthError::AuthErrorNone(); | 555 error_ = GoogleServiceAuthError::AuthErrorNone(); |
563 EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); | 556 EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); |
564 | 557 |
565 handler_->OpenSyncSetup(); | 558 handler_->OpenSyncSetup(); |
566 const TestWebUI::CallData& data = web_ui_.call_data()[0]; | 559 const TestWebUI::CallData& data = web_ui_.call_data()[0]; |
567 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); | 560 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); |
(...skipping 13 matching lines...) Expand all Loading... |
581 } | 574 } |
582 | 575 |
583 #if !defined(OS_CHROMEOS) | 576 #if !defined(OS_CHROMEOS) |
584 | 577 |
585 class SyncSetupHandlerNonCrosTest : public SyncSetupHandlerTest { | 578 class SyncSetupHandlerNonCrosTest : public SyncSetupHandlerTest { |
586 public: | 579 public: |
587 SyncSetupHandlerNonCrosTest() {} | 580 SyncSetupHandlerNonCrosTest() {} |
588 }; | 581 }; |
589 | 582 |
590 TEST_F(SyncSetupHandlerNonCrosTest, HandleGaiaAuthFailure) { | 583 TEST_F(SyncSetupHandlerNonCrosTest, HandleGaiaAuthFailure) { |
591 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 584 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(false)); |
592 .WillRepeatedly(Return(false)); | |
593 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) | 585 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
594 .WillRepeatedly(Return(false)); | 586 .WillRepeatedly(Return(false)); |
595 EXPECT_CALL(*mock_pss_, HasUnrecoverableError()) | 587 EXPECT_CALL(*mock_pss_, HasUnrecoverableError()) |
596 .WillRepeatedly(Return(false)); | 588 .WillRepeatedly(Return(false)); |
597 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 589 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
598 .WillRepeatedly(Return(false)); | 590 .WillRepeatedly(Return(false)); |
599 // Open the web UI. | 591 // Open the web UI. |
600 handler_->OpenSyncSetup(); | 592 handler_->OpenSyncSetup(); |
601 | 593 |
602 ASSERT_FALSE(handler_->is_configuring_sync()); | 594 ASSERT_FALSE(handler_->is_configuring_sync()); |
603 } | 595 } |
604 | 596 |
605 // TODO(kochi): We need equivalent tests for ChromeOS. | 597 // TODO(kochi): We need equivalent tests for ChromeOS. |
606 TEST_F(SyncSetupHandlerNonCrosTest, UnrecoverableErrorInitializingSync) { | 598 TEST_F(SyncSetupHandlerNonCrosTest, UnrecoverableErrorInitializingSync) { |
607 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 599 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(false)); |
608 .WillRepeatedly(Return(false)); | |
609 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) | 600 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
610 .WillRepeatedly(Return(false)); | 601 .WillRepeatedly(Return(false)); |
611 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 602 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
612 .WillRepeatedly(Return(false)); | 603 .WillRepeatedly(Return(false)); |
613 // Open the web UI. | 604 // Open the web UI. |
614 handler_->OpenSyncSetup(); | 605 handler_->OpenSyncSetup(); |
615 | 606 |
616 ASSERT_FALSE(handler_->is_configuring_sync()); | 607 ASSERT_FALSE(handler_->is_configuring_sync()); |
617 } | 608 } |
618 | 609 |
619 TEST_F(SyncSetupHandlerNonCrosTest, GaiaErrorInitializingSync) { | 610 TEST_F(SyncSetupHandlerNonCrosTest, GaiaErrorInitializingSync) { |
620 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 611 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(false)); |
621 .WillRepeatedly(Return(false)); | |
622 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) | 612 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
623 .WillRepeatedly(Return(false)); | 613 .WillRepeatedly(Return(false)); |
624 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 614 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
625 .WillRepeatedly(Return(false)); | 615 .WillRepeatedly(Return(false)); |
626 // Open the web UI. | 616 // Open the web UI. |
627 handler_->OpenSyncSetup(); | 617 handler_->OpenSyncSetup(); |
628 | 618 |
629 ASSERT_FALSE(handler_->is_configuring_sync()); | 619 ASSERT_FALSE(handler_->is_configuring_sync()); |
630 } | 620 } |
631 | 621 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 TEST_F(SyncSetupHandlerTest, ShowSigninOnAuthError) { | 852 TEST_F(SyncSetupHandlerTest, ShowSigninOnAuthError) { |
863 // Initialize the system to a signed in state, but with an auth error. | 853 // Initialize the system to a signed in state, but with an auth error. |
864 error_ = GoogleServiceAuthError( | 854 error_ = GoogleServiceAuthError( |
865 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); | 855 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); |
866 | 856 |
867 SetupInitializedProfileSyncService(); | 857 SetupInitializedProfileSyncService(); |
868 mock_signin_->SetAuthenticatedAccountInfo(kTestUser, kTestUser); | 858 mock_signin_->SetAuthenticatedAccountInfo(kTestUser, kTestUser); |
869 FakeAuthStatusProvider provider( | 859 FakeAuthStatusProvider provider( |
870 SigninErrorControllerFactory::GetForProfile(profile_.get())); | 860 SigninErrorControllerFactory::GetForProfile(profile_.get())); |
871 provider.SetAuthError(kTestUser, error_); | 861 provider.SetAuthError(kTestUser, error_); |
872 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 862 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); |
873 .WillRepeatedly(Return(true)); | |
874 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) | 863 EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
875 .WillRepeatedly(Return(true)); | 864 .WillRepeatedly(Return(true)); |
876 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) | 865 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
877 .WillRepeatedly(Return(false)); | 866 .WillRepeatedly(Return(false)); |
878 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) | 867 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) |
879 .WillRepeatedly(Return(false)); | 868 .WillRepeatedly(Return(false)); |
880 EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); | 869 EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); |
881 | 870 |
882 #if defined(OS_CHROMEOS) | 871 #if defined(OS_CHROMEOS) |
883 // On ChromeOS, auth errors are ignored - instead we just try to start the | 872 // On ChromeOS, auth errors are ignored - instead we just try to start the |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 WillRepeatedly(Return(false)); | 1073 WillRepeatedly(Return(false)); |
1085 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); | 1074 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); |
1086 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); | 1075 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); |
1087 handler_->HandleConfigure(&list_args); | 1076 handler_->HandleConfigure(&list_args); |
1088 | 1077 |
1089 // Ensure that we navigated to the "done" state since we don't need a | 1078 // Ensure that we navigated to the "done" state since we don't need a |
1090 // passphrase. | 1079 // passphrase. |
1091 ExpectDone(); | 1080 ExpectDone(); |
1092 } | 1081 } |
1093 | 1082 |
OLD | NEW |