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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "chrome/browser/signin/account_reconcilor.h" | 8 #include "chrome/browser/signin/account_reconcilor.h" |
9 #include "chrome/browser/signin/account_reconcilor_factory.h" | 9 #include "chrome/browser/signin/account_reconcilor_factory.h" |
10 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 11 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h" |
11 #include "chrome/browser/signin/fake_signin_manager.h" | 12 #include "chrome/browser/signin/fake_signin_manager.h" |
12 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 13 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
14 #include "chrome/browser/signin/signin_manager.h" | 15 #include "chrome/browser/signin/signin_manager.h" |
15 #include "chrome/browser/signin/signin_manager_factory.h" | 16 #include "chrome/browser/signin/signin_manager_factory.h" |
16 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
17 #include "content/public/test/test_browser_thread_bundle.h" | 18 #include "content/public/test/test_browser_thread_bundle.h" |
18 #include "net/url_request/test_url_fetcher_factory.h" | 19 #include "net/url_request/test_url_fetcher_factory.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 94 |
94 AccountReconcilorTest::AccountReconcilorTest() | 95 AccountReconcilorTest::AccountReconcilorTest() |
95 : signin_manager_(NULL), | 96 : signin_manager_(NULL), |
96 token_service_(NULL), | 97 token_service_(NULL), |
97 mock_reconcilor_(NULL), | 98 mock_reconcilor_(NULL), |
98 url_fetcher_factory_(NULL) {} | 99 url_fetcher_factory_(NULL) {} |
99 | 100 |
100 void AccountReconcilorTest::SetUp() { | 101 void AccountReconcilorTest::SetUp() { |
101 TestingProfile::Builder builder; | 102 TestingProfile::Builder builder; |
102 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), | 103 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), |
103 FakeProfileOAuth2TokenService::Build); | 104 FakeProfileOAuth2TokenServiceWrapper::Build); |
104 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), | 105 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), |
105 FakeSigninManagerBase::Build); | 106 FakeSigninManagerBase::Build); |
106 builder.AddTestingFactory(AccountReconcilorFactory::GetInstance(), | 107 builder.AddTestingFactory(AccountReconcilorFactory::GetInstance(), |
107 MockAccountReconcilor::Build); | 108 MockAccountReconcilor::Build); |
108 profile_ = builder.Build(); | 109 profile_ = builder.Build(); |
109 | 110 |
110 signin_manager_ = | 111 signin_manager_ = |
111 static_cast<FakeSigninManagerForTesting*>( | 112 static_cast<FakeSigninManagerForTesting*>( |
112 SigninManagerFactory::GetForProfile(profile())); | 113 SigninManagerFactory::GetForProfile(profile())); |
113 signin_manager_->Initialize(profile(), NULL); | 114 signin_manager_->Initialize(profile(), NULL); |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 474 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
474 reconcilor->StartReconcile(); | 475 reconcilor->StartReconcile(); |
475 ASSERT_TRUE(reconcilor->is_reconcile_started_); | 476 ASSERT_TRUE(reconcilor->is_reconcile_started_); |
476 | 477 |
477 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", | 478 token_service()->IssueAllTokensForAccount("user@gmail.com", "access_token", |
478 base::Time::Now() + base::TimeDelta::FromHours(1)); | 479 base::Time::Now() + base::TimeDelta::FromHours(1)); |
479 | 480 |
480 base::RunLoop().RunUntilIdle(); | 481 base::RunLoop().RunUntilIdle(); |
481 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 482 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
482 } | 483 } |
OLD | NEW |