Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: chrome/browser/sync/profile_sync_test_util.cc

Issue 1607473003: Create profile_sync_test_util in components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix iOS Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/profile_sync_test_util.h" 5 #include "chrome/browser/sync/profile_sync_test_util.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.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/common/channel_info.h" 15 #include "chrome/common/channel_info.h"
16 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
17 #include "components/browser_sync/browser/profile_sync_service.h" 17 #include "components/browser_sync/browser/profile_sync_service.h"
18 #include "components/browser_sync/browser/profile_sync_test_util.h"
18 #include "components/signin/core/browser/signin_manager.h" 19 #include "components/signin/core/browser/signin_manager.h"
19 #include "components/sync_driver/signin_manager_wrapper.h" 20 #include "components/sync_driver/signin_manager_wrapper.h"
20 #include "components/sync_driver/startup_controller.h" 21 #include "components/sync_driver/startup_controller.h"
21 #include "components/sync_driver/sync_api_component_factory_mock.h" 22 #include "components/sync_driver/sync_api_component_factory_mock.h"
22 23
23 using content::BrowserThread; 24 using content::BrowserThread;
24 25
25 void EmptyNetworkTimeUpdate(const base::Time&,
26 const base::TimeDelta&,
27 const base::TimeDelta&) {}
28
29 SyncServiceObserverMock::SyncServiceObserverMock() {
30 }
31
32 SyncServiceObserverMock::~SyncServiceObserverMock() {
33 }
34
35 ThreadNotifier::ThreadNotifier(base::Thread* notify_thread) 26 ThreadNotifier::ThreadNotifier(base::Thread* notify_thread)
36 : done_event_(false, false), 27 : done_event_(false, false),
37 notify_thread_(notify_thread) {} 28 notify_thread_(notify_thread) {}
38 29
39 void ThreadNotifier::Notify(int type, 30 void ThreadNotifier::Notify(int type,
40 const content::NotificationDetails& details) { 31 const content::NotificationDetails& details) {
41 Notify(type, content::NotificationService::AllSources(), details); 32 Notify(type, content::NotificationService::AllSources(), details);
42 } 33 }
43 34
44 void ThreadNotifier::Notify(int type, 35 void ThreadNotifier::Notify(int type,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 Profile* profile) { 70 Profile* profile) {
80 ProfileSyncService::InitParams init_params; 71 ProfileSyncService::InitParams init_params;
81 72
82 init_params.signin_wrapper = make_scoped_ptr( 73 init_params.signin_wrapper = make_scoped_ptr(
83 new SigninManagerWrapper(SigninManagerFactory::GetForProfile(profile))); 74 new SigninManagerWrapper(SigninManagerFactory::GetForProfile(profile)));
84 init_params.oauth2_token_service = 75 init_params.oauth2_token_service =
85 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 76 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
86 init_params.start_behavior = browser_sync::MANUAL_START; 77 init_params.start_behavior = browser_sync::MANUAL_START;
87 init_params.sync_client = std::move(sync_client); 78 init_params.sync_client = std::move(sync_client);
88 init_params.network_time_update_callback = 79 init_params.network_time_update_callback =
89 base::Bind(&EmptyNetworkTimeUpdate); 80 base::Bind(&browser_sync::EmptyNetworkTimeUpdate);
90 init_params.base_directory = profile->GetPath(); 81 init_params.base_directory = profile->GetPath();
91 init_params.url_request_context = profile->GetRequestContext(); 82 init_params.url_request_context = profile->GetRequestContext();
92 init_params.debug_identifier = profile->GetDebugName(); 83 init_params.debug_identifier = profile->GetDebugName();
93 init_params.channel = chrome::GetChannel(); 84 init_params.channel = chrome::GetChannel();
94 init_params.db_thread = content::BrowserThread::GetMessageLoopProxyForThread( 85 init_params.db_thread = content::BrowserThread::GetMessageLoopProxyForThread(
95 content::BrowserThread::DB); 86 content::BrowserThread::DB);
96 init_params.file_thread = 87 init_params.file_thread =
97 content::BrowserThread::GetMessageLoopProxyForThread( 88 content::BrowserThread::GetMessageLoopProxyForThread(
98 content::BrowserThread::FILE); 89 content::BrowserThread::FILE);
99 init_params.blocking_pool = content::BrowserThread::GetBlockingPool(); 90 init_params.blocking_pool = content::BrowserThread::GetBlockingPool();
100 91
101 return init_params; 92 return init_params;
102 } 93 }
103 94
104 scoped_ptr<TestingProfile> MakeSignedInTestingProfile() { 95 scoped_ptr<TestingProfile> MakeSignedInTestingProfile() {
105 auto profile = make_scoped_ptr(new TestingProfile()); 96 auto profile = make_scoped_ptr(new TestingProfile());
106 SigninManagerFactory::GetForProfile(profile.get()) 97 SigninManagerFactory::GetForProfile(profile.get())
107 ->SetAuthenticatedAccountInfo("12345", "foo"); 98 ->SetAuthenticatedAccountInfo("12345", "foo");
108 return profile; 99 return profile;
109 } 100 }
110 101
111 scoped_ptr<KeyedService> BuildMockProfileSyncService( 102 scoped_ptr<KeyedService> BuildMockProfileSyncService(
112 content::BrowserContext* context) { 103 content::BrowserContext* context) {
113 return make_scoped_ptr( 104 return make_scoped_ptr(
114 new ProfileSyncServiceMock(CreateProfileSyncServiceParamsForTest( 105 new ProfileSyncServiceMock(CreateProfileSyncServiceParamsForTest(
115 Profile::FromBrowserContext(context)))); 106 Profile::FromBrowserContext(context))));
116 } 107 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_test_util.h ('k') | chrome/browser/sync/test_profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698