| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/test/histogram_tester.h" | 9 #include "base/test/histogram_tester.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/prefs/pref_service_syncable.h" | 12 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 13 #include "chrome/browser/signin/account_reconcilor_factory.h" | 13 #include "chrome/browser/signin/account_reconcilor_factory.h" |
| 14 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 14 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 15 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 15 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 16 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 16 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 17 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
| 17 #include "chrome/browser/signin/fake_signin_manager.h" | 18 #include "chrome/browser/signin/fake_signin_manager.h" |
| 18 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" | 19 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" |
| 19 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 20 #include "chrome/browser/signin/signin_manager_factory.h" | 21 #include "chrome/browser/signin/signin_manager_factory.h" |
| 21 #include "chrome/browser/signin/test_signin_client_builder.h" | 22 #include "chrome/browser/signin/test_signin_client_builder.h" |
| 22 #include "chrome/test/base/testing_browser_process.h" | 23 #include "chrome/test/base/testing_browser_process.h" |
| 23 #include "chrome/test/base/testing_profile.h" | 24 #include "chrome/test/base/testing_profile.h" |
| 24 #include "chrome/test/base/testing_profile_manager.h" | 25 #include "chrome/test/base/testing_profile_manager.h" |
| 25 #include "components/signin/core/browser/account_reconcilor.h" | 26 #include "components/signin/core/browser/account_reconcilor.h" |
| 27 #include "components/signin/core/browser/account_tracker_service.h" |
| 26 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 28 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 27 #include "components/signin/core/browser/signin_manager.h" | 29 #include "components/signin/core/browser/signin_manager.h" |
| 28 #include "components/signin/core/browser/signin_metrics.h" | 30 #include "components/signin/core/browser/signin_metrics.h" |
| 29 #include "components/signin/core/browser/test_signin_client.h" | 31 #include "components/signin/core/browser/test_signin_client.h" |
| 30 #include "components/signin/core/common/profile_management_switches.h" | 32 #include "components/signin/core/common/profile_management_switches.h" |
| 31 #include "components/signin/core/common/signin_switches.h" | 33 #include "components/signin/core/common/signin_switches.h" |
| 32 #include "content/public/test/test_browser_thread_bundle.h" | 34 #include "content/public/test/test_browser_thread_bundle.h" |
| 33 #include "google_apis/gaia/gaia_constants.h" | 35 #include "google_apis/gaia/gaia_constants.h" |
| 34 #include "google_apis/gaia/gaia_urls.h" | 36 #include "google_apis/gaia/gaia_urls.h" |
| 35 #include "net/url_request/test_url_fetcher_factory.h" | 37 #include "net/url_request/test_url_fetcher_factory.h" |
| 36 #include "testing/gmock/include/gmock/gmock.h" | 38 #include "testing/gmock/include/gmock/gmock.h" |
| 37 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
| 38 | 40 |
| 39 namespace { | 41 namespace { |
| 40 | 42 |
| 41 const char kTestEmail[] = "user@gmail.com"; | |
| 42 | |
| 43 class MockAccountReconcilor : public testing::StrictMock<AccountReconcilor> { | 43 class MockAccountReconcilor : public testing::StrictMock<AccountReconcilor> { |
| 44 public: | 44 public: |
| 45 static KeyedService* Build(content::BrowserContext* context); | 45 static KeyedService* Build(content::BrowserContext* context); |
| 46 | 46 |
| 47 MockAccountReconcilor(ProfileOAuth2TokenService* token_service, | 47 MockAccountReconcilor(ProfileOAuth2TokenService* token_service, |
| 48 SigninManagerBase* signin_manager, | 48 SigninManagerBase* signin_manager, |
| 49 SigninClient* client, | 49 SigninClient* client, |
| 50 GaiaCookieManagerService* cookie_manager_service); | 50 GaiaCookieManagerService* cookie_manager_service); |
| 51 ~MockAccountReconcilor() override {} | 51 ~MockAccountReconcilor() override {} |
| 52 | 52 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 80 | 80 |
| 81 class AccountReconcilorTest : public ::testing::TestWithParam<bool> { | 81 class AccountReconcilorTest : public ::testing::TestWithParam<bool> { |
| 82 public: | 82 public: |
| 83 AccountReconcilorTest(); | 83 AccountReconcilorTest(); |
| 84 void SetUp() override; | 84 void SetUp() override; |
| 85 | 85 |
| 86 TestingProfile* profile() { return profile_; } | 86 TestingProfile* profile() { return profile_; } |
| 87 FakeSigninManagerForTesting* signin_manager() { return signin_manager_; } | 87 FakeSigninManagerForTesting* signin_manager() { return signin_manager_; } |
| 88 FakeProfileOAuth2TokenService* token_service() { return token_service_; } | 88 FakeProfileOAuth2TokenService* token_service() { return token_service_; } |
| 89 TestSigninClient* test_signin_client() { return test_signin_client_; } | 89 TestSigninClient* test_signin_client() { return test_signin_client_; } |
| 90 AccountTrackerService* account_tracker() { return account_tracker_; } |
| 90 base::HistogramTester* histogram_tester() { return &histogram_tester_; } | 91 base::HistogramTester* histogram_tester() { return &histogram_tester_; } |
| 91 | 92 |
| 92 void SetFakeResponse(const std::string& url, | 93 void SetFakeResponse(const std::string& url, |
| 93 const std::string& data, | 94 const std::string& data, |
| 94 net::HttpStatusCode code, | 95 net::HttpStatusCode code, |
| 95 net::URLRequestStatus::Status status) { | 96 net::URLRequestStatus::Status status) { |
| 96 url_fetcher_factory_.SetFakeResponse(GURL(url), data, code, status); | 97 url_fetcher_factory_.SetFakeResponse(GURL(url), data, code, status); |
| 97 } | 98 } |
| 98 | 99 |
| 99 MockAccountReconcilor* GetMockReconcilor(); | 100 MockAccountReconcilor* GetMockReconcilor(); |
| 100 | 101 |
| 102 std::string ConnectProfileToAccount(const std::string& gaia_id, |
| 103 const std::string& username); |
| 104 |
| 105 std::string PickAccountIdForAccount(const std::string& gaia_id, |
| 106 const std::string& username); |
| 107 |
| 101 void SimulateAddAccountToCookieCompleted( | 108 void SimulateAddAccountToCookieCompleted( |
| 102 GaiaCookieManagerService::Observer* observer, | 109 GaiaCookieManagerService::Observer* observer, |
| 103 const std::string& account_id, | 110 const std::string& account_id, |
| 104 const GoogleServiceAuthError& error); | 111 const GoogleServiceAuthError& error); |
| 105 | 112 |
| 106 void SimulateCookieContentSettingsChanged( | 113 void SimulateCookieContentSettingsChanged( |
| 107 content_settings::Observer* observer, | 114 content_settings::Observer* observer, |
| 108 const ContentSettingsPattern& primary_pattern); | 115 const ContentSettingsPattern& primary_pattern); |
| 109 | 116 |
| 110 GURL list_accounts_url() { return list_accounts_url_; } | 117 GURL list_accounts_url() { return list_accounts_url_; } |
| 111 GURL get_check_connection_info_url() { | 118 GURL get_check_connection_info_url() { |
| 112 return get_check_connection_info_url_; | 119 return get_check_connection_info_url_; |
| 113 } | 120 } |
| 114 | 121 |
| 115 private: | 122 private: |
| 116 content::TestBrowserThreadBundle bundle_; | 123 content::TestBrowserThreadBundle bundle_; |
| 117 TestingProfile* profile_; | 124 TestingProfile* profile_; |
| 118 FakeSigninManagerForTesting* signin_manager_; | 125 FakeSigninManagerForTesting* signin_manager_; |
| 119 FakeProfileOAuth2TokenService* token_service_; | 126 FakeProfileOAuth2TokenService* token_service_; |
| 120 TestSigninClient* test_signin_client_; | 127 TestSigninClient* test_signin_client_; |
| 128 AccountTrackerService* account_tracker_; |
| 121 MockAccountReconcilor* mock_reconcilor_; | 129 MockAccountReconcilor* mock_reconcilor_; |
| 122 net::FakeURLFetcherFactory url_fetcher_factory_; | 130 net::FakeURLFetcherFactory url_fetcher_factory_; |
| 123 scoped_ptr<TestingProfileManager> testing_profile_manager_; | 131 scoped_ptr<TestingProfileManager> testing_profile_manager_; |
| 124 base::HistogramTester histogram_tester_; | 132 base::HistogramTester histogram_tester_; |
| 125 GURL list_accounts_url_; | 133 GURL list_accounts_url_; |
| 126 GURL get_check_connection_info_url_; | 134 GURL get_check_connection_info_url_; |
| 127 | 135 |
| 128 DISALLOW_COPY_AND_ASSIGN(AccountReconcilorTest); | 136 DISALLOW_COPY_AND_ASSIGN(AccountReconcilorTest); |
| 129 }; | 137 }; |
| 130 | 138 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 factories.push_back(std::make_pair(SigninManagerFactory::GetInstance(), | 173 factories.push_back(std::make_pair(SigninManagerFactory::GetInstance(), |
| 166 FakeSigninManagerBase::Build)); | 174 FakeSigninManagerBase::Build)); |
| 167 factories.push_back(std::make_pair(AccountReconcilorFactory::GetInstance(), | 175 factories.push_back(std::make_pair(AccountReconcilorFactory::GetInstance(), |
| 168 MockAccountReconcilor::Build)); | 176 MockAccountReconcilor::Build)); |
| 169 | 177 |
| 170 profile_ = testing_profile_manager_.get()->CreateTestingProfile("name", | 178 profile_ = testing_profile_manager_.get()->CreateTestingProfile("name", |
| 171 scoped_ptr<PrefServiceSyncable>(), | 179 scoped_ptr<PrefServiceSyncable>(), |
| 172 base::UTF8ToUTF16("name"), 0, std::string(), | 180 base::UTF8ToUTF16("name"), 0, std::string(), |
| 173 factories); | 181 factories); |
| 174 | 182 |
| 175 signin_manager_ = | 183 test_signin_client_ = |
| 176 static_cast<FakeSigninManagerForTesting*>( | 184 static_cast<TestSigninClient*>( |
| 177 SigninManagerFactory::GetForProfile(profile())); | 185 ChromeSigninClientFactory::GetForProfile(profile())); |
| 178 | 186 |
| 179 token_service_ = | 187 token_service_ = |
| 180 static_cast<FakeProfileOAuth2TokenService*>( | 188 static_cast<FakeProfileOAuth2TokenService*>( |
| 181 ProfileOAuth2TokenServiceFactory::GetForProfile(profile())); | 189 ProfileOAuth2TokenServiceFactory::GetForProfile(profile())); |
| 182 | 190 |
| 183 test_signin_client_ = | 191 account_tracker_ = |
| 184 static_cast<TestSigninClient*>( | 192 AccountTrackerServiceFactory::GetForProfile(profile()); |
| 185 ChromeSigninClientFactory::GetForProfile(profile())); | 193 |
| 194 signin_manager_ = |
| 195 static_cast<FakeSigninManagerForTesting*>( |
| 196 SigninManagerFactory::GetForProfile(profile())); |
| 186 } | 197 } |
| 187 | 198 |
| 188 MockAccountReconcilor* AccountReconcilorTest::GetMockReconcilor() { | 199 MockAccountReconcilor* AccountReconcilorTest::GetMockReconcilor() { |
| 189 if (!mock_reconcilor_) { | 200 if (!mock_reconcilor_) { |
| 190 mock_reconcilor_ = | 201 mock_reconcilor_ = |
| 191 static_cast<MockAccountReconcilor*>( | 202 static_cast<MockAccountReconcilor*>( |
| 192 AccountReconcilorFactory::GetForProfile(profile())); | 203 AccountReconcilorFactory::GetForProfile(profile())); |
| 193 } | 204 } |
| 194 | 205 |
| 195 return mock_reconcilor_; | 206 return mock_reconcilor_; |
| 196 } | 207 } |
| 197 | 208 |
| 209 std::string AccountReconcilorTest::ConnectProfileToAccount( |
| 210 const std::string& gaia_id, |
| 211 const std::string& username) { |
| 212 const std::string account_id = PickAccountIdForAccount(gaia_id, username); |
| 213 #if !defined(OS_CHROMEOS) |
| 214 signin_manager()->set_password("password"); |
| 215 #endif |
| 216 signin_manager()->SetAuthenticatedAccountInfo(gaia_id, username); |
| 217 token_service()->UpdateCredentials(account_id, "refresh_token"); |
| 218 return account_id; |
| 219 } |
| 220 |
| 221 std::string AccountReconcilorTest::PickAccountIdForAccount( |
| 222 const std::string& gaia_id, |
| 223 const std::string& username) { |
| 224 return account_tracker()->PickAccountIdForAccount(gaia_id, username); |
| 225 } |
| 226 |
| 198 void AccountReconcilorTest::SimulateAddAccountToCookieCompleted( | 227 void AccountReconcilorTest::SimulateAddAccountToCookieCompleted( |
| 199 GaiaCookieManagerService::Observer* observer, | 228 GaiaCookieManagerService::Observer* observer, |
| 200 const std::string& account_id, | 229 const std::string& account_id, |
| 201 const GoogleServiceAuthError& error) { | 230 const GoogleServiceAuthError& error) { |
| 202 observer->OnAddAccountToCookieCompleted(account_id, error); | 231 observer->OnAddAccountToCookieCompleted(account_id, error); |
| 203 } | 232 } |
| 204 | 233 |
| 205 void AccountReconcilorTest::SimulateCookieContentSettingsChanged( | 234 void AccountReconcilorTest::SimulateCookieContentSettingsChanged( |
| 206 content_settings::Observer* observer, | 235 content_settings::Observer* observer, |
| 207 const ContentSettingsPattern& primary_pattern) { | 236 const ContentSettingsPattern& primary_pattern) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 223 // This method requires the use of the |TestSigninClient| to be created from the | 252 // This method requires the use of the |TestSigninClient| to be created from the |
| 224 // |ChromeSigninClientFactory| because it overrides the |GoogleSigninSucceeded| | 253 // |ChromeSigninClientFactory| because it overrides the |GoogleSigninSucceeded| |
| 225 // method with an empty implementation. On MacOS, the normal implementation | 254 // method with an empty implementation. On MacOS, the normal implementation |
| 226 // causes the try_bots to time out. | 255 // causes the try_bots to time out. |
| 227 TEST_F(AccountReconcilorTest, SigninManagerRegistration) { | 256 TEST_F(AccountReconcilorTest, SigninManagerRegistration) { |
| 228 AccountReconcilor* reconcilor = | 257 AccountReconcilor* reconcilor = |
| 229 AccountReconcilorFactory::GetForProfile(profile()); | 258 AccountReconcilorFactory::GetForProfile(profile()); |
| 230 ASSERT_TRUE(reconcilor); | 259 ASSERT_TRUE(reconcilor); |
| 231 ASSERT_FALSE(reconcilor->IsRegisteredWithTokenService()); | 260 ASSERT_FALSE(reconcilor->IsRegisteredWithTokenService()); |
| 232 | 261 |
| 233 signin_manager()->set_password("password"); | 262 account_tracker()->SeedAccountInfo("12345", "user@gmail.com"); |
| 234 signin_manager()->OnExternalSigninCompleted(kTestEmail); | 263 signin_manager()->SignIn("12345", "user@gmail.com", "password"); |
| 235 ASSERT_TRUE(reconcilor->IsRegisteredWithTokenService()); | 264 ASSERT_TRUE(reconcilor->IsRegisteredWithTokenService()); |
| 236 | 265 |
| 237 EXPECT_CALL(*GetMockReconcilor(), PerformLogoutAllAccountsAction()); | 266 EXPECT_CALL(*GetMockReconcilor(), PerformLogoutAllAccountsAction()); |
| 238 | 267 |
| 239 signin_manager()->SignOut(signin_metrics::SIGNOUT_TEST); | 268 signin_manager()->SignOut(signin_metrics::SIGNOUT_TEST); |
| 240 ASSERT_FALSE(reconcilor->IsRegisteredWithTokenService()); | 269 ASSERT_FALSE(reconcilor->IsRegisteredWithTokenService()); |
| 241 } | 270 } |
| 242 | 271 |
| 243 // This method requires the use of the |TestSigninClient| to be created from the | 272 // This method requires the use of the |TestSigninClient| to be created from the |
| 244 // |ChromeSigninClientFactory| because it overrides the |GoogleSigninSucceeded| | 273 // |ChromeSigninClientFactory| because it overrides the |GoogleSigninSucceeded| |
| 245 // method with an empty implementation. On MacOS, the normal implementation | 274 // method with an empty implementation. On MacOS, the normal implementation |
| 246 // causes the try_bots to time out. | 275 // causes the try_bots to time out. |
| 247 TEST_F(AccountReconcilorTest, Reauth) { | 276 TEST_F(AccountReconcilorTest, Reauth) { |
| 248 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 277 const std::string email = "user@gmail.com"; |
| 249 signin_manager()->set_password("password"); | 278 const std::string account_id = |
| 279 ConnectProfileToAccount("12345", email); |
| 250 | 280 |
| 251 AccountReconcilor* reconcilor = | 281 AccountReconcilor* reconcilor = |
| 252 AccountReconcilorFactory::GetForProfile(profile()); | 282 AccountReconcilorFactory::GetForProfile(profile()); |
| 253 ASSERT_TRUE(reconcilor); | 283 ASSERT_TRUE(reconcilor); |
| 254 ASSERT_TRUE(reconcilor->IsRegisteredWithTokenService()); | 284 ASSERT_TRUE(reconcilor->IsRegisteredWithTokenService()); |
| 255 | 285 |
| 256 // Simulate reauth. The state of the reconcilor should not change. | 286 // Simulate reauth. The state of the reconcilor should not change. |
| 257 signin_manager()->OnExternalSigninCompleted(kTestEmail); | 287 signin_manager()->OnExternalSigninCompleted(email); |
| 258 ASSERT_TRUE(reconcilor->IsRegisteredWithTokenService()); | 288 ASSERT_TRUE(reconcilor->IsRegisteredWithTokenService()); |
| 259 } | 289 } |
| 260 | 290 |
| 261 #endif // !defined(OS_CHROMEOS) | 291 #endif // !defined(OS_CHROMEOS) |
| 262 | 292 |
| 263 TEST_F(AccountReconcilorTest, ProfileAlreadyConnected) { | 293 TEST_F(AccountReconcilorTest, ProfileAlreadyConnected) { |
| 264 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 294 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 265 | 295 |
| 266 AccountReconcilor* reconcilor = | 296 AccountReconcilor* reconcilor = |
| 267 AccountReconcilorFactory::GetForProfile(profile()); | 297 AccountReconcilorFactory::GetForProfile(profile()); |
| 268 ASSERT_TRUE(reconcilor); | 298 ASSERT_TRUE(reconcilor); |
| 269 ASSERT_TRUE(reconcilor->IsRegisteredWithTokenService()); | 299 ASSERT_TRUE(reconcilor->IsRegisteredWithTokenService()); |
| 270 } | 300 } |
| 271 | 301 |
| 272 TEST_F(AccountReconcilorTest, GetAccountsFromCookieSuccess) { | 302 TEST_F(AccountReconcilorTest, GetAccountsFromCookieSuccess) { |
| 273 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 303 const std::string account_id = |
| 274 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 304 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 275 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(kTestEmail)); | 305 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(account_id)); |
| 306 |
| 276 AccountReconcilor* reconcilor = | 307 AccountReconcilor* reconcilor = |
| 277 AccountReconcilorFactory::GetForProfile(profile()); | 308 AccountReconcilorFactory::GetForProfile(profile()); |
| 278 ASSERT_TRUE(reconcilor); | 309 ASSERT_TRUE(reconcilor); |
| 279 | 310 |
| 280 SetFakeResponse(list_accounts_url().spec(), | 311 SetFakeResponse(list_accounts_url().spec(), |
| 281 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0]]]", | 312 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0]]]", |
| 282 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 313 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 283 | 314 |
| 284 reconcilor->StartReconcile(); | 315 reconcilor->StartReconcile(); |
| 285 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | 316 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| 286 | 317 |
| 287 base::RunLoop().RunUntilIdle(); | 318 base::RunLoop().RunUntilIdle(); |
| 288 ASSERT_TRUE(reconcilor->AreGaiaAccountsSet()); | 319 ASSERT_TRUE(reconcilor->AreGaiaAccountsSet()); |
| 289 const std::vector<std::pair<std::string, bool> >& accounts = | 320 const std::vector<std::pair<std::string, bool> >& accounts = |
| 290 reconcilor->GetGaiaAccountsForTesting(); | 321 reconcilor->GetGaiaAccountsForTesting(); |
| 291 ASSERT_EQ(1u, accounts.size()); | 322 ASSERT_EQ(1u, accounts.size()); |
| 292 ASSERT_EQ("user@gmail.com", accounts[0].first); | 323 ASSERT_EQ(account_id, accounts[0].first); |
| 293 } | 324 } |
| 294 | 325 |
| 295 TEST_F(AccountReconcilorTest, GetAccountsFromCookieFailure) { | 326 TEST_F(AccountReconcilorTest, GetAccountsFromCookieFailure) { |
| 296 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 327 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 297 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | |
| 298 AccountReconcilor* reconcilor = | 328 AccountReconcilor* reconcilor = |
| 299 AccountReconcilorFactory::GetForProfile(profile()); | 329 AccountReconcilorFactory::GetForProfile(profile()); |
| 300 ASSERT_TRUE(reconcilor); | 330 ASSERT_TRUE(reconcilor); |
| 301 | 331 |
| 302 SetFakeResponse(list_accounts_url().spec(), "", | 332 SetFakeResponse(list_accounts_url().spec(), "", |
| 303 net::HTTP_NOT_FOUND, net::URLRequestStatus::SUCCESS); | 333 net::HTTP_NOT_FOUND, net::URLRequestStatus::SUCCESS); |
| 304 | 334 |
| 305 reconcilor->StartReconcile(); | 335 reconcilor->StartReconcile(); |
| 306 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | 336 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| 307 | 337 |
| 308 base::RunLoop().RunUntilIdle(); | 338 base::RunLoop().RunUntilIdle(); |
| 309 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | 339 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| 310 } | 340 } |
| 311 | 341 |
| 312 TEST_P(AccountReconcilorTest, StartReconcileNoop) { | 342 TEST_P(AccountReconcilorTest, StartReconcileNoop) { |
| 313 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 343 const std::string account_id = |
| 314 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 344 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 315 | 345 |
| 316 AccountReconcilor* reconcilor = | 346 AccountReconcilor* reconcilor = |
| 317 AccountReconcilorFactory::GetForProfile(profile()); | 347 AccountReconcilorFactory::GetForProfile(profile()); |
| 318 ASSERT_TRUE(reconcilor); | 348 ASSERT_TRUE(reconcilor); |
| 319 | 349 |
| 320 SetFakeResponse(list_accounts_url().spec(), | 350 SetFakeResponse(list_accounts_url().spec(), |
| 321 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 351 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 322 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 352 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 323 | 353 |
| 324 reconcilor->StartReconcile(); | 354 reconcilor->StartReconcile(); |
| 325 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 355 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 326 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | 356 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| 327 | 357 |
| 328 base::RunLoop().RunUntilIdle(); | 358 base::RunLoop().RunUntilIdle(); |
| 329 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 359 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 330 | 360 |
| 331 histogram_tester()->ExpectTotalCount( | 361 histogram_tester()->ExpectTotalCount( |
| 332 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); | 362 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); |
| 333 histogram_tester()->ExpectUniqueSample( | 363 histogram_tester()->ExpectUniqueSample( |
| 334 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | 364 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 335 signin_metrics::ACCOUNTS_SAME, | 365 signin_metrics::ACCOUNTS_SAME, |
| 336 1); | 366 1); |
| 337 } | 367 } |
| 338 | 368 |
| 339 TEST_P(AccountReconcilorTest, StartReconcileCookiesDisabled) { | 369 TEST_P(AccountReconcilorTest, StartReconcileCookiesDisabled) { |
| 340 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 370 const std::string account_id = |
| 341 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 371 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 372 token_service()->UpdateCredentials(account_id, "refresh_token"); |
| 342 test_signin_client()->set_are_signin_cookies_allowed(false); | 373 test_signin_client()->set_are_signin_cookies_allowed(false); |
| 343 | 374 |
| 344 AccountReconcilor* reconcilor = | 375 AccountReconcilor* reconcilor = |
| 345 AccountReconcilorFactory::GetForProfile(profile()); | 376 AccountReconcilorFactory::GetForProfile(profile()); |
| 346 ASSERT_TRUE(reconcilor); | 377 ASSERT_TRUE(reconcilor); |
| 347 | 378 |
| 348 reconcilor->StartReconcile(); | 379 reconcilor->StartReconcile(); |
| 349 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 380 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 350 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | 381 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| 351 | 382 |
| 352 base::RunLoop().RunUntilIdle(); | 383 base::RunLoop().RunUntilIdle(); |
| 353 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 384 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 354 } | 385 } |
| 355 | 386 |
| 356 TEST_P(AccountReconcilorTest, StartReconcileContentSettings) { | 387 TEST_P(AccountReconcilorTest, StartReconcileContentSettings) { |
| 357 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 388 const std::string account_id = |
| 358 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 389 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 390 token_service()->UpdateCredentials(account_id, "refresh_token"); |
| 359 | 391 |
| 360 AccountReconcilor* reconcilor = | 392 AccountReconcilor* reconcilor = |
| 361 AccountReconcilorFactory::GetForProfile(profile()); | 393 AccountReconcilorFactory::GetForProfile(profile()); |
| 362 ASSERT_TRUE(reconcilor); | 394 ASSERT_TRUE(reconcilor); |
| 363 | 395 |
| 364 test_signin_client()->set_are_signin_cookies_allowed(false); | 396 test_signin_client()->set_are_signin_cookies_allowed(false); |
| 365 SimulateCookieContentSettingsChanged(reconcilor, | 397 SimulateCookieContentSettingsChanged(reconcilor, |
| 366 ContentSettingsPattern::Wildcard()); | 398 ContentSettingsPattern::Wildcard()); |
| 367 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 399 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 368 | 400 |
| 369 test_signin_client()->set_are_signin_cookies_allowed(true); | 401 test_signin_client()->set_are_signin_cookies_allowed(true); |
| 370 SimulateCookieContentSettingsChanged(reconcilor, | 402 SimulateCookieContentSettingsChanged(reconcilor, |
| 371 ContentSettingsPattern::Wildcard()); | 403 ContentSettingsPattern::Wildcard()); |
| 372 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 404 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 373 } | 405 } |
| 374 | 406 |
| 375 TEST_P(AccountReconcilorTest, StartReconcileContentSettingsGaiaUrl) { | 407 TEST_P(AccountReconcilorTest, StartReconcileContentSettingsGaiaUrl) { |
| 376 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 408 const std::string account_id = |
| 377 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 409 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 410 token_service()->UpdateCredentials(account_id, "refresh_token"); |
| 378 | 411 |
| 379 AccountReconcilor* reconcilor = | 412 AccountReconcilor* reconcilor = |
| 380 AccountReconcilorFactory::GetForProfile(profile()); | 413 AccountReconcilorFactory::GetForProfile(profile()); |
| 381 ASSERT_TRUE(reconcilor); | 414 ASSERT_TRUE(reconcilor); |
| 382 | 415 |
| 383 SimulateCookieContentSettingsChanged( | 416 SimulateCookieContentSettingsChanged( |
| 384 reconcilor, | 417 reconcilor, |
| 385 ContentSettingsPattern::FromURL(GaiaUrls::GetInstance()->gaia_url())); | 418 ContentSettingsPattern::FromURL(GaiaUrls::GetInstance()->gaia_url())); |
| 386 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 419 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 387 } | 420 } |
| 388 | 421 |
| 389 TEST_P(AccountReconcilorTest, StartReconcileContentSettingsNonGaiaUrl) { | 422 TEST_P(AccountReconcilorTest, StartReconcileContentSettingsNonGaiaUrl) { |
| 390 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 423 const std::string account_id = |
| 391 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 424 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 425 token_service()->UpdateCredentials(account_id, "refresh_token"); |
| 392 | 426 |
| 393 AccountReconcilor* reconcilor = | 427 AccountReconcilor* reconcilor = |
| 394 AccountReconcilorFactory::GetForProfile(profile()); | 428 AccountReconcilorFactory::GetForProfile(profile()); |
| 395 ASSERT_TRUE(reconcilor); | 429 ASSERT_TRUE(reconcilor); |
| 396 | 430 |
| 397 SimulateCookieContentSettingsChanged( | 431 SimulateCookieContentSettingsChanged( |
| 398 reconcilor, | 432 reconcilor, |
| 399 ContentSettingsPattern::FromURL(GURL("http://www.example.com"))); | 433 ContentSettingsPattern::FromURL(GURL("http://www.example.com"))); |
| 400 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 434 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 401 } | 435 } |
| 402 | 436 |
| 403 TEST_P(AccountReconcilorTest, StartReconcileContentSettingsInvalidPattern) { | 437 TEST_P(AccountReconcilorTest, StartReconcileContentSettingsInvalidPattern) { |
| 404 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 438 const std::string account_id = |
| 405 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 439 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 440 token_service()->UpdateCredentials(account_id, "refresh_token"); |
| 406 | 441 |
| 407 AccountReconcilor* reconcilor = | 442 AccountReconcilor* reconcilor = |
| 408 AccountReconcilorFactory::GetForProfile(profile()); | 443 AccountReconcilorFactory::GetForProfile(profile()); |
| 409 ASSERT_TRUE(reconcilor); | 444 ASSERT_TRUE(reconcilor); |
| 410 | 445 |
| 411 scoped_ptr<ContentSettingsPattern::BuilderInterface> | 446 scoped_ptr<ContentSettingsPattern::BuilderInterface> |
| 412 builder(ContentSettingsPattern::CreateBuilder(false)); | 447 builder(ContentSettingsPattern::CreateBuilder(false)); |
| 413 builder->Invalid(); | 448 builder->Invalid(); |
| 414 | 449 |
| 415 SimulateCookieContentSettingsChanged(reconcilor, builder->Build()); | 450 SimulateCookieContentSettingsChanged(reconcilor, builder->Build()); |
| 416 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 451 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 417 } | 452 } |
| 418 | 453 |
| 419 // This is test is needed until chrome changes to use gaia obfuscated id. | 454 // This test is needed until chrome changes to use gaia obfuscated id. |
| 420 // The signin manager and token service use the gaia "email" property, which | 455 // The signin manager and token service use the gaia "email" property, which |
| 421 // preserves dots in usernames and preserves case. gaia::ParseListAccountsData() | 456 // preserves dots in usernames and preserves case. gaia::ParseListAccountsData() |
| 422 // however uses gaia "displayEmail" which does not preserve case, and then | 457 // however uses gaia "displayEmail" which does not preserve case, and then |
| 423 // passes the string through gaia::CanonicalizeEmail() which removes dots. This | 458 // passes the string through gaia::CanonicalizeEmail() which removes dots. This |
| 424 // tests makes sure that an email like "Dot.S@hmail.com", as seen by the | 459 // tests makes sure that an email like "Dot.S@hmail.com", as seen by the |
| 425 // token service, will be considered the same as "dots@gmail.com" as returned | 460 // token service, will be considered the same as "dots@gmail.com" as returned |
| 426 // by gaia::ParseListAccountsData(). | 461 // by gaia::ParseListAccountsData(). |
| 427 TEST_P(AccountReconcilorTest, StartReconcileNoopWithDots) { | 462 TEST_P(AccountReconcilorTest, StartReconcileNoopWithDots) { |
| 428 signin_manager()->SetAuthenticatedUsername("Dot.S@gmail.com"); | 463 if (account_tracker()->GetMigrationState() != |
| 429 token_service()->UpdateCredentials("Dot.S@gmail.com", "refresh_token"); | 464 AccountTrackerService::MIGRATION_NOT_STARTED) { |
| 465 return; |
| 466 } |
| 430 | 467 |
| 468 const std::string account_id = |
| 469 ConnectProfileToAccount("12345", "Dot.S@gmail.com"); |
| 431 AccountReconcilor* reconcilor = | 470 AccountReconcilor* reconcilor = |
| 432 AccountReconcilorFactory::GetForProfile(profile()); | 471 AccountReconcilorFactory::GetForProfile(profile()); |
| 433 ASSERT_TRUE(reconcilor); | 472 ASSERT_TRUE(reconcilor); |
| 434 | 473 |
| 435 SetFakeResponse(list_accounts_url().spec(), | 474 SetFakeResponse(list_accounts_url().spec(), |
| 436 "[\"f\", [[\"b\", 0, \"n\", \"dot.s@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 475 "[\"f\", [[\"b\", 0, \"n\", \"dot.s@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 437 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 476 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 438 | 477 |
| 439 reconcilor->StartReconcile(); | 478 reconcilor->StartReconcile(); |
| 440 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | 479 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| 441 | 480 |
| 442 base::RunLoop().RunUntilIdle(); | 481 base::RunLoop().RunUntilIdle(); |
| 443 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 482 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 444 | 483 |
| 445 histogram_tester()->ExpectUniqueSample( | 484 histogram_tester()->ExpectUniqueSample( |
| 446 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | 485 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 447 signin_metrics::ACCOUNTS_SAME, | 486 signin_metrics::ACCOUNTS_SAME, |
| 448 1); | 487 1); |
| 449 } | 488 } |
| 450 | 489 |
| 451 TEST_P(AccountReconcilorTest, StartReconcileNoopMultiple) { | 490 TEST_P(AccountReconcilorTest, StartReconcileNoopMultiple) { |
| 452 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 491 const std::string account_id = |
| 453 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 492 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 454 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 493 const std::string account_id2 = |
| 494 PickAccountIdForAccount("67890", "other@gmail.com"); |
| 495 token_service()->UpdateCredentials(account_id2, "refresh_token"); |
| 455 | 496 |
| 456 AccountReconcilor* reconcilor = | 497 AccountReconcilor* reconcilor = |
| 457 AccountReconcilorFactory::GetForProfile(profile()); | 498 AccountReconcilorFactory::GetForProfile(profile()); |
| 458 ASSERT_TRUE(reconcilor); | 499 ASSERT_TRUE(reconcilor); |
| 459 | 500 |
| 460 SetFakeResponse(list_accounts_url().spec(), | 501 SetFakeResponse(list_accounts_url().spec(), |
| 461 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " | 502 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " |
| 462 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 503 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 463 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 504 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 464 | 505 |
| 465 reconcilor->StartReconcile(); | 506 reconcilor->StartReconcile(); |
| 466 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | 507 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
| 467 base::RunLoop().RunUntilIdle(); | 508 base::RunLoop().RunUntilIdle(); |
| 468 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 509 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 469 | 510 |
| 470 histogram_tester()->ExpectTotalCount( | 511 histogram_tester()->ExpectTotalCount( |
| 471 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); | 512 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); |
| 472 histogram_tester()->ExpectUniqueSample( | 513 histogram_tester()->ExpectUniqueSample( |
| 473 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | 514 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 474 signin_metrics::ACCOUNTS_SAME, | 515 signin_metrics::ACCOUNTS_SAME, |
| 475 1); | 516 1); |
| 476 } | 517 } |
| 477 | 518 |
| 478 TEST_P(AccountReconcilorTest, StartReconcileAddToCookie) { | 519 TEST_P(AccountReconcilorTest, StartReconcileAddToCookie) { |
| 479 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 520 const std::string account_id = |
| 480 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 521 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 481 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 522 token_service()->UpdateCredentials(account_id, "refresh_token"); |
| 482 | 523 |
| 483 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("other@gmail.com")); | 524 const std::string account_id2 = |
| 525 PickAccountIdForAccount("67890", "other@gmail.com"); |
| 526 token_service()->UpdateCredentials(account_id2, "refresh_token"); |
| 527 |
| 528 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(account_id2)); |
| 484 | 529 |
| 485 SetFakeResponse(list_accounts_url().spec(), | 530 SetFakeResponse(list_accounts_url().spec(), |
| 486 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 531 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 487 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 532 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 488 | 533 |
| 489 AccountReconcilor* reconcilor = GetMockReconcilor(); | 534 AccountReconcilor* reconcilor = GetMockReconcilor(); |
| 490 reconcilor->StartReconcile(); | 535 reconcilor->StartReconcile(); |
| 491 | 536 |
| 492 base::RunLoop().RunUntilIdle(); | 537 base::RunLoop().RunUntilIdle(); |
| 493 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 538 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 494 SimulateAddAccountToCookieCompleted(reconcilor, "other@gmail.com", | 539 SimulateAddAccountToCookieCompleted(reconcilor, account_id2, |
| 495 GoogleServiceAuthError::AuthErrorNone()); | 540 GoogleServiceAuthError::AuthErrorNone()); |
| 496 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 541 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 497 | 542 |
| 498 histogram_tester()->ExpectUniqueSample( | 543 histogram_tester()->ExpectUniqueSample( |
| 499 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | 544 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 500 signin_metrics::ACCOUNTS_SAME, | 545 signin_metrics::ACCOUNTS_SAME, |
| 501 1); | 546 1); |
| 502 histogram_tester()->ExpectUniqueSample( | 547 histogram_tester()->ExpectUniqueSample( |
| 503 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); | 548 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); |
| 504 histogram_tester()->ExpectUniqueSample( | 549 histogram_tester()->ExpectUniqueSample( |
| 505 "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1); | 550 "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1); |
| 506 } | 551 } |
| 507 | 552 |
| 508 TEST_P(AccountReconcilorTest, StartReconcileRemoveFromCookie) { | 553 TEST_P(AccountReconcilorTest, StartReconcileRemoveFromCookie) { |
| 509 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 554 const std::string account_id = |
| 510 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 555 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 556 token_service()->UpdateCredentials(account_id, "refresh_token"); |
| 511 | 557 |
| 512 EXPECT_CALL(*GetMockReconcilor(), PerformLogoutAllAccountsAction()); | 558 EXPECT_CALL(*GetMockReconcilor(), PerformLogoutAllAccountsAction()); |
| 513 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("user@gmail.com")); | 559 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(account_id)); |
| 514 | 560 |
| 515 SetFakeResponse(list_accounts_url().spec(), | 561 SetFakeResponse(list_accounts_url().spec(), |
| 516 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " | 562 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " |
| 517 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 563 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 518 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 564 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 519 | 565 |
| 520 AccountReconcilor* reconcilor = GetMockReconcilor(); | 566 AccountReconcilor* reconcilor = GetMockReconcilor(); |
| 521 reconcilor->StartReconcile(); | 567 reconcilor->StartReconcile(); |
| 522 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 568 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 523 | 569 |
| 524 base::RunLoop().RunUntilIdle(); | 570 base::RunLoop().RunUntilIdle(); |
| 525 SimulateAddAccountToCookieCompleted(reconcilor, "user@gmail.com", | 571 SimulateAddAccountToCookieCompleted(reconcilor, "user@gmail.com", |
| 526 GoogleServiceAuthError::AuthErrorNone()); | 572 GoogleServiceAuthError::AuthErrorNone()); |
| 527 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 573 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 528 | 574 |
| 529 histogram_tester()->ExpectUniqueSample( | 575 histogram_tester()->ExpectUniqueSample( |
| 530 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | 576 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 531 signin_metrics::ACCOUNTS_SAME, | 577 signin_metrics::ACCOUNTS_SAME, |
| 532 1); | 578 1); |
| 533 histogram_tester()->ExpectUniqueSample( | 579 histogram_tester()->ExpectUniqueSample( |
| 534 "Signin.Reconciler.AddedToCookieJar.FirstRun", 0, 1); | 580 "Signin.Reconciler.AddedToCookieJar.FirstRun", 0, 1); |
| 535 histogram_tester()->ExpectUniqueSample( | 581 histogram_tester()->ExpectUniqueSample( |
| 536 "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 1, 1); | 582 "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 1, 1); |
| 537 } | 583 } |
| 538 | 584 |
| 539 TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) { | 585 TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) { |
| 540 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 586 const std::string account_id = |
| 541 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 587 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 542 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 588 const std::string account_id2 = |
| 589 PickAccountIdForAccount("67890", "other@gmail.com"); |
| 590 const std::string account_id3 = |
| 591 PickAccountIdForAccount("34567", "third@gmail.com"); |
| 543 | 592 |
| 544 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("other@gmail.com")); | 593 token_service()->UpdateCredentials(account_id2, "refresh_token"); |
| 545 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("third@gmail.com")); | 594 |
| 595 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(account_id2)); |
| 596 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(account_id3)); |
| 546 | 597 |
| 547 SetFakeResponse( | 598 SetFakeResponse( |
| 548 list_accounts_url().spec(), | 599 list_accounts_url().spec(), |
| 549 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 600 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 550 net::HTTP_OK, | 601 net::HTTP_OK, |
| 551 net::URLRequestStatus::SUCCESS); | 602 net::URLRequestStatus::SUCCESS); |
| 552 | 603 |
| 553 AccountReconcilor* reconcilor = GetMockReconcilor(); | 604 AccountReconcilor* reconcilor = GetMockReconcilor(); |
| 554 reconcilor->StartReconcile(); | 605 reconcilor->StartReconcile(); |
| 555 | 606 |
| 556 base::RunLoop().RunUntilIdle(); | 607 base::RunLoop().RunUntilIdle(); |
| 557 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 608 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 558 SimulateAddAccountToCookieCompleted( | 609 SimulateAddAccountToCookieCompleted( |
| 559 reconcilor, "other@gmail.com", GoogleServiceAuthError::AuthErrorNone()); | 610 reconcilor, account_id2, GoogleServiceAuthError::AuthErrorNone()); |
| 560 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 611 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 561 | 612 |
| 562 histogram_tester()->ExpectUniqueSample( | 613 histogram_tester()->ExpectUniqueSample( |
| 563 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | 614 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 564 signin_metrics::ACCOUNTS_SAME, | 615 signin_metrics::ACCOUNTS_SAME, |
| 565 1); | 616 1); |
| 566 histogram_tester()->ExpectUniqueSample( | 617 histogram_tester()->ExpectUniqueSample( |
| 567 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); | 618 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); |
| 568 histogram_tester()->ExpectUniqueSample( | 619 histogram_tester()->ExpectUniqueSample( |
| 569 "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1); | 620 "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1); |
| 570 | 621 |
| 571 // Do another pass after I've added a third account to the token service | 622 // Do another pass after I've added a third account to the token service |
| 572 | 623 |
| 573 SetFakeResponse( | 624 SetFakeResponse( |
| 574 list_accounts_url().spec(), | 625 list_accounts_url().spec(), |
| 575 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " | 626 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " |
| 576 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 627 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 577 net::HTTP_OK, | 628 net::HTTP_OK, |
| 578 net::URLRequestStatus::SUCCESS); | 629 net::URLRequestStatus::SUCCESS); |
| 579 // This will cause the reconcilor to fire. | 630 // This will cause the reconcilor to fire. |
| 580 token_service()->UpdateCredentials("third@gmail.com", "refresh_token"); | 631 token_service()->UpdateCredentials(account_id3, "refresh_token"); |
| 581 | |
| 582 base::RunLoop().RunUntilIdle(); | 632 base::RunLoop().RunUntilIdle(); |
| 583 | 633 |
| 584 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 634 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 585 SimulateAddAccountToCookieCompleted( | 635 SimulateAddAccountToCookieCompleted( |
| 586 reconcilor, "third@gmail.com", GoogleServiceAuthError::AuthErrorNone()); | 636 reconcilor, account_id3, GoogleServiceAuthError::AuthErrorNone()); |
| 587 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 637 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 588 | 638 |
| 589 histogram_tester()->ExpectUniqueSample( | 639 histogram_tester()->ExpectUniqueSample( |
| 590 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | 640 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 591 signin_metrics::ACCOUNTS_SAME, | 641 signin_metrics::ACCOUNTS_SAME, |
| 592 1); | 642 1); |
| 593 histogram_tester()->ExpectUniqueSample( | 643 histogram_tester()->ExpectUniqueSample( |
| 594 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); | 644 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); |
| 595 histogram_tester()->ExpectUniqueSample( | 645 histogram_tester()->ExpectUniqueSample( |
| 596 "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1); | 646 "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1); |
| 597 histogram_tester()->ExpectUniqueSample( | 647 histogram_tester()->ExpectUniqueSample( |
| 598 "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun", | 648 "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun", |
| 599 signin_metrics::ACCOUNTS_SAME, | 649 signin_metrics::ACCOUNTS_SAME, |
| 600 1); | 650 1); |
| 601 histogram_tester()->ExpectUniqueSample( | 651 histogram_tester()->ExpectUniqueSample( |
| 602 "Signin.Reconciler.AddedToCookieJar.SubsequentRun", 1, 1); | 652 "Signin.Reconciler.AddedToCookieJar.SubsequentRun", 1, 1); |
| 603 histogram_tester()->ExpectUniqueSample( | 653 histogram_tester()->ExpectUniqueSample( |
| 604 "Signin.Reconciler.RemovedFromCookieJar.SubsequentRun", 0, 1); | 654 "Signin.Reconciler.RemovedFromCookieJar.SubsequentRun", 0, 1); |
| 605 } | 655 } |
| 606 | 656 |
| 607 TEST_P(AccountReconcilorTest, StartReconcileBadPrimary) { | 657 TEST_P(AccountReconcilorTest, StartReconcileBadPrimary) { |
| 608 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 658 const std::string account_id = |
| 609 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 659 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 610 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 660 const std::string account_id2 = |
| 661 PickAccountIdForAccount("67890", "other@gmail.com"); |
| 662 |
| 663 token_service()->UpdateCredentials(account_id2, "refresh_token"); |
| 611 | 664 |
| 612 EXPECT_CALL(*GetMockReconcilor(), PerformLogoutAllAccountsAction()); | 665 EXPECT_CALL(*GetMockReconcilor(), PerformLogoutAllAccountsAction()); |
| 613 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("user@gmail.com")); | 666 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(account_id)); |
| 614 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("other@gmail.com")); | 667 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(account_id2)); |
| 615 | 668 |
| 616 SetFakeResponse(list_accounts_url().spec(), | 669 SetFakeResponse(list_accounts_url().spec(), |
| 617 "[\"f\", [[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1], " | 670 "[\"f\", [[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1], " |
| 618 "[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 671 "[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 619 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 672 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 620 | 673 |
| 621 AccountReconcilor* reconcilor = GetMockReconcilor(); | 674 AccountReconcilor* reconcilor = GetMockReconcilor(); |
| 622 reconcilor->StartReconcile(); | 675 reconcilor->StartReconcile(); |
| 623 | 676 |
| 624 base::RunLoop().RunUntilIdle(); | 677 base::RunLoop().RunUntilIdle(); |
| 625 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 678 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 626 SimulateAddAccountToCookieCompleted(reconcilor, "other@gmail.com", | 679 SimulateAddAccountToCookieCompleted(reconcilor, account_id2, |
| 627 GoogleServiceAuthError::AuthErrorNone()); | 680 GoogleServiceAuthError::AuthErrorNone()); |
| 628 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 681 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 629 SimulateAddAccountToCookieCompleted(reconcilor, "user@gmail.com", | 682 SimulateAddAccountToCookieCompleted(reconcilor, account_id, |
| 630 GoogleServiceAuthError::AuthErrorNone()); | 683 GoogleServiceAuthError::AuthErrorNone()); |
| 631 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 684 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 632 | 685 |
| 633 histogram_tester()->ExpectUniqueSample( | 686 histogram_tester()->ExpectUniqueSample( |
| 634 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | 687 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 635 signin_metrics::COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT, | 688 signin_metrics::COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT, |
| 636 1); | 689 1); |
| 637 histogram_tester()->ExpectUniqueSample( | 690 histogram_tester()->ExpectUniqueSample( |
| 638 "Signin.Reconciler.AddedToCookieJar.FirstRun", 0, 1); | 691 "Signin.Reconciler.AddedToCookieJar.FirstRun", 0, 1); |
| 639 histogram_tester()->ExpectUniqueSample( | 692 histogram_tester()->ExpectUniqueSample( |
| 640 "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1); | 693 "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1); |
| 641 } | 694 } |
| 642 | 695 |
| 643 TEST_P(AccountReconcilorTest, StartReconcileOnlyOnce) { | 696 TEST_P(AccountReconcilorTest, StartReconcileOnlyOnce) { |
| 644 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 697 const std::string account_id = |
| 645 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 698 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 646 | 699 |
| 647 AccountReconcilor* reconcilor = | 700 AccountReconcilor* reconcilor = |
| 648 AccountReconcilorFactory::GetForProfile(profile()); | 701 AccountReconcilorFactory::GetForProfile(profile()); |
| 649 ASSERT_TRUE(reconcilor); | 702 ASSERT_TRUE(reconcilor); |
| 650 | 703 |
| 651 SetFakeResponse(list_accounts_url().spec(), | 704 SetFakeResponse(list_accounts_url().spec(), |
| 652 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 705 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 653 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 706 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 654 | 707 |
| 655 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 708 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 656 reconcilor->StartReconcile(); | 709 reconcilor->StartReconcile(); |
| 657 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 710 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 658 | 711 |
| 659 base::RunLoop().RunUntilIdle(); | 712 base::RunLoop().RunUntilIdle(); |
| 660 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 713 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 661 } | 714 } |
| 662 | 715 |
| 663 TEST_P(AccountReconcilorTest, StartReconcileWithSessionInfoExpiredDefault) { | 716 TEST_P(AccountReconcilorTest, StartReconcileWithSessionInfoExpiredDefault) { |
| 664 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 717 const std::string account_id = |
| 665 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 718 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 666 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 719 const std::string account_id2 = |
| 720 PickAccountIdForAccount("67890", "other@gmail.com"); |
| 721 token_service()->UpdateCredentials(account_id2, "refresh_token"); |
| 667 | 722 |
| 668 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("user@gmail.com")); | 723 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(account_id)); |
| 669 | 724 |
| 670 SetFakeResponse(list_accounts_url().spec(), | 725 SetFakeResponse(list_accounts_url().spec(), |
| 671 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0]," | 726 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0]," |
| 672 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 727 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 673 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 728 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 674 | 729 |
| 675 AccountReconcilor* reconcilor = | 730 AccountReconcilor* reconcilor = |
| 676 AccountReconcilorFactory::GetForProfile(profile()); | 731 AccountReconcilorFactory::GetForProfile(profile()); |
| 677 ASSERT_TRUE(reconcilor); | 732 ASSERT_TRUE(reconcilor); |
| 678 | 733 |
| 679 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 734 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 680 reconcilor->StartReconcile(); | 735 reconcilor->StartReconcile(); |
| 681 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 736 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 682 | 737 |
| 683 base::RunLoop().RunUntilIdle(); | 738 base::RunLoop().RunUntilIdle(); |
| 684 SimulateAddAccountToCookieCompleted(reconcilor, "user@gmail.com", | 739 SimulateAddAccountToCookieCompleted(reconcilor, account_id, |
| 685 GoogleServiceAuthError::AuthErrorNone()); | 740 GoogleServiceAuthError::AuthErrorNone()); |
| 686 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 741 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 687 } | 742 } |
| 688 | 743 |
| 689 TEST_F(AccountReconcilorTest, AddAccountToCookieCompletedWithBogusAccount) { | 744 TEST_F(AccountReconcilorTest, AddAccountToCookieCompletedWithBogusAccount) { |
| 690 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 745 const std::string account_id = |
| 691 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 746 ConnectProfileToAccount("12345", "user@gmail.com"); |
| 692 | 747 |
| 693 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("user@gmail.com")); | 748 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(account_id)); |
| 694 | 749 |
| 695 SetFakeResponse(list_accounts_url().spec(), | 750 SetFakeResponse(list_accounts_url().spec(), |
| 696 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0]]]", | 751 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0]]]", |
| 697 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 752 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 698 | 753 |
| 699 AccountReconcilor* reconcilor = | 754 AccountReconcilor* reconcilor = |
| 700 AccountReconcilorFactory::GetForProfile(profile()); | 755 AccountReconcilorFactory::GetForProfile(profile()); |
| 701 ASSERT_TRUE(reconcilor); | 756 ASSERT_TRUE(reconcilor); |
| 702 | 757 |
| 703 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 758 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 704 reconcilor->StartReconcile(); | 759 reconcilor->StartReconcile(); |
| 705 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 760 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 706 | 761 |
| 707 base::RunLoop().RunUntilIdle(); | 762 base::RunLoop().RunUntilIdle(); |
| 708 | 763 |
| 709 // If an unknown account id is sent, it should not upset the state. | 764 // If an unknown account id is sent, it should not upset the state. |
| 710 SimulateAddAccountToCookieCompleted(reconcilor, "bogus@gmail.com", | 765 SimulateAddAccountToCookieCompleted(reconcilor, "bogus_account_id", |
| 711 GoogleServiceAuthError::AuthErrorNone()); | 766 GoogleServiceAuthError::AuthErrorNone()); |
| 712 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 767 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 713 | 768 |
| 714 SimulateAddAccountToCookieCompleted(reconcilor, "user@gmail.com", | 769 SimulateAddAccountToCookieCompleted(reconcilor, account_id, |
| 715 GoogleServiceAuthError::AuthErrorNone()); | 770 GoogleServiceAuthError::AuthErrorNone()); |
| 716 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 771 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 717 } | 772 } |
| 718 | 773 |
| 719 INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled, | 774 INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled, |
| 720 AccountReconcilorTest, | 775 AccountReconcilorTest, |
| 721 testing::Bool()); | 776 testing::Bool()); |
| OLD | NEW |