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 "chrome/browser/prefs/pref_service_syncable.h" | 11 #include "chrome/browser/prefs/pref_service_syncable.h" |
11 #include "chrome/browser/signin/account_reconcilor_factory.h" | 12 #include "chrome/browser/signin/account_reconcilor_factory.h" |
12 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 13 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
13 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 14 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
14 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 15 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
15 #include "chrome/browser/signin/fake_signin_manager.h" | 16 #include "chrome/browser/signin/fake_signin_manager.h" |
16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
17 #include "chrome/browser/signin/signin_manager_factory.h" | 18 #include "chrome/browser/signin/signin_manager_factory.h" |
18 #include "chrome/browser/signin/test_signin_client_builder.h" | 19 #include "chrome/browser/signin/test_signin_client_builder.h" |
19 #include "chrome/test/base/testing_browser_process.h" | 20 #include "chrome/test/base/testing_browser_process.h" |
20 #include "chrome/test/base/testing_profile.h" | 21 #include "chrome/test/base/testing_profile.h" |
21 #include "chrome/test/base/testing_profile_manager.h" | 22 #include "chrome/test/base/testing_profile_manager.h" |
22 #include "chrome/test/base/uma_histogram_helper.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/signin_switches.h" | 27 #include "components/signin/core/common/profile_management_switches.h" |
27 #include "content/public/test/test_browser_thread_bundle.h" | 28 #include "content/public/test/test_browser_thread_bundle.h" |
28 #include "google_apis/gaia/gaia_urls.h" | 29 #include "google_apis/gaia/gaia_urls.h" |
29 #include "net/url_request/test_url_fetcher_factory.h" | 30 #include "net/url_request/test_url_fetcher_factory.h" |
30 #include "testing/gmock/include/gmock/gmock.h" | 31 #include "testing/gmock/include/gmock/gmock.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
32 | 33 |
33 namespace { | 34 namespace { |
34 | 35 |
35 const char kTestEmail[] = "user@gmail.com"; | 36 const char kTestEmail[] = "user@gmail.com"; |
36 const char* const kHistogramsToSnapshot[] = { | 37 const char* const kHistogramsToSnapshot[] = { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 AccountReconcilorTest::AccountReconcilorTest() | 129 AccountReconcilorTest::AccountReconcilorTest() |
129 : signin_manager_(NULL), | 130 : signin_manager_(NULL), |
130 token_service_(NULL), | 131 token_service_(NULL), |
131 mock_reconcilor_(NULL), | 132 mock_reconcilor_(NULL), |
132 url_fetcher_factory_(NULL) {} | 133 url_fetcher_factory_(NULL) {} |
133 | 134 |
134 void AccountReconcilorTest::SetUp() { | 135 void AccountReconcilorTest::SetUp() { |
135 // If it's a non-parameterized test, or we have a parameter of true, set flag. | 136 // If it's a non-parameterized test, or we have a parameter of true, set flag. |
136 if (!::testing::UnitTest::GetInstance()->current_test_info()->value_param() || | 137 if (!::testing::UnitTest::GetInstance()->current_test_info()->value_param() || |
137 GetParam()) { | 138 GetParam()) { |
138 CommandLine::ForCurrentProcess()->AppendSwitch( | 139 switches::EnableAccountConsistencyForTesting( |
139 switches::kNewProfileManagement); | 140 CommandLine::ForCurrentProcess()); |
140 } | 141 } |
141 | 142 |
142 testing_profile_manager_.reset( | 143 testing_profile_manager_.reset( |
143 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 144 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
144 ASSERT_TRUE(testing_profile_manager_.get()->SetUp()); | 145 ASSERT_TRUE(testing_profile_manager_.get()->SetUp()); |
145 | 146 |
146 TestingProfile::TestingFactories factories; | 147 TestingProfile::TestingFactories factories; |
147 factories.push_back(std::make_pair(ChromeSigninClientFactory::GetInstance(), | 148 factories.push_back(std::make_pair(ChromeSigninClientFactory::GetInstance(), |
148 signin::BuildTestSigninClient)); | 149 signin::BuildTestSigninClient)); |
149 factories.push_back(std::make_pair( | 150 factories.push_back(std::make_pair( |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 | 737 |
737 base::RunLoop().RunUntilIdle(); | 738 base::RunLoop().RunUntilIdle(); |
738 SimulateMergeSessionCompleted(reconcilor, "user@gmail.com", | 739 SimulateMergeSessionCompleted(reconcilor, "user@gmail.com", |
739 GoogleServiceAuthError::AuthErrorNone()); | 740 GoogleServiceAuthError::AuthErrorNone()); |
740 ASSERT_FALSE(reconcilor->is_reconcile_started_); | 741 ASSERT_FALSE(reconcilor->is_reconcile_started_); |
741 } | 742 } |
742 | 743 |
743 INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled, | 744 INSTANTIATE_TEST_CASE_P(AccountReconcilorMaybeEnabled, |
744 AccountReconcilorTest, | 745 AccountReconcilorTest, |
745 testing::Bool()); | 746 testing::Bool()); |
OLD | NEW |