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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "chrome/browser/signin/account_tracker_service_factory.h" | 12 #include "chrome/browser/signin/account_tracker_service_factory.h" |
13 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 13 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
14 #include "chrome/browser/signin/fake_signin_manager_builder.h" | 14 #include "chrome/browser/signin/fake_signin_manager_builder.h" |
15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
16 #include "chrome/browser/signin/signin_manager_factory.h" | 16 #include "chrome/browser/signin/signin_manager_factory.h" |
17 #include "chrome/browser/sync/chrome_sync_client.h" | 17 #include "chrome/browser/sync/chrome_sync_client.h" |
18 #include "chrome/browser/sync/profile_sync_service_factory.h" | 18 #include "chrome/browser/sync/profile_sync_service_factory.h" |
19 #include "chrome/browser/sync/profile_sync_test_util.h" | |
20 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" | 19 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" |
21 #include "chrome/common/channel_info.h" | 20 #include "chrome/common/channel_info.h" |
22 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
23 #include "chrome/test/base/testing_browser_process.h" | 22 #include "chrome/test/base/testing_browser_process.h" |
24 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
25 #include "chrome/test/base/testing_profile_manager.h" | 24 #include "chrome/test/base/testing_profile_manager.h" |
26 #include "components/browser_sync/browser/profile_sync_service.h" | 25 #include "components/browser_sync/browser/profile_sync_service.h" |
| 26 #include "components/browser_sync/browser/profile_sync_test_util.h" |
27 #include "components/signin/core/browser/account_tracker_service.h" | 27 #include "components/signin/core/browser/account_tracker_service.h" |
28 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 28 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
29 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 29 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
30 #include "components/signin/core/browser/signin_manager.h" | 30 #include "components/signin/core/browser/signin_manager.h" |
31 #include "components/signin/core/common/signin_pref_names.h" | 31 #include "components/signin/core/common/signin_pref_names.h" |
32 #include "components/sync_driver/data_type_manager.h" | 32 #include "components/sync_driver/data_type_manager.h" |
33 #include "components/sync_driver/data_type_manager_mock.h" | 33 #include "components/sync_driver/data_type_manager_mock.h" |
34 #include "components/sync_driver/glue/sync_backend_host_mock.h" | 34 #include "components/sync_driver/glue/sync_backend_host_mock.h" |
35 #include "components/sync_driver/pref_names.h" | 35 #include "components/sync_driver/pref_names.h" |
36 #include "components/sync_driver/sync_api_component_factory_mock.h" | 36 #include "components/sync_driver/sync_api_component_factory_mock.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 scoped_ptr<SigninManagerWrapper> signin_wrapper, | 68 scoped_ptr<SigninManagerWrapper> signin_wrapper, |
69 ProfileOAuth2TokenService* oauth2_token_service, | 69 ProfileOAuth2TokenService* oauth2_token_service, |
70 browser_sync::ProfileSyncServiceStartBehavior start_behavior) { | 70 browser_sync::ProfileSyncServiceStartBehavior start_behavior) { |
71 ProfileSyncService::InitParams init_params; | 71 ProfileSyncService::InitParams init_params; |
72 | 72 |
73 init_params.signin_wrapper = std::move(signin_wrapper); | 73 init_params.signin_wrapper = std::move(signin_wrapper); |
74 init_params.oauth2_token_service = oauth2_token_service; | 74 init_params.oauth2_token_service = oauth2_token_service; |
75 init_params.start_behavior = start_behavior; | 75 init_params.start_behavior = start_behavior; |
76 init_params.sync_client = std::move(sync_client); | 76 init_params.sync_client = std::move(sync_client); |
77 init_params.network_time_update_callback = | 77 init_params.network_time_update_callback = |
78 base::Bind(&EmptyNetworkTimeUpdate); | 78 base::Bind(&browser_sync::EmptyNetworkTimeUpdate); |
79 init_params.base_directory = profile->GetPath(); | 79 init_params.base_directory = profile->GetPath(); |
80 init_params.url_request_context = profile->GetRequestContext(); | 80 init_params.url_request_context = profile->GetRequestContext(); |
81 init_params.debug_identifier = profile->GetDebugName(); | 81 init_params.debug_identifier = profile->GetDebugName(); |
82 init_params.channel = chrome::GetChannel(); | 82 init_params.channel = chrome::GetChannel(); |
83 init_params.db_thread = content::BrowserThread::GetMessageLoopProxyForThread( | 83 init_params.db_thread = content::BrowserThread::GetMessageLoopProxyForThread( |
84 content::BrowserThread::DB); | 84 content::BrowserThread::DB); |
85 init_params.file_thread = | 85 init_params.file_thread = |
86 content::BrowserThread::GetMessageLoopProxyForThread( | 86 content::BrowserThread::GetMessageLoopProxyForThread( |
87 content::BrowserThread::FILE); | 87 content::BrowserThread::FILE); |
88 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); | 88 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 EXPECT_CALL(*GetSyncApiComponentFactoryMock(), | 236 EXPECT_CALL(*GetSyncApiComponentFactoryMock(), |
237 CreateSyncBackendHost(_, _, _, _)) | 237 CreateSyncBackendHost(_, _, _, _)) |
238 .WillOnce(Return(sync_backend_host)); | 238 .WillOnce(Return(sync_backend_host)); |
239 return sync_backend_host; | 239 return sync_backend_host; |
240 } | 240 } |
241 | 241 |
242 content::TestBrowserThreadBundle thread_bundle_; | 242 content::TestBrowserThreadBundle thread_bundle_; |
243 TestingProfileManager profile_manager_; | 243 TestingProfileManager profile_manager_; |
244 TestingProfile* profile_; | 244 TestingProfile* profile_; |
245 ProfileSyncService* sync_; | 245 ProfileSyncService* sync_; |
246 SyncServiceObserverMock observer_; | 246 browser_sync::SyncServiceObserverMock observer_; |
247 sync_driver::DataTypeStatusTable data_type_status_table_; | 247 sync_driver::DataTypeStatusTable data_type_status_table_; |
248 }; | 248 }; |
249 | 249 |
250 class ProfileSyncServiceStartupCrosTest : public ProfileSyncServiceStartupTest { | 250 class ProfileSyncServiceStartupCrosTest : public ProfileSyncServiceStartupTest { |
251 public: | 251 public: |
252 void SetUp() override { | 252 void SetUp() override { |
253 ProfileSyncServiceStartupTest::SetUp(); | 253 ProfileSyncServiceStartupTest::SetUp(); |
254 sync_ = static_cast<ProfileSyncService*>( | 254 sync_ = static_cast<ProfileSyncService*>( |
255 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 255 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
256 profile_, BuildCrosService)); | 256 profile_, BuildCrosService)); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncFirstSetupComplete); | 596 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncFirstSetupComplete); |
597 | 597 |
598 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); | 598 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); |
599 sync_->Initialize(); | 599 sync_->Initialize(); |
600 | 600 |
601 sync_->SetSetupInProgress(true); | 601 sync_->SetSetupInProgress(true); |
602 IssueTestTokens(account_id); | 602 IssueTestTokens(account_id); |
603 sync_->SetSetupInProgress(false); | 603 sync_->SetSetupInProgress(false); |
604 EXPECT_FALSE(sync_->IsSyncActive()); | 604 EXPECT_FALSE(sync_->IsSyncActive()); |
605 } | 605 } |
OLD | NEW |