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