Chromium Code Reviews| Index: chrome/browser/signin/account_reconcilor_unittest.cc |
| diff --git a/chrome/browser/signin/account_reconcilor_unittest.cc b/chrome/browser/signin/account_reconcilor_unittest.cc |
| index 43f97c4d7d348a7b3f0f698bbafce6fa8c13519f..a71c1a69b4b2d15c74a56e5d4aa3adcb019208b1 100644 |
| --- a/chrome/browser/signin/account_reconcilor_unittest.cc |
| +++ b/chrome/browser/signin/account_reconcilor_unittest.cc |
| @@ -87,6 +87,9 @@ class AccountReconcilorTest : public ::testing::TestWithParam<bool> { |
| FakeSigninManagerForTesting* signin_manager() { return signin_manager_; } |
| FakeProfileOAuth2TokenService* token_service() { return token_service_; } |
| TestSigninClient* test_signin_client() { return test_signin_client_; } |
| + GaiaCookieManagerService* cookie_manager_service() { |
| + return cookie_manager_service_; |
| + } |
| base::HistogramTester* histogram_tester() { return &histogram_tester_; } |
| void SetFakeResponse(const std::string& url, |
| @@ -118,6 +121,7 @@ class AccountReconcilorTest : public ::testing::TestWithParam<bool> { |
| FakeSigninManagerForTesting* signin_manager_; |
| FakeProfileOAuth2TokenService* token_service_; |
| TestSigninClient* test_signin_client_; |
| + GaiaCookieManagerService* cookie_manager_service_; |
| MockAccountReconcilor* mock_reconcilor_; |
| net::FakeURLFetcherFactory url_fetcher_factory_; |
| scoped_ptr<TestingProfileManager> testing_profile_manager_; |
| @@ -132,6 +136,7 @@ AccountReconcilorTest::AccountReconcilorTest() |
| : signin_manager_(NULL), |
| token_service_(NULL), |
| test_signin_client_(NULL), |
| + cookie_manager_service_(NULL), |
| mock_reconcilor_(NULL), |
| url_fetcher_factory_(NULL) {} |
| @@ -144,7 +149,7 @@ void AccountReconcilorTest::SetUp() { |
| } |
| list_accounts_url_ = GaiaUrls::GetInstance()->ListAccountsURLWithSource( |
| - GaiaConstants::kReconcilorSource); |
| + GaiaConstants::kChromeSource); |
| get_check_connection_info_url_ = |
| GaiaUrls::GetInstance()->GetCheckConnectionInfoURLWithSource( |
| GaiaConstants::kChromeSource); |
| @@ -184,6 +189,9 @@ void AccountReconcilorTest::SetUp() { |
| test_signin_client_ = |
| static_cast<TestSigninClient*>( |
| ChromeSigninClientFactory::GetForProfile(profile())); |
| + |
| + cookie_manager_service_ = |
| + GaiaCookieManagerServiceFactory::GetForProfile(profile()); |
| } |
| MockAccountReconcilor* AccountReconcilorTest::GetMockReconcilor() { |
| @@ -283,12 +291,10 @@ TEST_F(AccountReconcilorTest, GetAccountsFromCookieSuccess) { |
| net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| reconcilor->StartReconcile(); |
| - ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| - |
| base::RunLoop().RunUntilIdle(); |
| - ASSERT_TRUE(reconcilor->AreGaiaAccountsSet()); |
| - const std::vector<std::pair<std::string, bool> >& accounts = |
| - reconcilor->GetGaiaAccountsForTesting(); |
| + |
| + std::vector<std::pair<std::string, bool> > accounts; |
| + ASSERT_TRUE(cookie_manager_service()->ListAccounts(&accounts)); |
| ASSERT_EQ(1u, accounts.size()); |
| ASSERT_EQ("user@gmail.com", accounts[0].first); |
| } |
| @@ -304,10 +310,11 @@ TEST_F(AccountReconcilorTest, GetAccountsFromCookieFailure) { |
| net::HTTP_NOT_FOUND, net::URLRequestStatus::SUCCESS); |
| reconcilor->StartReconcile(); |
| - ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| - |
| base::RunLoop().RunUntilIdle(); |
| - ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| + |
| + std::vector<std::pair<std::string, bool> > accounts; |
| + ASSERT_FALSE(cookie_manager_service()->ListAccounts(&accounts)); |
| + ASSERT_EQ(0u, accounts.size()); |
| } |
| TEST_P(AccountReconcilorTest, StartReconcileNoop) { |
| @@ -324,7 +331,6 @@ TEST_P(AccountReconcilorTest, StartReconcileNoop) { |
| reconcilor->StartReconcile(); |
| ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| - ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| base::RunLoop().RunUntilIdle(); |
| ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| @@ -348,9 +354,11 @@ TEST_P(AccountReconcilorTest, StartReconcileCookiesDisabled) { |
| reconcilor->StartReconcile(); |
| ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| - ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| base::RunLoop().RunUntilIdle(); |
| + std::vector<std::pair<std::string, bool> > accounts; |
| + // This will be the first call it ListAccounts. |
|
Roger Tawa OOO till Jul 10th
2015/04/15 18:51:05
it --> to
Mike Lerman
2015/04/16 13:13:46
Done.
|
| + ASSERT_FALSE(cookie_manager_service()->ListAccounts(&accounts)); |
| ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| } |
| @@ -438,8 +446,6 @@ TEST_P(AccountReconcilorTest, StartReconcileNoopWithDots) { |
| net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| reconcilor->StartReconcile(); |
| - ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| - |
| base::RunLoop().RunUntilIdle(); |
| ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| @@ -464,7 +470,6 @@ TEST_P(AccountReconcilorTest, StartReconcileNoopMultiple) { |
| net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| reconcilor->StartReconcile(); |
| - ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| base::RunLoop().RunUntilIdle(); |
| ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| @@ -577,6 +582,7 @@ TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) { |
| "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| net::HTTP_OK, |
| net::URLRequestStatus::SUCCESS); |
| + cookie_manager_service()->set_list_accounts_fetched_once_for_testing(false); |
| // This will cause the reconcilor to fire. |
| token_service()->UpdateCredentials("third@gmail.com", "refresh_token"); |