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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
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/signin/signin_manager.h" 7 #include "chrome/browser/signin/signin_manager.h"
8 #include "chrome/browser/signin/signin_manager_factory.h" 8 #include "chrome/browser/signin/signin_manager_factory.h"
9 #include "chrome/browser/sync/glue/data_type_controller.h" 9 #include "chrome/browser/sync/glue/data_type_controller.h"
10 #include "chrome/browser/sync/glue/sync_backend_host.h" 10 #include "chrome/browser/sync/glue/sync_backend_host.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 test_options.internal_components_factory->GetSwitches(); 81 test_options.internal_components_factory->GetSwitches();
82 delete test_options.internal_components_factory; 82 delete test_options.internal_components_factory;
83 83
84 test_options.internal_components_factory = 84 test_options.internal_components_factory =
85 new TestInternalComponentsFactory(factory_switches, storage); 85 new TestInternalComponentsFactory(factory_switches, storage);
86 86
87 SyncBackendHost::InitCore(test_options); 87 SyncBackendHost::InitCore(test_options);
88 if (synchronous_init_) { 88 if (synchronous_init_) {
89 // The SyncBackend posts a task to the current loop when 89 // The SyncBackend posts a task to the current loop when
90 // initialization completes. 90 // initialization completes.
91 MessageLoop::current()->Run(); 91 base::MessageLoop::current()->Run();
92 } 92 }
93 } 93 }
94 94
95 void SyncBackendHostForProfileSyncTest::UpdateCredentials( 95 void SyncBackendHostForProfileSyncTest::UpdateCredentials(
96 const syncer::SyncCredentials& credentials) { 96 const syncer::SyncCredentials& credentials) {
97 // If we had failed the initial download, complete initialization now. 97 // If we had failed the initial download, complete initialization now.
98 if (!initial_download_closure_.is_null()) { 98 if (!initial_download_closure_.is_null()) {
99 initial_download_closure_.Run(); 99 initial_download_closure_.Run();
100 initial_download_closure_.Reset(); 100 initial_download_closure_.Reset();
101 } 101 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 initial_download_closure_ = base::Bind( 160 initial_download_closure_ = base::Bind(
161 &SyncBackendHostForProfileSyncTest::ContinueInitialization, 161 &SyncBackendHostForProfileSyncTest::ContinueInitialization,
162 weak_ptr_factory_.GetWeakPtr(), 162 weak_ptr_factory_.GetWeakPtr(),
163 js_backend, 163 js_backend,
164 debug_info_listener, 164 debug_info_listener,
165 restored_types); 165 restored_types);
166 if (fail_initial_download_) { 166 if (fail_initial_download_) {
167 frontend()->OnSyncConfigureRetry(); 167 frontend()->OnSyncConfigureRetry();
168 if (synchronous_init_) 168 if (synchronous_init_)
169 MessageLoop::current()->Quit(); 169 base::MessageLoop::current()->Quit();
170 } else { 170 } else {
171 initial_download_closure_.Run(); 171 initial_download_closure_.Run();
172 initial_download_closure_.Reset(); 172 initial_download_closure_.Reset();
173 } 173 }
174 } 174 }
175 175
176 void SyncBackendHostForProfileSyncTest::EmitOnInvalidatorStateChange( 176 void SyncBackendHostForProfileSyncTest::EmitOnInvalidatorStateChange(
177 syncer::InvalidatorState state) { 177 syncer::InvalidatorState state) {
178 frontend()->OnInvalidatorStateChange(state); 178 frontend()->OnInvalidatorStateChange(state);
179 } 179 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 const syncer::WeakHandle<syncer::JsBackend>& backend, 247 const syncer::WeakHandle<syncer::JsBackend>& backend,
248 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& 248 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
249 debug_info_listener, 249 debug_info_listener,
250 bool success) { 250 bool success) {
251 ProfileSyncService::OnBackendInitialized(backend, 251 ProfileSyncService::OnBackendInitialized(backend,
252 debug_info_listener, 252 debug_info_listener,
253 success); 253 success);
254 254
255 // TODO(akalin): Figure out a better way to do this. 255 // TODO(akalin): Figure out a better way to do this.
256 if (synchronous_backend_initialization_) { 256 if (synchronous_backend_initialization_) {
257 MessageLoop::current()->Quit(); 257 base::MessageLoop::current()->Quit();
258 } 258 }
259 } 259 }
260 260
261 void TestProfileSyncService::OnConfigureDone( 261 void TestProfileSyncService::OnConfigureDone(
262 const browser_sync::DataTypeManager::ConfigureResult& result) { 262 const browser_sync::DataTypeManager::ConfigureResult& result) {
263 ProfileSyncService::OnConfigureDone(result); 263 ProfileSyncService::OnConfigureDone(result);
264 if (!synchronous_sync_configuration_) 264 if (!synchronous_sync_configuration_)
265 MessageLoop::current()->Quit(); 265 base::MessageLoop::current()->Quit();
266 } 266 }
267 267
268 UserShare* TestProfileSyncService::GetUserShare() const { 268 UserShare* TestProfileSyncService::GetUserShare() const {
269 return backend_->GetUserShare(); 269 return backend_->GetUserShare();
270 } 270 }
271 271
272 void TestProfileSyncService::dont_set_initial_sync_ended_on_init() { 272 void TestProfileSyncService::dont_set_initial_sync_ended_on_init() {
273 set_initial_sync_ended_on_init_ = false; 273 set_initial_sync_ended_on_init_ = false;
274 } 274 }
275 void TestProfileSyncService::set_synchronous_sync_configuration() { 275 void TestProfileSyncService::set_synchronous_sync_configuration() {
(...skipping 12 matching lines...) Expand all
288 profile(), 288 profile(),
289 sync_prefs_.AsWeakPtr(), 289 sync_prefs_.AsWeakPtr(),
290 invalidator_storage_.AsWeakPtr(), 290 invalidator_storage_.AsWeakPtr(),
291 id_factory_, 291 id_factory_,
292 callback_, 292 callback_,
293 set_initial_sync_ended_on_init_, 293 set_initial_sync_ended_on_init_,
294 synchronous_backend_initialization_, 294 synchronous_backend_initialization_,
295 fail_initial_download_, 295 fail_initial_download_,
296 storage_option_)); 296 storage_option_));
297 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698