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