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/time/time.h" | 9 #include "base/time/time.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/browser/prefs/pref_service_syncable.h" | 11 #include "chrome/browser/prefs/pref_service_syncable.h" |
12 #include "chrome/browser/signin/account_reconcilor_factory.h" | 12 #include "chrome/browser/signin/account_reconcilor_factory.h" |
13 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 13 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
14 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 14 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
15 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 15 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
16 #include "chrome/browser/signin/fake_signin_manager.h" | 16 #include "chrome/browser/signin/fake_signin_manager.h" |
17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
18 #include "chrome/browser/signin/signin_manager_factory.h" | 18 #include "chrome/browser/signin/signin_manager_factory.h" |
19 #include "chrome/browser/signin/test_signin_client_builder.h" | 19 #include "chrome/browser/signin/test_signin_client_builder.h" |
20 #include "chrome/test/base/testing_browser_process.h" | 20 #include "chrome/test/base/testing_browser_process.h" |
21 #include "chrome/test/base/testing_profile.h" | 21 #include "chrome/test/base/testing_profile.h" |
22 #include "chrome/test/base/testing_profile_manager.h" | 22 #include "chrome/test/base/testing_profile_manager.h" |
23 #include "chrome/test/base/uma_histogram_helper.h" | |
24 #include "components/signin/core/browser/account_reconcilor.h" | 23 #include "components/signin/core/browser/account_reconcilor.h" |
25 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 24 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
26 #include "components/signin/core/browser/signin_manager.h" | 25 #include "components/signin/core/browser/signin_manager.h" |
27 #include "components/signin/core/common/profile_management_switches.h" | 26 #include "components/signin/core/common/profile_management_switches.h" |
| 27 #include "components/signin/core/common/signin_switches.h" |
28 #include "content/public/test/test_browser_thread_bundle.h" | 28 #include "content/public/test/test_browser_thread_bundle.h" |
29 #include "google_apis/gaia/gaia_urls.h" | 29 #include "google_apis/gaia/gaia_urls.h" |
30 #include "net/url_request/test_url_fetcher_factory.h" | 30 #include "net/url_request/test_url_fetcher_factory.h" |
31 #include "testing/gmock/include/gmock/gmock.h" | 31 #include "testing/gmock/include/gmock/gmock.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
33 | 33 |
34 namespace { | 34 namespace { |
35 | 35 |
36 const char kTestEmail[] = "user@gmail.com"; | 36 const char kTestEmail[] = "user@gmail.com"; |
37 const char* const kHistogramsToSnapshot[] = { | |
38 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", | |
39 "Signin.Reconciler.AddedToCookieJar.FirstRun", | |
40 "Signin.Reconciler.AddedToChrome.FirstRun", | |
41 "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun", | |
42 "Signin.Reconciler.AddedToCookieJar.SubsequentRun", | |
43 "Signin.Reconciler.AddedToChrome.SubsequentRun"}; | |
44 | 37 |
45 class MockAccountReconcilor : public testing::StrictMock<AccountReconcilor> { | 38 class MockAccountReconcilor : public testing::StrictMock<AccountReconcilor> { |
46 public: | 39 public: |
47 static KeyedService* Build(content::BrowserContext* context); | 40 static KeyedService* Build(content::BrowserContext* context); |
48 | 41 |
49 MockAccountReconcilor(ProfileOAuth2TokenService* token_service, | 42 MockAccountReconcilor(ProfileOAuth2TokenService* token_service, |
50 SigninManagerBase* signin_manager, | 43 SigninManagerBase* signin_manager, |
51 SigninClient* client); | 44 SigninClient* client); |
52 virtual ~MockAccountReconcilor() {} | 45 virtual ~MockAccountReconcilor() {} |
53 | 46 |
(...skipping 23 matching lines...) Expand all Loading... |
77 MockAccountReconcilor::MockAccountReconcilor( | 70 MockAccountReconcilor::MockAccountReconcilor( |
78 ProfileOAuth2TokenService* token_service, | 71 ProfileOAuth2TokenService* token_service, |
79 SigninManagerBase* signin_manager, | 72 SigninManagerBase* signin_manager, |
80 SigninClient* client) | 73 SigninClient* client) |
81 : testing::StrictMock<AccountReconcilor>(token_service, | 74 : testing::StrictMock<AccountReconcilor>(token_service, |
82 signin_manager, | 75 signin_manager, |
83 client) {} | 76 client) {} |
84 | 77 |
85 } // namespace | 78 } // namespace |
86 | 79 |
87 class AccountReconcilorTest : public ::testing::TestWithParam<bool> { | 80 class AccountReconcilorTest : public testing::Test { |
88 public: | 81 public: |
89 AccountReconcilorTest(); | 82 AccountReconcilorTest(); |
90 virtual void SetUp() OVERRIDE; | 83 virtual void SetUp() OVERRIDE; |
91 | 84 |
92 TestingProfile* profile() { return profile_; } | 85 TestingProfile* profile() { return profile_; } |
93 FakeSigninManagerForTesting* signin_manager() { return signin_manager_; } | 86 FakeSigninManagerForTesting* signin_manager() { return signin_manager_; } |
94 FakeProfileOAuth2TokenService* token_service() { return token_service_; } | 87 FakeProfileOAuth2TokenService* token_service() { return token_service_; } |
95 UMAHistogramHelper* histogram_helper() { return &histogram_helper_; } | |
96 | 88 |
97 void SetFakeResponse(const std::string& url, | 89 void SetFakeResponse(const std::string& url, |
98 const std::string& data, | 90 const std::string& data, |
99 net::HttpStatusCode code, | 91 net::HttpStatusCode code, |
100 net::URLRequestStatus::Status status) { | 92 net::URLRequestStatus::Status status) { |
101 url_fetcher_factory_.SetFakeResponse(GURL(url), data, code, status); | 93 url_fetcher_factory_.SetFakeResponse(GURL(url), data, code, status); |
102 } | 94 } |
103 | 95 |
104 MockAccountReconcilor* GetMockReconcilor(); | 96 MockAccountReconcilor* GetMockReconcilor(); |
105 | 97 |
106 void SimulateMergeSessionCompleted( | 98 void SimulateMergeSessionCompleted( |
107 MergeSessionHelper::Observer* observer, | 99 MergeSessionHelper::Observer* observer, |
108 const std::string& account_id, | 100 const std::string& account_id, |
109 const GoogleServiceAuthError& error); | 101 const GoogleServiceAuthError& error); |
110 | 102 |
111 void SimulateRefreshTokenFetched( | 103 void SimulateRefreshTokenFetched( |
112 AccountReconcilor* reconcilor, | 104 AccountReconcilor* reconcilor, |
113 const std::string& account_id, | 105 const std::string& account_id, |
114 const std::string& refresh_token); | 106 const std::string& refresh_token); |
115 | 107 |
116 private: | 108 private: |
117 content::TestBrowserThreadBundle bundle_; | 109 content::TestBrowserThreadBundle bundle_; |
118 TestingProfile* profile_; | 110 TestingProfile* profile_; |
119 FakeSigninManagerForTesting* signin_manager_; | 111 FakeSigninManagerForTesting* signin_manager_; |
120 FakeProfileOAuth2TokenService* token_service_; | 112 FakeProfileOAuth2TokenService* token_service_; |
121 MockAccountReconcilor* mock_reconcilor_; | 113 MockAccountReconcilor* mock_reconcilor_; |
122 net::FakeURLFetcherFactory url_fetcher_factory_; | 114 net::FakeURLFetcherFactory url_fetcher_factory_; |
123 scoped_ptr<TestingProfileManager> testing_profile_manager_; | 115 scoped_ptr<TestingProfileManager> testing_profile_manager_; |
124 UMAHistogramHelper histogram_helper_; | |
125 | |
126 DISALLOW_COPY_AND_ASSIGN(AccountReconcilorTest); | |
127 }; | 116 }; |
128 | 117 |
129 AccountReconcilorTest::AccountReconcilorTest() | 118 AccountReconcilorTest::AccountReconcilorTest() |
130 : signin_manager_(NULL), | 119 : signin_manager_(NULL), |
131 token_service_(NULL), | 120 token_service_(NULL), |
132 mock_reconcilor_(NULL), | 121 mock_reconcilor_(NULL), |
133 url_fetcher_factory_(NULL) {} | 122 url_fetcher_factory_(NULL) {} |
134 | 123 |
135 void AccountReconcilorTest::SetUp() { | 124 void AccountReconcilorTest::SetUp() { |
136 // If it's a non-parameterized test, or we have a parameter of true, set flag. | 125 CommandLine::ForCurrentProcess()->AppendSwitch( |
137 if (!::testing::UnitTest::GetInstance()->current_test_info()->value_param() || | 126 switches::kEnableNewProfileManagement); |
138 GetParam()) { | |
139 switches::EnableAccountConsistencyForTesting( | |
140 CommandLine::ForCurrentProcess()); | |
141 } | |
142 | 127 |
143 testing_profile_manager_.reset( | 128 testing_profile_manager_.reset( |
144 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 129 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
145 ASSERT_TRUE(testing_profile_manager_.get()->SetUp()); | 130 ASSERT_TRUE(testing_profile_manager_.get()->SetUp()); |
146 | 131 |
147 TestingProfile::TestingFactories factories; | 132 TestingProfile::TestingFactories factories; |
148 factories.push_back(std::make_pair(ChromeSigninClientFactory::GetInstance(), | 133 factories.push_back(std::make_pair(ChromeSigninClientFactory::GetInstance(), |
149 signin::BuildTestSigninClient)); | 134 signin::BuildTestSigninClient)); |
150 factories.push_back(std::make_pair( | 135 factories.push_back(std::make_pair( |
151 ProfileOAuth2TokenServiceFactory::GetInstance(), | 136 ProfileOAuth2TokenServiceFactory::GetInstance(), |
152 BuildFakeProfileOAuth2TokenService)); | 137 BuildFakeProfileOAuth2TokenService)); |
153 factories.push_back(std::make_pair(SigninManagerFactory::GetInstance(), | 138 factories.push_back(std::make_pair(SigninManagerFactory::GetInstance(), |
154 FakeSigninManagerBase::Build)); | 139 FakeSigninManagerBase::Build)); |
155 factories.push_back(std::make_pair(AccountReconcilorFactory::GetInstance(), | 140 factories.push_back(std::make_pair(AccountReconcilorFactory::GetInstance(), |
156 MockAccountReconcilor::Build)); | 141 MockAccountReconcilor::Build)); |
157 | 142 |
158 profile_ = testing_profile_manager_.get()->CreateTestingProfile("name", | 143 profile_ = testing_profile_manager_.get()->CreateTestingProfile("name", |
159 scoped_ptr<PrefServiceSyncable>(), | 144 scoped_ptr<PrefServiceSyncable>(), |
160 base::UTF8ToUTF16("name"), 0, std::string(), | 145 base::UTF8ToUTF16("name"), 0, std::string(), |
161 factories); | 146 factories); |
162 | 147 |
163 signin_manager_ = | 148 signin_manager_ = |
164 static_cast<FakeSigninManagerForTesting*>( | 149 static_cast<FakeSigninManagerForTesting*>( |
165 SigninManagerFactory::GetForProfile(profile())); | 150 SigninManagerFactory::GetForProfile(profile())); |
166 | 151 |
167 token_service_ = | 152 token_service_ = |
168 static_cast<FakeProfileOAuth2TokenService*>( | 153 static_cast<FakeProfileOAuth2TokenService*>( |
169 ProfileOAuth2TokenServiceFactory::GetForProfile(profile())); | 154 ProfileOAuth2TokenServiceFactory::GetForProfile(profile())); |
170 | |
171 // Take a new snapshot of the concerned histograms before each test | |
172 histogram_helper_.PrepareSnapshot(kHistogramsToSnapshot, | |
173 arraysize(kHistogramsToSnapshot)); | |
174 } | 155 } |
175 | 156 |
176 MockAccountReconcilor* AccountReconcilorTest::GetMockReconcilor() { | 157 MockAccountReconcilor* AccountReconcilorTest::GetMockReconcilor() { |
177 if (!mock_reconcilor_) { | 158 if (!mock_reconcilor_) { |
178 mock_reconcilor_ = | 159 mock_reconcilor_ = |
179 static_cast<MockAccountReconcilor*>( | 160 static_cast<MockAccountReconcilor*>( |
180 AccountReconcilorFactory::GetForProfile(profile())); | 161 AccountReconcilorFactory::GetForProfile(profile())); |
181 } | 162 } |
182 | 163 |
183 return mock_reconcilor_; | 164 return mock_reconcilor_; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 332 |
352 token_service()->IssueErrorForAllPendingRequests( | 333 token_service()->IssueErrorForAllPendingRequests( |
353 GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); | 334 GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); |
354 | 335 |
355 base::RunLoop().RunUntilIdle(); | 336 base::RunLoop().RunUntilIdle(); |
356 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); | 337 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); |
357 ASSERT_EQ(0u, reconcilor->GetValidChromeAccountsForTesting().size()); | 338 ASSERT_EQ(0u, reconcilor->GetValidChromeAccountsForTesting().size()); |
358 ASSERT_EQ(1u, reconcilor->GetInvalidChromeAccountsForTesting().size()); | 339 ASSERT_EQ(1u, reconcilor->GetInvalidChromeAccountsForTesting().size()); |
359 } | 340 } |
360 | 341 |
361 TEST_P(AccountReconcilorTest, StartReconcileNoop) { | 342 TEST_F(AccountReconcilorTest, StartReconcileNoop) { |
362 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 343 signin_manager()->SetAuthenticatedUsername(kTestEmail); |
363 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 344 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); |
364 | 345 |
365 AccountReconcilor* reconcilor = | 346 AccountReconcilor* reconcilor = |
366 AccountReconcilorFactory::GetForProfile(profile()); | 347 AccountReconcilorFactory::GetForProfile(profile()); |
367 ASSERT_TRUE(reconcilor); | 348 ASSERT_TRUE(reconcilor); |
368 | 349 |
369 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), | 350 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), |
370 "[\"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]]]", |
371 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 352 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
372 SetFakeResponse(GaiaUrls::GetInstance()->people_get_url().spec(), | 353 SetFakeResponse(GaiaUrls::GetInstance()->people_get_url().spec(), |
373 "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 354 "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
374 | 355 |
375 reconcilor->StartReconcile(); | 356 reconcilor->StartReconcile(); |
376 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); | 357 ASSERT_FALSE(reconcilor->AreGaiaAccountsSet()); |
377 ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked()); | 358 ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked()); |
378 | 359 |
379 base::RunLoop().RunUntilIdle(); | 360 base::RunLoop().RunUntilIdle(); |
380 ASSERT_TRUE(reconcilor->AreGaiaAccountsSet()); | 361 ASSERT_TRUE(reconcilor->AreGaiaAccountsSet()); |
381 ASSERT_EQ(1u, reconcilor->GetGaiaAccountsForTesting().size()); | 362 ASSERT_EQ(1u, reconcilor->GetGaiaAccountsForTesting().size()); |
382 ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked()); | 363 ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked()); |
383 | 364 |
384 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", | 365 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", |
385 base::Time::Now() + base::TimeDelta::FromHours(1)); | 366 base::Time::Now() + base::TimeDelta::FromHours(1)); |
386 | 367 |
387 base::RunLoop().RunUntilIdle(); | 368 base::RunLoop().RunUntilIdle(); |
388 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); | 369 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); |
389 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 370 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
390 | |
391 histogram_helper()->Fetch(); | |
392 histogram_helper()->ExpectTotalCount( | |
393 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); | |
394 histogram_helper()->ExpectUniqueSample( | |
395 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | |
396 } | 371 } |
397 | 372 |
398 // This is test is needed until chrome changes to use gaia obfuscated id. | 373 // This is test is needed until chrome changes to use gaia obfuscated id. |
399 // The signin manager and token service use the gaia "email" property, which | 374 // The signin manager and token service use the gaia "email" property, which |
400 // preserves dots in usernames and preserves case. gaia::ParseListAccountsData() | 375 // preserves dots in usernames and preserves case. gaia::ParseListAccountsData() |
401 // however uses gaia "displayEmail" which does not preserve case, and then | 376 // however uses gaia "displayEmail" which does not preserve case, and then |
402 // passes the string through gaia::CanonicalizeEmail() which removes dots. This | 377 // passes the string through gaia::CanonicalizeEmail() which removes dots. This |
403 // tests makes sure that an email like "Dot.S@hmail.com", as seen by the | 378 // tests makes sure that an email like "Dot.S@hmail.com", as seen by the |
404 // token service, will be considered the same as "dots@gmail.com" as returned | 379 // token service, will be considered the same as "dots@gmail.com" as returned |
405 // by gaia::ParseListAccountsData(). | 380 // by gaia::ParseListAccountsData(). |
406 TEST_P(AccountReconcilorTest, StartReconcileNoopWithDots) { | 381 TEST_F(AccountReconcilorTest, StartReconcileNoopWithDots) { |
407 signin_manager()->SetAuthenticatedUsername("Dot.S@gmail.com"); | 382 signin_manager()->SetAuthenticatedUsername("Dot.S@gmail.com"); |
408 token_service()->UpdateCredentials("Dot.S@gmail.com", "refresh_token"); | 383 token_service()->UpdateCredentials("Dot.S@gmail.com", "refresh_token"); |
409 | 384 |
410 AccountReconcilor* reconcilor = | 385 AccountReconcilor* reconcilor = |
411 AccountReconcilorFactory::GetForProfile(profile()); | 386 AccountReconcilorFactory::GetForProfile(profile()); |
412 ASSERT_TRUE(reconcilor); | 387 ASSERT_TRUE(reconcilor); |
413 | 388 |
414 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), | 389 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), |
415 "[\"f\", [[\"b\", 0, \"n\", \"dot.s@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 390 "[\"f\", [[\"b\", 0, \"n\", \"dot.s@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
416 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 391 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
(...skipping 10 matching lines...) Expand all Loading... |
427 ASSERT_STREQ("dots@gmail.com", | 402 ASSERT_STREQ("dots@gmail.com", |
428 reconcilor->GetGaiaAccountsForTesting()[0].first.c_str()); | 403 reconcilor->GetGaiaAccountsForTesting()[0].first.c_str()); |
429 ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked()); | 404 ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked()); |
430 | 405 |
431 token_service()->IssueAllTokensForAccount("Dot.S@gmail.com", "access_token", | 406 token_service()->IssueAllTokensForAccount("Dot.S@gmail.com", "access_token", |
432 base::Time::Now() + base::TimeDelta::FromHours(1)); | 407 base::Time::Now() + base::TimeDelta::FromHours(1)); |
433 | 408 |
434 base::RunLoop().RunUntilIdle(); | 409 base::RunLoop().RunUntilIdle(); |
435 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); | 410 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); |
436 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 411 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
437 | |
438 histogram_helper()->Fetch(); | |
439 histogram_helper()->ExpectUniqueSample( | |
440 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | |
441 } | 412 } |
442 | 413 |
443 TEST_P(AccountReconcilorTest, StartReconcileNoopMultiple) { | 414 TEST_F(AccountReconcilorTest, StartReconcileNoopMultiple) { |
444 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 415 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); |
445 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 416 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); |
446 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 417 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); |
447 | 418 |
448 AccountReconcilor* reconcilor = | 419 AccountReconcilor* reconcilor = |
449 AccountReconcilorFactory::GetForProfile(profile()); | 420 AccountReconcilorFactory::GetForProfile(profile()); |
450 ASSERT_TRUE(reconcilor); | 421 ASSERT_TRUE(reconcilor); |
451 | 422 |
452 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), | 423 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), |
453 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " | 424 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " |
(...skipping 16 matching lines...) Expand all Loading... |
470 | 441 |
471 base::RunLoop().RunUntilIdle(); | 442 base::RunLoop().RunUntilIdle(); |
472 ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked()); | 443 ASSERT_FALSE(reconcilor->AreAllRefreshTokensChecked()); |
473 | 444 |
474 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", | 445 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", |
475 base::Time::Now() + base::TimeDelta::FromHours(1)); | 446 base::Time::Now() + base::TimeDelta::FromHours(1)); |
476 | 447 |
477 base::RunLoop().RunUntilIdle(); | 448 base::RunLoop().RunUntilIdle(); |
478 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); | 449 ASSERT_TRUE(reconcilor->AreAllRefreshTokensChecked()); |
479 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 450 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
480 | |
481 histogram_helper()->Fetch(); | |
482 histogram_helper()->ExpectTotalCount( | |
483 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1); | |
484 histogram_helper()->ExpectUniqueSample( | |
485 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | |
486 } | 451 } |
487 | 452 |
488 TEST_P(AccountReconcilorTest, StartReconcileAddToCookie) { | 453 TEST_F(AccountReconcilorTest, StartReconcileAddToCookie) { |
489 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 454 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); |
490 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 455 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); |
491 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 456 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); |
492 | 457 |
493 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("other@gmail.com")); | 458 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("other@gmail.com")); |
494 | 459 |
495 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), | 460 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), |
496 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 461 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
497 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 462 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
498 SetFakeResponse(GaiaUrls::GetInstance()->people_get_url().spec(), | 463 SetFakeResponse(GaiaUrls::GetInstance()->people_get_url().spec(), |
499 "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 464 "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
500 | 465 |
501 AccountReconcilor* reconcilor = GetMockReconcilor(); | 466 AccountReconcilor* reconcilor = GetMockReconcilor(); |
502 reconcilor->StartReconcile(); | 467 reconcilor->StartReconcile(); |
503 token_service()->IssueAllTokensForAccount("other@gmail.com", "access_token", | 468 token_service()->IssueAllTokensForAccount("other@gmail.com", "access_token", |
504 base::Time::Now() + base::TimeDelta::FromHours(1)); | 469 base::Time::Now() + base::TimeDelta::FromHours(1)); |
505 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", | 470 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", |
506 base::Time::Now() + base::TimeDelta::FromHours(1)); | 471 base::Time::Now() + base::TimeDelta::FromHours(1)); |
507 | 472 |
508 base::RunLoop().RunUntilIdle(); | 473 base::RunLoop().RunUntilIdle(); |
509 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 474 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
510 SimulateMergeSessionCompleted(reconcilor, "other@gmail.com", | 475 SimulateMergeSessionCompleted(reconcilor, "other@gmail.com", |
511 GoogleServiceAuthError::AuthErrorNone()); | 476 GoogleServiceAuthError::AuthErrorNone()); |
512 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 477 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
513 | |
514 histogram_helper()->Fetch(); | |
515 histogram_helper()->ExpectUniqueSample( | |
516 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | |
517 histogram_helper()->ExpectUniqueSample( | |
518 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); | |
519 histogram_helper()->ExpectUniqueSample( | |
520 "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1); | |
521 } | 478 } |
522 | 479 |
523 TEST_P(AccountReconcilorTest, StartReconcileAddToCookieTwice) { | 480 TEST_F(AccountReconcilorTest, StartReconcileAddToChrome) { |
524 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | |
525 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | |
526 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | |
527 | |
528 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("other@gmail.com")); | |
529 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("third@gmail.com")); | |
530 | |
531 SetFakeResponse( | |
532 GaiaUrls::GetInstance()->list_accounts_url().spec(), | |
533 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | |
534 net::HTTP_OK, | |
535 net::URLRequestStatus::SUCCESS); | |
536 SetFakeResponse(GaiaUrls::GetInstance()->people_get_url().spec(), | |
537 "{\"id\":\"foo\"}", | |
538 net::HTTP_OK, | |
539 net::URLRequestStatus::SUCCESS); | |
540 | |
541 AccountReconcilor* reconcilor = GetMockReconcilor(); | |
542 reconcilor->StartReconcile(); | |
543 token_service()->IssueAllTokensForAccount( | |
544 "other@gmail.com", | |
545 "access_token", | |
546 base::Time::Now() + base::TimeDelta::FromHours(1)); | |
547 token_service()->IssueAllTokensForAccount( | |
548 "user@gmail.com", | |
549 "access_token", | |
550 base::Time::Now() + base::TimeDelta::FromHours(1)); | |
551 | |
552 base::RunLoop().RunUntilIdle(); | |
553 ASSERT_TRUE(reconcilor->is_reconcile_started_); | |
554 SimulateMergeSessionCompleted( | |
555 reconcilor, "other@gmail.com", GoogleServiceAuthError::AuthErrorNone()); | |
556 ASSERT_FALSE(reconcilor->is_reconcile_started_); | |
557 | |
558 histogram_helper()->Fetch(); | |
559 histogram_helper()->ExpectUniqueSample( | |
560 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | |
561 histogram_helper()->ExpectUniqueSample( | |
562 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); | |
563 histogram_helper()->ExpectUniqueSample( | |
564 "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1); | |
565 | |
566 // Do another pass after I've added a third account to the token service | |
567 | |
568 SetFakeResponse( | |
569 GaiaUrls::GetInstance()->list_accounts_url().spec(), | |
570 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " | |
571 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | |
572 net::HTTP_OK, | |
573 net::URLRequestStatus::SUCCESS); | |
574 // This will cause the reconcilor to fire. | |
575 token_service()->UpdateCredentials("third@gmail.com", "refresh_token"); | |
576 | |
577 token_service()->IssueAllTokensForAccount( | |
578 "other@gmail.com", | |
579 "access_token", | |
580 base::Time::Now() + base::TimeDelta::FromHours(1)); | |
581 token_service()->IssueAllTokensForAccount( | |
582 "user@gmail.com", | |
583 "access_token", | |
584 base::Time::Now() + base::TimeDelta::FromHours(1)); | |
585 token_service()->IssueAllTokensForAccount( | |
586 "third@gmail.com", | |
587 "access_token", | |
588 base::Time::Now() + base::TimeDelta::FromHours(1)); | |
589 | |
590 base::RunLoop().RunUntilIdle(); | |
591 | |
592 ASSERT_TRUE(reconcilor->is_reconcile_started_); | |
593 SimulateMergeSessionCompleted( | |
594 reconcilor, "third@gmail.com", GoogleServiceAuthError::AuthErrorNone()); | |
595 ASSERT_FALSE(reconcilor->is_reconcile_started_); | |
596 | |
597 histogram_helper()->Fetch(); | |
598 histogram_helper()->ExpectUniqueSample( | |
599 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | |
600 histogram_helper()->ExpectUniqueSample( | |
601 "Signin.Reconciler.AddedToCookieJar.FirstRun", 1, 1); | |
602 histogram_helper()->ExpectUniqueSample( | |
603 "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1); | |
604 histogram_helper()->ExpectUniqueSample( | |
605 "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun", 0, 1); | |
606 histogram_helper()->ExpectUniqueSample( | |
607 "Signin.Reconciler.AddedToCookieJar.SubsequentRun", 1, 1); | |
608 histogram_helper()->ExpectUniqueSample( | |
609 "Signin.Reconciler.AddedToChrome.SubsequentRun", 0, 1); | |
610 } | |
611 | |
612 TEST_P(AccountReconcilorTest, StartReconcileAddToChrome) { | |
613 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 481 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); |
614 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 482 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); |
615 | 483 |
616 EXPECT_CALL(*GetMockReconcilor(), | 484 EXPECT_CALL(*GetMockReconcilor(), |
617 PerformAddToChromeAction("other@gmail.com", 1)); | 485 PerformAddToChromeAction("other@gmail.com", 1)); |
618 | 486 |
619 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), | 487 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), |
620 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " | 488 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1], " |
621 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 489 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
622 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 490 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
623 SetFakeResponse(GaiaUrls::GetInstance()->people_get_url().spec(), | 491 SetFakeResponse(GaiaUrls::GetInstance()->people_get_url().spec(), |
624 "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 492 "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
625 | 493 |
626 AccountReconcilor* reconcilor = GetMockReconcilor(); | 494 AccountReconcilor* reconcilor = GetMockReconcilor(); |
627 reconcilor->StartReconcile(); | 495 reconcilor->StartReconcile(); |
628 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", | 496 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", |
629 base::Time::Now() + base::TimeDelta::FromHours(1)); | 497 base::Time::Now() + base::TimeDelta::FromHours(1)); |
630 | 498 |
631 base::RunLoop().RunUntilIdle(); | 499 base::RunLoop().RunUntilIdle(); |
632 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 500 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
633 SimulateRefreshTokenFetched(reconcilor, "other@gmail.com", ""); | 501 SimulateRefreshTokenFetched(reconcilor, "other@gmail.com", ""); |
634 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 502 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
635 | |
636 histogram_helper()->Fetch(); | |
637 histogram_helper()->ExpectUniqueSample( | |
638 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 0, 1); | |
639 histogram_helper()->ExpectUniqueSample( | |
640 "Signin.Reconciler.AddedToCookieJar.FirstRun", 0, 1); | |
641 histogram_helper()->ExpectUniqueSample( | |
642 "Signin.Reconciler.AddedToChrome.FirstRun", 1, 1); | |
643 } | 503 } |
644 | 504 |
645 TEST_P(AccountReconcilorTest, StartReconcileBadPrimary) { | 505 TEST_F(AccountReconcilorTest, StartReconcileBadPrimary) { |
646 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 506 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); |
647 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 507 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); |
648 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 508 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); |
649 | 509 |
650 EXPECT_CALL(*GetMockReconcilor(), PerformLogoutAllAccountsAction()); | 510 EXPECT_CALL(*GetMockReconcilor(), PerformLogoutAllAccountsAction()); |
651 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("user@gmail.com")); | 511 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("user@gmail.com")); |
652 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("other@gmail.com")); | 512 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("other@gmail.com")); |
653 | 513 |
654 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), | 514 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), |
655 "[\"f\", [[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1], " | 515 "[\"f\", [[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1], " |
(...skipping 10 matching lines...) Expand all Loading... |
666 base::Time::Now() + base::TimeDelta::FromHours(1)); | 526 base::Time::Now() + base::TimeDelta::FromHours(1)); |
667 | 527 |
668 base::RunLoop().RunUntilIdle(); | 528 base::RunLoop().RunUntilIdle(); |
669 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 529 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
670 SimulateMergeSessionCompleted(reconcilor, "other@gmail.com", | 530 SimulateMergeSessionCompleted(reconcilor, "other@gmail.com", |
671 GoogleServiceAuthError::AuthErrorNone()); | 531 GoogleServiceAuthError::AuthErrorNone()); |
672 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 532 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
673 SimulateMergeSessionCompleted(reconcilor, "user@gmail.com", | 533 SimulateMergeSessionCompleted(reconcilor, "user@gmail.com", |
674 GoogleServiceAuthError::AuthErrorNone()); | 534 GoogleServiceAuthError::AuthErrorNone()); |
675 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 535 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
676 | |
677 histogram_helper()->Fetch(); | |
678 histogram_helper()->ExpectUniqueSample( | |
679 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 1, 1); | |
680 histogram_helper()->ExpectUniqueSample( | |
681 "Signin.Reconciler.AddedToCookieJar.FirstRun", 2, 1); | |
682 histogram_helper()->ExpectUniqueSample( | |
683 "Signin.Reconciler.AddedToChrome.FirstRun", 0, 1); | |
684 } | 536 } |
685 | 537 |
686 TEST_P(AccountReconcilorTest, StartReconcileOnlyOnce) { | 538 TEST_F(AccountReconcilorTest, StartReconcileOnlyOnce) { |
687 signin_manager()->SetAuthenticatedUsername(kTestEmail); | 539 signin_manager()->SetAuthenticatedUsername(kTestEmail); |
688 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); | 540 token_service()->UpdateCredentials(kTestEmail, "refresh_token"); |
689 | 541 |
690 AccountReconcilor* reconcilor = | 542 AccountReconcilor* reconcilor = |
691 AccountReconcilorFactory::GetForProfile(profile()); | 543 AccountReconcilorFactory::GetForProfile(profile()); |
692 ASSERT_TRUE(reconcilor); | 544 ASSERT_TRUE(reconcilor); |
693 | 545 |
694 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), | 546 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), |
695 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 547 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
696 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 548 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
697 SetFakeResponse(GaiaUrls::GetInstance()->people_get_url().spec(), | 549 SetFakeResponse(GaiaUrls::GetInstance()->people_get_url().spec(), |
698 "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 550 "{\"id\":\"foo\"}", net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
699 | 551 |
700 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 552 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
701 reconcilor->StartReconcile(); | 553 reconcilor->StartReconcile(); |
702 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 554 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
703 | 555 |
704 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", | 556 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", |
705 base::Time::Now() + base::TimeDelta::FromHours(1)); | 557 base::Time::Now() + base::TimeDelta::FromHours(1)); |
706 | 558 |
707 base::RunLoop().RunUntilIdle(); | 559 base::RunLoop().RunUntilIdle(); |
708 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 560 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
709 } | 561 } |
710 | 562 |
711 TEST_P(AccountReconcilorTest, StartReconcileWithSessionInfoExpiredDefault) { | 563 TEST_F(AccountReconcilorTest, StartReconcileWithSessionInfoExpiredDefault) { |
712 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); | 564 signin_manager()->SetAuthenticatedUsername("user@gmail.com"); |
713 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); | 565 token_service()->UpdateCredentials("user@gmail.com", "refresh_token"); |
714 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); | 566 token_service()->UpdateCredentials("other@gmail.com", "refresh_token"); |
715 | 567 |
716 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("user@gmail.com")); | 568 EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction("user@gmail.com")); |
717 | 569 |
718 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), | 570 SetFakeResponse(GaiaUrls::GetInstance()->list_accounts_url().spec(), |
719 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0]," | 571 "[\"f\", [[\"b\", 0, \"n\", \"user@gmail.com\", \"p\", 0, 0, 0, 0, 0]," |
720 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", | 572 "[\"b\", 0, \"n\", \"other@gmail.com\", \"p\", 0, 0, 0, 0, 1]]]", |
721 net::HTTP_OK, net::URLRequestStatus::SUCCESS); | 573 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
(...skipping 11 matching lines...) Expand all Loading... |
733 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", | 585 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", |
734 base::Time::Now() + base::TimeDelta::FromHours(1)); | 586 base::Time::Now() + base::TimeDelta::FromHours(1)); |
735 token_service()->IssueAllTokensForAccount("other@gmail.com", "access_token", | 587 token_service()->IssueAllTokensForAccount("other@gmail.com", "access_token", |
736 base::Time::Now() + base::TimeDelta::FromHours(1)); | 588 base::Time::Now() + base::TimeDelta::FromHours(1)); |
737 | 589 |
738 base::RunLoop().RunUntilIdle(); | 590 base::RunLoop().RunUntilIdle(); |
739 SimulateMergeSessionCompleted(reconcilor, "user@gmail.com", | 591 SimulateMergeSessionCompleted(reconcilor, "user@gmail.com", |
740 GoogleServiceAuthError::AuthErrorNone()); | 592 GoogleServiceAuthError::AuthErrorNone()); |
741 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 593 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
742 } | 594 } |
743 | |
744 INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled, | |
745 AccountReconcilorTest, | |
746 testing::Bool()); | |
OLD | NEW |