OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/files/file_util.h" | 5 #include "base/files/file_util.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/signin/account_tracker_service_factory.h" | 9 #include "chrome/browser/signin/account_tracker_service_factory.h" |
10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
11 #include "chrome/browser/signin/fake_signin_manager_builder.h" | 11 #include "chrome/browser/signin/fake_signin_manager_builder.h" |
12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
13 #include "chrome/browser/signin/signin_manager_factory.h" | 13 #include "chrome/browser/signin/signin_manager_factory.h" |
14 #include "chrome/browser/sync/chrome_sync_client.h" | 14 #include "chrome/browser/sync/chrome_sync_client.h" |
15 #include "chrome/browser/sync/glue/sync_backend_host_mock.h" | 15 #include "chrome/browser/sync/glue/sync_backend_host_mock.h" |
16 #include "chrome/browser/sync/profile_sync_service.h" | 16 #include "chrome/browser/sync/profile_sync_service.h" |
17 #include "chrome/browser/sync/profile_sync_service_factory.h" | 17 #include "chrome/browser/sync/profile_sync_service_factory.h" |
18 #include "chrome/browser/sync/profile_sync_test_util.h" | 18 #include "chrome/browser/sync/profile_sync_test_util.h" |
19 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" | 19 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" |
| 20 #include "chrome/common/channel_info.h" |
20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
21 #include "chrome/test/base/testing_browser_process.h" | 22 #include "chrome/test/base/testing_browser_process.h" |
22 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
23 #include "chrome/test/base/testing_profile_manager.h" | 24 #include "chrome/test/base/testing_profile_manager.h" |
24 #include "components/signin/core/browser/account_tracker_service.h" | 25 #include "components/signin/core/browser/account_tracker_service.h" |
25 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 26 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
26 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 27 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
27 #include "components/signin/core/browser/signin_manager.h" | 28 #include "components/signin/core/browser/signin_manager.h" |
28 #include "components/signin/core/common/signin_pref_names.h" | 29 #include "components/signin/core/common/signin_pref_names.h" |
29 #include "components/sync_driver/data_type_manager.h" | 30 #include "components/sync_driver/data_type_manager.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 scoped_ptr<sync_driver::SyncClient> sync_client, | 83 scoped_ptr<sync_driver::SyncClient> sync_client, |
83 Profile* profile, | 84 Profile* profile, |
84 scoped_ptr<SigninManagerWrapper> signin_wrapper, | 85 scoped_ptr<SigninManagerWrapper> signin_wrapper, |
85 ProfileOAuth2TokenService* oauth2_token_service, | 86 ProfileOAuth2TokenService* oauth2_token_service, |
86 browser_sync::ProfileSyncServiceStartBehavior start_behavior) | 87 browser_sync::ProfileSyncServiceStartBehavior start_behavior) |
87 : ProfileSyncService(sync_client.Pass(), | 88 : ProfileSyncService(sync_client.Pass(), |
88 profile, | 89 profile, |
89 signin_wrapper.Pass(), | 90 signin_wrapper.Pass(), |
90 oauth2_token_service, | 91 oauth2_token_service, |
91 start_behavior, | 92 start_behavior, |
92 base::Bind(&EmptyNetworkTimeUpdate)) {} | 93 base::Bind(&EmptyNetworkTimeUpdate), |
| 94 profile->GetPath(), |
| 95 profile->GetRequestContext(), |
| 96 profile->GetDebugName(), |
| 97 chrome::GetChannel(), |
| 98 content::BrowserThread::GetMessageLoopProxyForThread( |
| 99 content::BrowserThread::DB), |
| 100 content::BrowserThread::GetMessageLoopProxyForThread( |
| 101 content::BrowserThread::FILE), |
| 102 content::BrowserThread::GetBlockingPool()) {} |
93 | 103 |
94 protected: | 104 protected: |
95 bool NeedBackup() const override { return false; } | 105 bool NeedBackup() const override { return false; } |
96 }; | 106 }; |
97 | 107 |
98 class ProfileSyncServiceStartupTest : public testing::Test { | 108 class ProfileSyncServiceStartupTest : public testing::Test { |
99 public: | 109 public: |
100 ProfileSyncServiceStartupTest() | 110 ProfileSyncServiceStartupTest() |
101 : thread_bundle_(content::TestBrowserThreadBundle::REAL_DB_THREAD | | 111 : thread_bundle_(content::TestBrowserThreadBundle::REAL_DB_THREAD | |
102 content::TestBrowserThreadBundle::REAL_FILE_THREAD | | 112 content::TestBrowserThreadBundle::REAL_FILE_THREAD | |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted); | 603 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted); |
594 | 604 |
595 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); | 605 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); |
596 sync_->Initialize(); | 606 sync_->Initialize(); |
597 | 607 |
598 sync_->SetSetupInProgress(true); | 608 sync_->SetSetupInProgress(true); |
599 IssueTestTokens(account_id); | 609 IssueTestTokens(account_id); |
600 sync_->SetSetupInProgress(false); | 610 sync_->SetSetupInProgress(false); |
601 EXPECT_FALSE(sync_->IsSyncActive()); | 611 EXPECT_FALSE(sync_->IsSyncActive()); |
602 } | 612 } |
OLD | NEW |