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

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

Issue 367153005: Sync: Refactoring of DEVICE_INFO syncable type - Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed scoped_ptr issue in ProfileSyncService constructor Created 6 years, 5 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) 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 "chrome/browser/sync/test_profile_sync_service.h" 5 #include "chrome/browser/sync/test_profile_sync_service.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" 8 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 syncer::TestIdFactory* TestProfileSyncService::id_factory() { 96 syncer::TestIdFactory* TestProfileSyncService::id_factory() {
97 return &id_factory_; 97 return &id_factory_;
98 } 98 }
99 99
100 syncer::WeakHandle<syncer::JsEventHandler> 100 syncer::WeakHandle<syncer::JsEventHandler>
101 TestProfileSyncService::GetJsEventHandler() { 101 TestProfileSyncService::GetJsEventHandler() {
102 return syncer::WeakHandle<syncer::JsEventHandler>(); 102 return syncer::WeakHandle<syncer::JsEventHandler>();
103 } 103 }
104 104
105 TestProfileSyncService::TestProfileSyncService( 105 TestProfileSyncService::TestProfileSyncService(
106 ProfileSyncComponentsFactory* factory, 106 scoped_ptr<ProfileSyncComponentsFactory> factory,
107 Profile* profile, 107 Profile* profile,
108 SigninManagerBase* signin, 108 SigninManagerBase* signin,
109 ProfileOAuth2TokenService* oauth2_token_service, 109 ProfileOAuth2TokenService* oauth2_token_service,
110 browser_sync::ProfileSyncServiceStartBehavior behavior) 110 browser_sync::ProfileSyncServiceStartBehavior behavior)
111 : ProfileSyncService( 111 : ProfileSyncService(
112 factory, 112 factory.Pass(),
113 profile, 113 profile,
114 make_scoped_ptr(new SupervisedUserSigninManagerWrapper(profile, 114 make_scoped_ptr(new SupervisedUserSigninManagerWrapper(profile,
115 signin)), 115 signin)),
116 oauth2_token_service, 116 oauth2_token_service,
117 behavior) { 117 behavior) {
118 SetSyncSetupCompleted(); 118 SetSyncSetupCompleted();
119 } 119 }
120 120
121 TestProfileSyncService::~TestProfileSyncService() { 121 TestProfileSyncService::~TestProfileSyncService() {
122 } 122 }
123 123
124 // static 124 // static
125 KeyedService* TestProfileSyncService::TestFactoryFunction( 125 KeyedService* TestProfileSyncService::TestFactoryFunction(
126 content::BrowserContext* context) { 126 content::BrowserContext* context) {
127 Profile* profile = static_cast<Profile*>(context); 127 Profile* profile = static_cast<Profile*>(context);
128 SigninManagerBase* signin = 128 SigninManagerBase* signin =
129 SigninManagerFactory::GetForProfile(profile); 129 SigninManagerFactory::GetForProfile(profile);
130 ProfileOAuth2TokenService* oauth2_token_service = 130 ProfileOAuth2TokenService* oauth2_token_service =
131 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 131 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
132 ProfileSyncComponentsFactoryMock* factory = 132 return new TestProfileSyncService(
133 new ProfileSyncComponentsFactoryMock(); 133 scoped_ptr<ProfileSyncComponentsFactory>(
134 return new TestProfileSyncService(factory, 134 new ProfileSyncComponentsFactoryMock()),
135 profile, 135 profile,
136 signin, 136 signin,
137 oauth2_token_service, 137 oauth2_token_service,
138 browser_sync::AUTO_START); 138 browser_sync::AUTO_START);
139 } 139 }
140 140
141 // static 141 // static
142 TestProfileSyncService* TestProfileSyncService::BuildAutoStartAsyncInit( 142 TestProfileSyncService* TestProfileSyncService::BuildAutoStartAsyncInit(
143 Profile* profile, base::Closure callback) { 143 Profile* profile, base::Closure callback) {
144 TestProfileSyncService* sync_service = static_cast<TestProfileSyncService*>( 144 TestProfileSyncService* sync_service = static_cast<TestProfileSyncService*>(
145 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( 145 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
146 profile, &TestProfileSyncService::TestFactoryFunction)); 146 profile, &TestProfileSyncService::TestFactoryFunction));
147 ProfileSyncComponentsFactoryMock* components = 147 ProfileSyncComponentsFactoryMock* components =
148 sync_service->components_factory_mock(); 148 sync_service->components_factory_mock();
(...skipping 19 matching lines...) Expand all
168 168
169 void TestProfileSyncService::OnConfigureDone( 169 void TestProfileSyncService::OnConfigureDone(
170 const browser_sync::DataTypeManager::ConfigureResult& result) { 170 const browser_sync::DataTypeManager::ConfigureResult& result) {
171 ProfileSyncService::OnConfigureDone(result); 171 ProfileSyncService::OnConfigureDone(result);
172 base::MessageLoop::current()->Quit(); 172 base::MessageLoop::current()->Quit();
173 } 173 }
174 174
175 UserShare* TestProfileSyncService::GetUserShare() const { 175 UserShare* TestProfileSyncService::GetUserShare() const {
176 return backend_->GetUserShare(); 176 return backend_->GetUserShare();
177 } 177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698