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