Chromium Code Reviews| 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/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/signin/fake_auth_status_provider.h" | |
| 16 #include "chrome/browser/signin/signin_manager_factory.h" | 17 #include "chrome/browser/signin/signin_manager_factory.h" |
| 17 #include "chrome/browser/signin/signin_manager_fake.h" | 18 #include "chrome/browser/signin/signin_manager_fake.h" |
| 18 #include "chrome/browser/sync/profile_sync_service_factory.h" | 19 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 19 #include "chrome/browser/sync/profile_sync_service_mock.h" | 20 #include "chrome/browser/sync/profile_sync_service_mock.h" |
| 20 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 21 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 21 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 22 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 22 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 23 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
| 23 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/test/base/testing_profile.h" | 26 #include "chrome/test/base/testing_profile.h" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 WillRepeatedly(Return(GetAllTypes())); | 400 WillRepeatedly(Return(GetAllTypes())); |
| 400 EXPECT_CALL(*mock_pss_, GetPreferredDataTypes()). | 401 EXPECT_CALL(*mock_pss_, GetPreferredDataTypes()). |
| 401 WillRepeatedly(Return(GetAllTypes())); | 402 WillRepeatedly(Return(GetAllTypes())); |
| 402 EXPECT_CALL(*mock_pss_, EncryptEverythingEnabled()). | 403 EXPECT_CALL(*mock_pss_, EncryptEverythingEnabled()). |
| 403 WillRepeatedly(Return(false)); | 404 WillRepeatedly(Return(false)); |
| 404 } | 405 } |
| 405 | 406 |
| 406 void SetupInitializedProfileSyncService() { | 407 void SetupInitializedProfileSyncService() { |
| 407 // An initialized ProfileSyncService will have already completed sync setup | 408 // An initialized ProfileSyncService will have already completed sync setup |
| 408 // and will have an initialized sync backend. | 409 // and will have an initialized sync backend. |
| 410 mock_signin_->SetAuthenticatedUsername(kTestUser); | |
| 409 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 411 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) |
| 410 .WillRepeatedly(Return(true)); | 412 .WillRepeatedly(Return(true)); |
| 411 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) | 413 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) |
| 412 .WillRepeatedly(Return(true)); | 414 .WillRepeatedly(Return(true)); |
| 413 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 415 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
| 414 .WillRepeatedly(Return(true)); | 416 .WillRepeatedly(Return(true)); |
| 415 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); | 417 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); |
| 416 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(true)); | 418 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(true)); |
| 417 } | 419 } |
| 418 | 420 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 EXPECT_EQ(NULL, | 519 EXPECT_EQ(NULL, |
| 518 LoginUIServiceFactory::GetForProfile( | 520 LoginUIServiceFactory::GetForProfile( |
| 519 profile_.get())->current_login_ui()); | 521 profile_.get())->current_login_ui()); |
| 520 } | 522 } |
| 521 | 523 |
| 522 // Verifies that the handler correctly handles a cancellation when | 524 // Verifies that the handler correctly handles a cancellation when |
| 523 // it is displaying the spinner to the user. | 525 // it is displaying the spinner to the user. |
| 524 TEST_P(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndCancel) { | 526 TEST_P(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndCancel) { |
| 525 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 527 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) |
| 526 .WillRepeatedly(Return(true)); | 528 .WillRepeatedly(Return(true)); |
| 529 mock_signin_->SetAuthenticatedUsername(kTestUser); | |
| 527 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) | 530 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) |
| 528 .WillRepeatedly(Return(true)); | 531 .WillRepeatedly(Return(true)); |
| 529 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 532 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
| 530 .WillRepeatedly(Return(false)); | 533 .WillRepeatedly(Return(false)); |
| 531 error_ = GoogleServiceAuthError::None(); | 534 error_ = GoogleServiceAuthError::None(); |
| 532 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); | 535 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); |
| 533 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(false)); | 536 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(false)); |
| 534 | 537 |
| 535 // We're simulating a user setting up sync, which would cause the backend to | 538 // We're simulating a user setting up sync, which would cause the backend to |
| 536 // kick off initialization, but not download user data types. The sync | 539 // kick off initialization, but not download user data types. The sync |
| 537 // backend will try to download control data types (e.g encryption info), but | 540 // backend will try to download control data types (e.g encryption info), but |
| 538 // that won't finish for this test as we're simulating cancelling while the | 541 // that won't finish for this test as we're simulating cancelling while the |
| 539 // spinner is showing. | 542 // spinner is showing. |
| 540 handler_->OpenSyncSetup(false); | 543 handler_->OpenSyncSetup(false); |
| 541 | 544 |
| 542 // When the SigninTracker is initialized here, a signin failure is triggered | 545 EXPECT_EQ(handler_.get(), |
| 543 // due to sync_initialized() returning false, causing the current login UI to | |
| 544 // be dismissed. | |
| 545 EXPECT_EQ(NULL, | |
| 546 LoginUIServiceFactory::GetForProfile( | 546 LoginUIServiceFactory::GetForProfile( |
| 547 profile_.get())->current_login_ui()); | 547 profile_.get())->current_login_ui()); |
| 548 | 548 |
| 549 // We expect a call to SyncSetupOverlay.showSyncSetupPage. Some variations of | 549 // We expect a call to SyncSetupOverlay.showSyncSetupPage. Some variations of |
| 550 // this test also include a call to OptionsPage.closeOverlay, that we ignore. | 550 // this test also include a call to OptionsPage.closeOverlay, that we ignore. |
| 551 EXPECT_LE(1U, web_ui_.call_data().size()); | 551 ASSERT_LE(1U, web_ui_.call_data().size()); |
|
James Hawkins
2013/01/30 16:55:09
This really should be an EXPECT, since the test ca
Andrew T Wilson (Slow)
2013/01/31 10:38:05
Done.
| |
| 552 | 552 |
| 553 const TestWebUI::CallData& data = web_ui_.call_data()[0]; | 553 const TestWebUI::CallData& data = web_ui_.call_data()[0]; |
| 554 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); | 554 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); |
| 555 std::string page; | 555 std::string page; |
| 556 ASSERT_TRUE(data.arg1->GetAsString(&page)); | 556 ASSERT_TRUE(data.arg1->GetAsString(&page)); |
| 557 EXPECT_EQ(page, "spinner"); | 557 EXPECT_EQ(page, "spinner"); |
| 558 // Cancelling the spinner dialog will cause CloseSyncSetup(). | 558 // Cancelling the spinner dialog will cause CloseSyncSetup(). |
| 559 handler_->CloseSyncSetup(); | 559 handler_->CloseSyncSetup(); |
| 560 EXPECT_EQ(NULL, | 560 EXPECT_EQ(NULL, |
| 561 LoginUIServiceFactory::GetForProfile( | 561 LoginUIServiceFactory::GetForProfile( |
| 562 profile_.get())->current_login_ui()); | 562 profile_.get())->current_login_ui()); |
| 563 } | 563 } |
| 564 | 564 |
| 565 // Verifies that the handler correctly transitions from showing the spinner | 565 // Verifies that the handler correctly transitions from showing the spinner |
| 566 // to showing a configuration page when signin completes successfully. | 566 // to showing a configuration page when signin completes successfully. |
| 567 TEST_P(SyncSetupHandlerTest, | 567 TEST_P(SyncSetupHandlerTest, |
| 568 DisplayConfigureWithBackendDisabledAndSigninSuccess) { | 568 DisplayConfigureWithBackendDisabledAndSigninSuccess) { |
| 569 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 569 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) |
| 570 .WillRepeatedly(Return(true)); | 570 .WillRepeatedly(Return(true)); |
| 571 mock_signin_->SetAuthenticatedUsername(kTestUser); | |
| 571 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) | 572 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) |
| 572 .WillRepeatedly(Return(true)); | 573 .WillRepeatedly(Return(true)); |
| 573 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 574 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
| 574 .WillRepeatedly(Return(false)); | 575 .WillRepeatedly(Return(false)); |
| 575 error_ = GoogleServiceAuthError::None(); | 576 error_ = GoogleServiceAuthError::None(); |
| 576 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); | 577 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); |
| 577 // Sync backend is stopped initially, and will start up. | 578 // Sync backend is stopped initially, and will start up. |
| 578 EXPECT_CALL(*mock_pss_, sync_initialized()) | 579 EXPECT_CALL(*mock_pss_, sync_initialized()) |
| 579 .WillOnce(Return(false)) | 580 .WillRepeatedly(Return(false)); |
| 580 .WillRepeatedly(Return(true)); | |
| 581 SetDefaultExpectationsForConfigPage(); | 581 SetDefaultExpectationsForConfigPage(); |
| 582 | 582 |
| 583 handler_->OpenSyncSetup(false); | 583 handler_->OpenSyncSetup(false); |
| 584 | 584 |
| 585 // We expect a call to SyncSetupOverlay.showSyncSetupPage. Some variations of | 585 // We expect a call to SyncSetupOverlay.showSyncSetupPage. Some variations of |
| 586 // this test also include a call to OptionsPage.closeOverlay, that we ignore. | 586 // this test also include a call to OptionsPage.closeOverlay, that we ignore. |
| 587 EXPECT_LE(1U, web_ui_.call_data().size()); | 587 EXPECT_LE(1U, web_ui_.call_data().size()); |
| 588 | 588 |
| 589 const TestWebUI::CallData& data0 = web_ui_.call_data()[0]; | 589 const TestWebUI::CallData& data0 = web_ui_.call_data()[0]; |
| 590 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data0.function_name); | 590 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data0.function_name); |
| 591 std::string page; | 591 std::string page; |
| 592 ASSERT_TRUE(data0.arg1->GetAsString(&page)); | 592 ASSERT_TRUE(data0.arg1->GetAsString(&page)); |
| 593 EXPECT_EQ(page, "spinner"); | 593 EXPECT_EQ(page, "spinner"); |
| 594 | |
| 595 Mock::VerifyAndClearExpectations(mock_pss_); | |
| 596 // Now, act as if the ProfileSyncService has started up. | |
| 597 SetDefaultExpectationsForConfigPage(); | |
| 598 EXPECT_CALL(*mock_pss_, sync_initialized()) | |
| 599 .WillRepeatedly(Return(true)); | |
| 594 handler_->SigninSuccess(); | 600 handler_->SigninSuccess(); |
| 595 | 601 |
| 596 // On signin success, the dialog will proceed from spinner to configure sync | |
| 597 // everything. There is no login UI once signin is successful. | |
| 598 EXPECT_EQ(NULL, | |
| 599 LoginUIServiceFactory::GetForProfile( | |
| 600 profile_.get())->current_login_ui()); | |
| 601 | |
| 602 // We expect a second call to SyncSetupOverlay.showSyncSetupPage. Some | 602 // We expect a second call to SyncSetupOverlay.showSyncSetupPage. Some |
| 603 // variations of this test also include a call to OptionsPage.closeOverlay, | 603 // variations of this test also include a call to OptionsPage.closeOverlay, |
| 604 // that we ignore. | 604 // that we ignore. |
| 605 EXPECT_LE(2U, web_ui_.call_data().size()); | 605 EXPECT_LE(2U, web_ui_.call_data().size()); |
| 606 const TestWebUI::CallData& data1 = web_ui_.call_data().back(); | 606 const TestWebUI::CallData& data1 = web_ui_.call_data().back(); |
| 607 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data1.function_name); | 607 EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data1.function_name); |
| 608 ASSERT_TRUE(data1.arg1->GetAsString(&page)); | 608 ASSERT_TRUE(data1.arg1->GetAsString(&page)); |
| 609 EXPECT_EQ(page, "configure"); | 609 EXPECT_EQ(page, "configure"); |
| 610 DictionaryValue* dictionary; | 610 DictionaryValue* dictionary; |
| 611 ASSERT_TRUE(data1.arg2->GetAsDictionary(&dictionary)); | 611 ASSERT_TRUE(data1.arg2->GetAsDictionary(&dictionary)); |
| 612 CheckBool(dictionary, "passphraseFailed", false); | 612 CheckBool(dictionary, "passphraseFailed", false); |
| 613 CheckBool(dictionary, "showSyncEverythingPage", true); | 613 CheckBool(dictionary, "showSyncEverythingPage", true); |
| 614 CheckBool(dictionary, "syncAllDataTypes", true); | 614 CheckBool(dictionary, "syncAllDataTypes", true); |
| 615 CheckBool(dictionary, "encryptAllData", false); | 615 CheckBool(dictionary, "encryptAllData", false); |
| 616 CheckBool(dictionary, "usePassphrase", false); | 616 CheckBool(dictionary, "usePassphrase", false); |
| 617 } | 617 } |
| 618 | 618 |
| 619 // Verifies the case where the user cancels after the sync backend has | 619 // Verifies the case where the user cancels after the sync backend has |
| 620 // initialized (meaning it already transitioned from the spinner to a proper | 620 // initialized (meaning it already transitioned from the spinner to a proper |
| 621 // configuration page, tested by | 621 // configuration page, tested by |
| 622 // DisplayConfigureWithBackendDisabledAndSigninSuccess), but before the user | 622 // DisplayConfigureWithBackendDisabledAndSigninSuccess), but before the user |
| 623 // before the user has continued on. | 623 // before the user has continued on. |
| 624 TEST_P(SyncSetupHandlerTest, | 624 TEST_P(SyncSetupHandlerTest, |
| 625 DisplayConfigureWithBackendDisabledAndCancelAfterSigninSuccess) { | 625 DisplayConfigureWithBackendDisabledAndCancelAfterSigninSuccess) { |
| 626 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 626 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) |
| 627 .WillRepeatedly(Return(true)); | 627 .WillRepeatedly(Return(true)); |
| 628 mock_signin_->SetAuthenticatedUsername(kTestUser); | |
| 628 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) | 629 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) |
| 629 .WillRepeatedly(Return(true)); | 630 .WillRepeatedly(Return(true)); |
| 630 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 631 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
| 631 .WillRepeatedly(Return(false)); | 632 .WillRepeatedly(Return(false)); |
| 632 error_ = GoogleServiceAuthError::None(); | 633 error_ = GoogleServiceAuthError::None(); |
| 633 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); | 634 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); |
| 634 EXPECT_CALL(*mock_pss_, sync_initialized()) | 635 EXPECT_CALL(*mock_pss_, sync_initialized()) |
| 635 .WillOnce(Return(false)) | 636 .WillOnce(Return(false)) |
| 636 .WillRepeatedly(Return(true)); | 637 .WillRepeatedly(Return(true)); |
| 637 SetDefaultExpectationsForConfigPage(); | 638 SetDefaultExpectationsForConfigPage(); |
| 638 handler_->OpenSyncSetup(false); | 639 handler_->OpenSyncSetup(false); |
| 639 handler_->SigninSuccess(); | 640 handler_->SigninSuccess(); |
| 640 | 641 |
| 641 // It's important to tell sync the user cancelled the setup flow before we | 642 // It's important to tell sync the user cancelled the setup flow before we |
| 642 // tell it we're through with the setup progress. | 643 // tell it we're through with the setup progress. |
| 643 testing::InSequence seq; | 644 testing::InSequence seq; |
| 644 EXPECT_CALL(*mock_pss_, DisableForUser()); | 645 EXPECT_CALL(*mock_pss_, DisableForUser()); |
| 645 EXPECT_CALL(*mock_pss_, SetSetupInProgress(false)); | 646 EXPECT_CALL(*mock_pss_, SetSetupInProgress(false)); |
| 646 | 647 |
| 647 handler_->CloseSyncSetup(); | 648 handler_->CloseSyncSetup(); |
| 648 EXPECT_EQ(NULL, | 649 EXPECT_EQ(NULL, |
| 649 LoginUIServiceFactory::GetForProfile( | 650 LoginUIServiceFactory::GetForProfile( |
| 650 profile_.get())->current_login_ui()); | 651 profile_.get())->current_login_ui()); |
| 651 } | 652 } |
| 652 | 653 |
| 653 TEST_P(SyncSetupHandlerTest, | 654 TEST_P(SyncSetupHandlerTest, |
| 654 DisplayConfigureWithBackendDisabledAndSigninFalied) { | 655 DisplayConfigureWithBackendDisabledAndSigninFalied) { |
| 655 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 656 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) |
| 656 .WillRepeatedly(Return(true)); | 657 .WillRepeatedly(Return(true)); |
| 658 mock_signin_->SetAuthenticatedUsername(kTestUser); | |
| 657 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) | 659 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) |
| 658 .WillRepeatedly(Return(true)); | 660 .WillRepeatedly(Return(true)); |
| 659 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) | 661 EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) |
| 660 .WillRepeatedly(Return(false)); | 662 .WillRepeatedly(Return(false)); |
| 661 error_ = GoogleServiceAuthError::None(); | 663 error_ = GoogleServiceAuthError::None(); |
| 662 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); | 664 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); |
| 663 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(false)); | 665 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(false)); |
| 664 | 666 |
| 665 handler_->OpenSyncSetup(false); | 667 handler_->OpenSyncSetup(false); |
| 666 const TestWebUI::CallData& data = web_ui_.call_data()[0]; | 668 const TestWebUI::CallData& data = web_ui_.call_data()[0]; |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1046 SetDefaultExpectationsForConfigPage(); | 1048 SetDefaultExpectationsForConfigPage(); |
| 1047 handler_->OpenSyncSetup(false); | 1049 handler_->OpenSyncSetup(false); |
| 1048 | 1050 |
| 1049 ExpectConfig(); | 1051 ExpectConfig(); |
| 1050 } | 1052 } |
| 1051 | 1053 |
| 1052 TEST_P(SyncSetupHandlerTest, ShowSyncSetupWithAuthError) { | 1054 TEST_P(SyncSetupHandlerTest, ShowSyncSetupWithAuthError) { |
| 1053 // Initialize the system to a signed in state, but with an auth error. | 1055 // Initialize the system to a signed in state, but with an auth error. |
| 1054 error_ = GoogleServiceAuthError( | 1056 error_ = GoogleServiceAuthError( |
| 1055 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); | 1057 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); |
| 1058 | |
| 1056 SetupInitializedProfileSyncService(); | 1059 SetupInitializedProfileSyncService(); |
| 1057 mock_signin_->SetAuthenticatedUsername(kTestUser); | 1060 mock_signin_->SetAuthenticatedUsername(kTestUser); |
| 1061 FakeAuthStatusProvider provider(mock_signin_->signin_global_error()); | |
| 1062 provider.set_auth_error(error_); | |
| 1058 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) | 1063 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) |
| 1059 .WillRepeatedly(Return(true)); | 1064 .WillRepeatedly(Return(true)); |
| 1060 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) | 1065 EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) |
| 1061 .WillRepeatedly(Return(true)); | 1066 .WillRepeatedly(Return(true)); |
| 1062 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) | 1067 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
| 1063 .WillRepeatedly(Return(false)); | 1068 .WillRepeatedly(Return(false)); |
| 1064 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) | 1069 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) |
| 1065 .WillRepeatedly(Return(false)); | 1070 .WillRepeatedly(Return(false)); |
| 1066 // This should display the login dialog (not login). | 1071 // This should display the login dialog (not login). |
| 1067 handler_->OpenSyncSetup(false); | 1072 handler_->OpenSyncSetup(false); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1276 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); | 1281 dictionary, err, false, GoogleServiceAuthError::NONE, "", true, ""); |
| 1277 handler_->CloseSyncSetup(); | 1282 handler_->CloseSyncSetup(); |
| 1278 EXPECT_EQ(NULL, | 1283 EXPECT_EQ(NULL, |
| 1279 LoginUIServiceFactory::GetForProfile( | 1284 LoginUIServiceFactory::GetForProfile( |
| 1280 profile_.get())->current_login_ui()); | 1285 profile_.get())->current_login_ui()); |
| 1281 } | 1286 } |
| 1282 | 1287 |
| 1283 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTestWithParam, | 1288 INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTestWithParam, |
| 1284 SyncSetupHandlerTest, | 1289 SyncSetupHandlerTest, |
| 1285 Values(true, false)); | 1290 Values(true, false)); |
| OLD | NEW |