Chromium Code Reviews| 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" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 GaiaCookieManagerService* cookie_manager_service() { | |
| 91 return cookie_manager_service_; | |
| 92 } | |
| 90 base::HistogramTester* histogram_tester() { return &histogram_tester_; } | 93 base::HistogramTester* histogram_tester() { return &histogram_tester_; } |
| 91 | 94 |
| 92 void SetFakeResponse(const std::string& url, | 95 void SetFakeResponse(const std::string& url, |
| 93 const std::string& data, | 96 const std::string& data, |
| 94 net::HttpStatusCode code, | 97 net::HttpStatusCode code, |
| 95 net::URLRequestStatus::Status status) { | 98 net::URLRequestStatus::Status status) { |
| 96 url_fetcher_factory_.SetFakeResponse(GURL(url), data, code, status); | 99 url_fetcher_factory_.SetFakeResponse(GURL(url), data, code, status); |
| 97 } | 100 } |
| 98 | 101 |
| 99 MockAccountReconcilor* GetMockReconcilor(); | 102 MockAccountReconcilor* GetMockReconcilor(); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 111 GURL get_check_connection_info_url() { | 114 GURL get_check_connection_info_url() { |
| 112 return get_check_connection_info_url_; | 115 return get_check_connection_info_url_; |
| 113 } | 116 } |
| 114 | 117 |
| 115 private: | 118 private: |
| 116 content::TestBrowserThreadBundle bundle_; | 119 content::TestBrowserThreadBundle bundle_; |
| 117 TestingProfile* profile_; | 120 TestingProfile* profile_; |
| 118 FakeSigninManagerForTesting* signin_manager_; | 121 FakeSigninManagerForTesting* signin_manager_; |
| 119 FakeProfileOAuth2TokenService* token_service_; | 122 FakeProfileOAuth2TokenService* token_service_; |
| 120 TestSigninClient* test_signin_client_; | 123 TestSigninClient* test_signin_client_; |
| 124 GaiaCookieManagerService* cookie_manager_service_; | |
| 121 MockAccountReconcilor* mock_reconcilor_; | 125 MockAccountReconcilor* mock_reconcilor_; |
| 122 net::FakeURLFetcherFactory url_fetcher_factory_; | 126 net::FakeURLFetcherFactory url_fetcher_factory_; |
| 123 scoped_ptr<TestingProfileManager> testing_profile_manager_; | 127 scoped_ptr<TestingProfileManager> testing_profile_manager_; |
| 124 base::HistogramTester histogram_tester_; | 128 base::HistogramTester histogram_tester_; |
| 125 GURL list_accounts_url_; | 129 GURL list_accounts_url_; |
| 126 GURL get_check_connection_info_url_; | 130 GURL get_check_connection_info_url_; |
| 127 | 131 |
| 128 DISALLOW_COPY_AND_ASSIGN(AccountReconcilorTest); | 132 DISALLOW_COPY_AND_ASSIGN(AccountReconcilorTest); |
| 129 }; | 133 }; |
| 130 | 134 |
| 131 AccountReconcilorTest::AccountReconcilorTest() | 135 AccountReconcilorTest::AccountReconcilorTest() |
| 132 : signin_manager_(NULL), | 136 : signin_manager_(NULL), |
| 133 token_service_(NULL), | 137 token_service_(NULL), |
| 134 test_signin_client_(NULL), | 138 test_signin_client_(NULL), |
| 139 cookie_manager_service_(NULL), | |
| 135 mock_reconcilor_(NULL), | 140 mock_reconcilor_(NULL), |
| 136 url_fetcher_factory_(NULL) {} | 141 url_fetcher_factory_(NULL) {} |
| 137 | 142 |
| 138 void AccountReconcilorTest::SetUp() { | 143 void AccountReconcilorTest::SetUp() { |
| 139 // If it's a non-parameterized test, or we have a parameter of true, set flag. | 144 // If it's a non-parameterized test, or we have a parameter of true, set flag. |
| 140 if (!::testing::UnitTest::GetInstance()->current_test_info()->value_param() || | 145 if (!::testing::UnitTest::GetInstance()->current_test_info()->value_param() || |
| 141 GetParam()) { | 146 GetParam()) { |
| 142 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 147 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 143 switches::kEnableNewProfileManagement); | 148 switches::kEnableNewProfileManagement); |
| 144 } | 149 } |
| 145 | 150 |
| 146 list_accounts_url_ = GaiaUrls::GetInstance()->ListAccountsURLWithSource( | 151 list_accounts_url_ = GaiaUrls::GetInstance()->ListAccountsURLWithSource( |
| 147 GaiaConstants::kReconcilorSource); | 152 GaiaConstants::kChromeSource); |
| 148 get_check_connection_info_url_ = | 153 get_check_connection_info_url_ = |
| 149 GaiaUrls::GetInstance()->GetCheckConnectionInfoURLWithSource( | 154 GaiaUrls::GetInstance()->GetCheckConnectionInfoURLWithSource( |
| 150 GaiaConstants::kChromeSource); | 155 GaiaConstants::kChromeSource); |
| 151 | 156 |
| 152 // Specific tests may set a response that includes specific accounts. | 157 // Specific tests may set a response that includes specific accounts. |
| 153 SetFakeResponse(list_accounts_url().spec(), "", | 158 SetFakeResponse(list_accounts_url().spec(), "", |
| 154 net::HTTP_NOT_FOUND, net::URLRequestStatus::SUCCESS); | 159 net::HTTP_NOT_FOUND, net::URLRequestStatus::SUCCESS); |
| 155 | 160 |
| 156 testing_profile_manager_.reset( | 161 testing_profile_manager_.reset( |
| 157 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 162 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 177 static_cast<FakeSigninManagerForTesting*>( | 182 static_cast<FakeSigninManagerForTesting*>( |
| 178 SigninManagerFactory::GetForProfile(profile())); | 183 SigninManagerFactory::GetForProfile(profile())); |
| 179 | 184 |
| 180 token_service_ = | 185 token_service_ = |
| 181 static_cast<FakeProfileOAuth2TokenService*>( | 186 static_cast<FakeProfileOAuth2TokenService*>( |
| 182 ProfileOAuth2TokenServiceFactory::GetForProfile(profile())); | 187 ProfileOAuth2TokenServiceFactory::GetForProfile(profile())); |
| 183 | 188 |
| 184 test_signin_client_ = | 189 test_signin_client_ = |
| 185 static_cast<TestSigninClient*>( | 190 static_cast<TestSigninClient*>( |
| 186 ChromeSigninClientFactory::GetForProfile(profile())); | 191 ChromeSigninClientFactory::GetForProfile(profile())); |
| 192 | |
| 193 cookie_manager_service_ = | |
| 194 GaiaCookieManagerServiceFactory::GetForProfile(profile()); | |
| 187 } | 195 } |
| 188 | 196 |
| 189 MockAccountReconcilor* AccountReconcilorTest::GetMockReconcilor() { | 197 MockAccountReconcilor* AccountReconcilorTest::GetMockReconcilor() { |
| 190 if (!mock_reconcilor_) { | 198 if (!mock_reconcilor_) { |
| 191 mock_reconcilor_ = | 199 mock_reconcilor_ = |
| 192 static_cast<MockAccountReconcilor*>( | 200 static_cast<MockAccountReconcilor*>( |
| 193 AccountReconcilorFactory::GetForProfile(profile())); | 201 AccountReconcilorFactory::GetForProfile(profile())); |
| 194 } | 202 } |
| 195 | 203 |
| 196 return mock_reconcilor_; | 204 return mock_reconcilor_; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(kTestEmail)); | 284 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(kTestEmail)); |
| 277 AccountReconcilor* reconcilor = | 285 AccountReconcilor* reconcilor = |
| 278 AccountReconcilorFactory::GetForProfile(profile()); | 286 AccountReconcilorFactory::GetForProfile(profile()); |
| 279 ASSERT_TRUE(reconcilor); | 287 ASSERT_TRUE(reconcilor); |
| 280 | 288 |
| 281 SetFakeResponse(list_accounts_url().spec(), | 289 SetFakeResponse(list_accounts_url().spec(), |
| 282 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0]]]", | 290 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0]]]", |
| 283 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 291 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 284 | 292 |
| 285 reconcilor->StartReconcile(); | 293 reconcilor->StartReconcile(); |
| 286 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | 294 base::RunLoop().RunUntilIdle(); |
| 287 | 295 |
| 288 base::RunLoop().RunUntilIdle(); | 296 std::vector<std::pair<std::string, bool> > accounts; |
| 289 ASSERT_TRUE(reconcilor->AreGaiaAccountsSet()); | 297 ASSERT_TRUE(cookie_manager_service()->ListAccounts(&accounts)); |
| 290 const std::vector<std::pair<std::string, bool> >& accounts = | |
| 291 reconcilor->GetGaiaAccountsForTesting(); | |
| 292 ASSERT_EQ(1u, accounts.size()); | 298 ASSERT_EQ(1u, accounts.size()); |
| 293 ASSERT_EQ("user@gmail.com", accounts[0].first); | 299 ASSERT_EQ("user@gmail.com", accounts[0].first); |
| 294 } | 300 } |
| 295 | 301 |
| 296 TEST_F(AccountReconcilorTest, GetAccountsFromCookieFailure) { | 302 TEST_F(AccountReconcilorTest, GetAccountsFromCookieFailure) { |
| 297 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 303 signin_manager()->SetAuthenticatedUsername(kTestEmail); |
| 298 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 304 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); |
| 299 AccountReconcilor* reconcilor = | 305 AccountReconcilor* reconcilor = |
| 300 AccountReconcilorFactory::GetForProfile(profile()); | 306 AccountReconcilorFactory::GetForProfile(profile()); |
| 301 ASSERT_TRUE(reconcilor); | 307 ASSERT_TRUE(reconcilor); |
| 302 | 308 |
| 303 SetFakeResponse(list_accounts_url().spec(), "", | 309 SetFakeResponse(list_accounts_url().spec(), "", |
| 304 net::HTTP_NOT_FOUND, net::URLRequestStatus::SUCCESS); | 310 net::HTTP_NOT_FOUND, net::URLRequestStatus::SUCCESS); |
| 305 | 311 |
| 306 reconcilor->StartReconcile(); | 312 reconcilor->StartReconcile(); |
| 307 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | 313 base::RunLoop().RunUntilIdle(); |
| 308 | 314 |
| 309 base::RunLoop().RunUntilIdle(); | 315 std::vector<std::pair<std::string, bool> > accounts; |
| 310 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | 316 ASSERT_FALSE(cookie_manager_service()->ListAccounts(&accounts)); |
| 317 ASSERT_EQ(0u, accounts.size()); | |
| 311 } | 318 } |
| 312 | 319 |
| 313 TEST_P(AccountReconcilorTest, StartReconcileNoop) { | 320 TEST_P(AccountReconcilorTest, StartReconcileNoop) { |
| 314 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 321 signin_manager()->SetAuthenticatedUsername(kTestEmail); |
| 315 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 322 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); |
| 316 | 323 |
| 317 AccountReconcilor* reconcilor = | 324 AccountReconcilor* reconcilor = |
| 318 AccountReconcilorFactory::GetForProfile(profile()); | 325 AccountReconcilorFactory::GetForProfile(profile()); |
| 319 ASSERT_TRUE(reconcilor); | 326 ASSERT_TRUE(reconcilor); |
| 320 | 327 |
| 321 SetFakeResponse(list_accounts_url().spec(), | 328 SetFakeResponse(list_accounts_url().spec(), |
| 322 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 329 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 323 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 330 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 324 | 331 |
| 325 reconcilor->StartReconcile(); | 332 reconcilor->StartReconcile(); |
| 326 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 333 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 327 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | |
| 328 | 334 |
| 329 base::RunLoop().RunUntilIdle(); | 335 base::RunLoop().RunUntilIdle(); |
| 330 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 336 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 331 | 337 |
| 332 histogram_tester()->ExpectTotalCount( | 338 histogram_tester()->ExpectTotalCount( |
| 333 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); | 339 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); |
| 334 histogram_tester()->ExpectUniqueSample( | 340 histogram_tester()->ExpectUniqueSample( |
| 335 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | 341 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 336 signin_metrics::ACCOUNTS_SAME, | 342 signin_metrics::ACCOUNTS_SAME, |
| 337 1); | 343 1); |
| 338 } | 344 } |
| 339 | 345 |
| 340 TEST_P(AccountReconcilorTest, StartReconcileCookiesDisabled) { | 346 TEST_P(AccountReconcilorTest, StartReconcileCookiesDisabled) { |
| 341 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 347 signin_manager()->SetAuthenticatedUsername(kTestEmail); |
| 342 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 348 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); |
| 343 test_signin_client()->set_are_signin_cookies_allowed(false); | 349 test_signin_client()->set_are_signin_cookies_allowed(false); |
| 344 | 350 |
| 345 AccountReconcilor* reconcilor = | 351 AccountReconcilor* reconcilor = |
| 346 AccountReconcilorFactory::GetForProfile(profile()); | 352 AccountReconcilorFactory::GetForProfile(profile()); |
| 347 ASSERT_TRUE(reconcilor); | 353 ASSERT_TRUE(reconcilor); |
| 348 | 354 |
| 349 reconcilor->StartReconcile(); | 355 reconcilor->StartReconcile(); |
| 350 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 356 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 351 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | |
| 352 | 357 |
| 353 base::RunLoop().RunUntilIdle(); | 358 base::RunLoop().RunUntilIdle(); |
| 359 std::vector<std::pair<std::string, bool> > accounts; | |
| 360 // This will be the first call it ListAccounts. | |
|
Roger Tawa OOO till Jul 10th
2015/04/15 18:51:05
it --> to
Mike Lerman
2015/04/16 13:13:46
Done.
| |
| 361 ASSERT_FALSE(cookie_manager_service()->ListAccounts(&accounts)); | |
| 354 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 362 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 355 } | 363 } |
| 356 | 364 |
| 357 TEST_P(AccountReconcilorTest, StartReconcileContentSettings) { | 365 TEST_P(AccountReconcilorTest, StartReconcileContentSettings) { |
| 358 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 366 signin_manager()->SetAuthenticatedUsername(kTestEmail); |
| 359 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 367 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); |
| 360 | 368 |
| 361 AccountReconcilor* reconcilor = | 369 AccountReconcilor* reconcilor = |
| 362 AccountReconcilorFactory::GetForProfile(profile()); | 370 AccountReconcilorFactory::GetForProfile(profile()); |
| 363 ASSERT_TRUE(reconcilor); | 371 ASSERT_TRUE(reconcilor); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 | 439 |
| 432 AccountReconcilor* reconcilor = | 440 AccountReconcilor* reconcilor = |
| 433 AccountReconcilorFactory::GetForProfile(profile()); | 441 AccountReconcilorFactory::GetForProfile(profile()); |
| 434 ASSERT_TRUE(reconcilor); | 442 ASSERT_TRUE(reconcilor); |
| 435 | 443 |
| 436 SetFakeResponse(list_accounts_url().spec(), | 444 SetFakeResponse(list_accounts_url().spec(), |
| 437 "[\"f\", [[\"b\", 0, \"n\", \"dot.s@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 445 "[\"f\", [[\"b\", 0, \"n\", \"dot.s@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 438 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 446 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 439 | 447 |
| 440 reconcilor->StartReconcile(); | 448 reconcilor->StartReconcile(); |
| 441 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | |
| 442 | |
| 443 base::RunLoop().RunUntilIdle(); | 449 base::RunLoop().RunUntilIdle(); |
| 444 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 450 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 445 | 451 |
| 446 histogram_tester()->ExpectUniqueSample( | 452 histogram_tester()->ExpectUniqueSample( |
| 447 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | 453 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 448 signin_metrics::ACCOUNTS_SAME, | 454 signin_metrics::ACCOUNTS_SAME, |
| 449 1); | 455 1); |
| 450 } | 456 } |
| 451 | 457 |
| 452 TEST_P(AccountReconcilorTest, StartReconcileNoopMultiple) { | 458 TEST_P(AccountReconcilorTest, StartReconcileNoopMultiple) { |
| 453 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 459 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); |
| 454 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 460 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); |
| 455 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 461 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); |
| 456 | 462 |
| 457 AccountReconcilor* reconcilor = | 463 AccountReconcilor* reconcilor = |
| 458 AccountReconcilorFactory::GetForProfile(profile()); | 464 AccountReconcilorFactory::GetForProfile(profile()); |
| 459 ASSERT_TRUE(reconcilor); | 465 ASSERT_TRUE(reconcilor); |
| 460 | 466 |
| 461 SetFakeResponse(list_accounts_url().spec(), | 467 SetFakeResponse(list_accounts_url().spec(), |
| 462 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " | 468 "[\"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]]]", | 469 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 464 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 470 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 465 | 471 |
| 466 reconcilor->StartReconcile(); | 472 reconcilor->StartReconcile(); |
| 467 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | |
| 468 base::RunLoop().RunUntilIdle(); | 473 base::RunLoop().RunUntilIdle(); |
| 469 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 474 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 470 | 475 |
| 471 histogram_tester()->ExpectTotalCount( | 476 histogram_tester()->ExpectTotalCount( |
| 472 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); | 477 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); |
| 473 histogram_tester()->ExpectUniqueSample( | 478 histogram_tester()->ExpectUniqueSample( |
| 474 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | 479 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", |
| 475 signin_metrics::ACCOUNTS_SAME, | 480 signin_metrics::ACCOUNTS_SAME, |
| 476 1); | 481 1); |
| 477 } | 482 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1); | 575 "Signin.Reconciler.RemovedFromCookieJar.FirstRun", 0, 1); |
| 571 | 576 |
| 572 // Do another pass after I've added a third account to the token service | 577 // Do another pass after I've added a third account to the token service |
| 573 | 578 |
| 574 SetFakeResponse( | 579 SetFakeResponse( |
| 575 list_accounts_url().spec(), | 580 list_accounts_url().spec(), |
| 576 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " | 581 "[\"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]]]", | 582 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
| 578 net::HTTP_OK, | 583 net::HTTP_OK, |
| 579 net::URLRequestStatus::SUCCESS); | 584 net::URLRequestStatus::SUCCESS); |
| 585 cookie_manager_service()->set_list_accounts_fetched_once_for_testing(false); | |
| 580 // This will cause the reconcilor to fire. | 586 // This will cause the reconcilor to fire. |
| 581 token_service()->UpdateCredentials("third@gmail.com", "refresh_token"); | 587 token_service()->UpdateCredentials("third@gmail.com", "refresh_token"); |
| 582 | 588 |
| 583 base::RunLoop().RunUntilIdle(); | 589 base::RunLoop().RunUntilIdle(); |
| 584 | 590 |
| 585 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 591 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 586 SimulateAddAccountToCookieCompleted( | 592 SimulateAddAccountToCookieCompleted( |
| 587 reconcilor, "third@gmail.com", GoogleServiceAuthError::AuthErrorNone()); | 593 reconcilor, "third@gmail.com", GoogleServiceAuthError::AuthErrorNone()); |
| 588 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 594 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 589 | 595 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 713 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 719 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
| 714 | 720 |
| 715 SimulateAddAccountToCookieCompleted(reconcilor, "user@gmail.com", | 721 SimulateAddAccountToCookieCompleted(reconcilor, "user@gmail.com", |
| 716 GoogleServiceAuthError::AuthErrorNone()); | 722 GoogleServiceAuthError::AuthErrorNone()); |
| 717 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 723 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
| 718 } | 724 } |
| 719 | 725 |
| 720 INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled, | 726 INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled, |
| 721 AccountReconcilorTest, | 727 AccountReconcilorTest, |
| 722 testing::Bool()); | 728 testing::Bool()); |
| OLD | NEW |