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

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: rebase again Created 7 years, 6 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 initial_download_closure_ = base::Bind( 163 initial_download_closure_ = base::Bind(
164 &SyncBackendHostForProfileSyncTest::ContinueInitialization, 164 &SyncBackendHostForProfileSyncTest::ContinueInitialization,
165 weak_ptr_factory_.GetWeakPtr(), 165 weak_ptr_factory_.GetWeakPtr(),
166 js_backend, 166 js_backend,
167 debug_info_listener, 167 debug_info_listener,
168 restored_types); 168 restored_types);
169 if (fail_initial_download_) { 169 if (fail_initial_download_) {
170 frontend()->OnSyncConfigureRetry(); 170 frontend()->OnSyncConfigureRetry();
171 if (synchronous_init_) 171 if (synchronous_init_)
172 MessageLoop::current()->Quit(); 172 base::MessageLoop::current()->Quit();
173 } else { 173 } else {
174 initial_download_closure_.Run(); 174 initial_download_closure_.Run();
175 initial_download_closure_.Reset(); 175 initial_download_closure_.Reset();
176 } 176 }
177 } 177 }
178 178
179 void SyncBackendHostForProfileSyncTest::EmitOnInvalidatorStateChange( 179 void SyncBackendHostForProfileSyncTest::EmitOnInvalidatorStateChange(
180 syncer::InvalidatorState state) { 180 syncer::InvalidatorState state) {
181 frontend()->OnInvalidatorStateChange(state); 181 frontend()->OnInvalidatorStateChange(state);
182 } 182 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 const syncer::WeakHandle<syncer::JsBackend>& backend, 251 const syncer::WeakHandle<syncer::JsBackend>& backend,
252 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& 252 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
253 debug_info_listener, 253 debug_info_listener,
254 bool success) { 254 bool success) {
255 ProfileSyncService::OnBackendInitialized(backend, 255 ProfileSyncService::OnBackendInitialized(backend,
256 debug_info_listener, 256 debug_info_listener,
257 success); 257 success);
258 258
259 // TODO(akalin): Figure out a better way to do this. 259 // TODO(akalin): Figure out a better way to do this.
260 if (synchronous_backend_initialization_) { 260 if (synchronous_backend_initialization_) {
261 MessageLoop::current()->Quit(); 261 base::MessageLoop::current()->Quit();
262 } 262 }
263 } 263 }
264 264
265 void TestProfileSyncService::OnConfigureDone( 265 void TestProfileSyncService::OnConfigureDone(
266 const browser_sync::DataTypeManager::ConfigureResult& result) { 266 const browser_sync::DataTypeManager::ConfigureResult& result) {
267 ProfileSyncService::OnConfigureDone(result); 267 ProfileSyncService::OnConfigureDone(result);
268 if (!synchronous_sync_configuration_) 268 if (!synchronous_sync_configuration_)
269 MessageLoop::current()->Quit(); 269 base::MessageLoop::current()->Quit();
270 } 270 }
271 271
272 UserShare* TestProfileSyncService::GetUserShare() const { 272 UserShare* TestProfileSyncService::GetUserShare() const {
273 return backend_->GetUserShare(); 273 return backend_->GetUserShare();
274 } 274 }
275 275
276 void TestProfileSyncService::dont_set_initial_sync_ended_on_init() { 276 void TestProfileSyncService::dont_set_initial_sync_ended_on_init() {
277 set_initial_sync_ended_on_init_ = false; 277 set_initial_sync_ended_on_init_ = false;
278 } 278 }
279 void TestProfileSyncService::set_synchronous_sync_configuration() { 279 void TestProfileSyncService::set_synchronous_sync_configuration() {
(...skipping 12 matching lines...) Expand all
292 profile(), 292 profile(),
293 sync_prefs_.AsWeakPtr(), 293 sync_prefs_.AsWeakPtr(),
294 invalidator_storage_.AsWeakPtr(), 294 invalidator_storage_.AsWeakPtr(),
295 id_factory_, 295 id_factory_,
296 callback_, 296 callback_,
297 set_initial_sync_ended_on_init_, 297 set_initial_sync_ended_on_init_,
298 synchronous_backend_initialization_, 298 synchronous_backend_initialization_,
299 fail_initial_download_, 299 fail_initial_download_,
300 storage_option_)); 300 storage_option_));
301 } 301 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.cc ('k') | chrome/browser/sync_file_system/drive/api_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698