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

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

Issue 15580002: Make use of InvalidationService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More review fixes 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
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 18 matching lines...) Expand all
29 using syncer::DEVICE_INFO; 29 using syncer::DEVICE_INFO;
30 using syncer::EXPERIMENTS; 30 using syncer::EXPERIMENTS;
31 using syncer::NIGORI; 31 using syncer::NIGORI;
32 using syncer::PRIORITY_PREFERENCES; 32 using syncer::PRIORITY_PREFERENCES;
33 33
34 namespace browser_sync { 34 namespace browser_sync {
35 35
36 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest( 36 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest(
37 Profile* profile, 37 Profile* profile,
38 const base::WeakPtr<SyncPrefs>& sync_prefs, 38 const base::WeakPtr<SyncPrefs>& sync_prefs,
39 const base::WeakPtr<invalidation::InvalidatorStorage>& invalidator_storage,
40 syncer::TestIdFactory& id_factory, 39 syncer::TestIdFactory& id_factory,
41 base::Closure& callback, 40 base::Closure& callback,
42 bool set_initial_sync_ended_on_init, 41 bool set_initial_sync_ended_on_init,
43 bool synchronous_init, 42 bool synchronous_init,
44 bool fail_initial_download, 43 bool fail_initial_download,
45 syncer::StorageOption storage_option) 44 syncer::StorageOption storage_option)
46 : browser_sync::SyncBackendHost( 45 : browser_sync::SyncBackendHost(
47 profile->GetDebugName(), profile, sync_prefs, invalidator_storage), 46 profile->GetDebugName(), profile, sync_prefs),
48 weak_ptr_factory_(this), 47 weak_ptr_factory_(this),
49 id_factory_(id_factory), 48 id_factory_(id_factory),
50 callback_(callback), 49 callback_(callback),
51 fail_initial_download_(fail_initial_download), 50 fail_initial_download_(fail_initial_download),
52 set_initial_sync_ended_on_init_(set_initial_sync_ended_on_init), 51 set_initial_sync_ended_on_init_(set_initial_sync_ended_on_init),
53 synchronous_init_(synchronous_init), 52 synchronous_init_(synchronous_init),
54 storage_option_(storage_option) {} 53 storage_option_(storage_option) {}
55 54
56 SyncBackendHostForProfileSyncTest::~SyncBackendHostForProfileSyncTest() {} 55 SyncBackendHostForProfileSyncTest::~SyncBackendHostForProfileSyncTest() {}
57 56
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 syncer::ModelTypeSet types_to_config, 105 syncer::ModelTypeSet types_to_config,
107 syncer::ModelTypeSet failed_types, 106 syncer::ModelTypeSet failed_types,
108 const syncer::ModelSafeRoutingInfo& routing_info, 107 const syncer::ModelSafeRoutingInfo& routing_info,
109 const base::Callback<void(syncer::ModelTypeSet, 108 const base::Callback<void(syncer::ModelTypeSet,
110 syncer::ModelTypeSet)>& ready_task, 109 syncer::ModelTypeSet)>& ready_task,
111 const base::Closure& retry_callback) { 110 const base::Closure& retry_callback) {
112 syncer::ModelTypeSet failed_configuration_types; 111 syncer::ModelTypeSet failed_configuration_types;
113 if (fail_initial_download_) 112 if (fail_initial_download_)
114 failed_configuration_types = types_to_config; 113 failed_configuration_types = types_to_config;
115 114
115 // The first parameter there shoudl be the set of enabled types. That's not
akalin 2013/05/24 22:58:46 shoudl -> should
rlarocque 2013/05/29 00:37:55 Done.
116 // something we have access to from this strange test harness. We'll just
117 // send back the list of newly configured types instead and hope it doesn't
118 // break anything.
116 FinishConfigureDataTypesOnFrontendLoop( 119 FinishConfigureDataTypesOnFrontendLoop(
117 syncer::Difference(types_to_config, failed_configuration_types), 120 syncer::Difference(types_to_config, failed_configuration_types),
121 syncer::Difference(types_to_config, failed_configuration_types),
118 failed_configuration_types, 122 failed_configuration_types,
119 ready_task); 123 ready_task);
120 } 124 }
121 125
122 void SyncBackendHostForProfileSyncTest 126 void SyncBackendHostForProfileSyncTest
123 ::HandleSyncManagerInitializationOnFrontendLoop( 127 ::HandleSyncManagerInitializationOnFrontendLoop(
124 const syncer::WeakHandle<syncer::JsBackend>& js_backend, 128 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
125 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& 129 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
126 debug_info_listener, 130 debug_info_listener,
127 syncer::ModelTypeSet restored_types) { 131 syncer::ModelTypeSet restored_types) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 if (fail_initial_download_) { 173 if (fail_initial_download_) {
170 frontend()->OnSyncConfigureRetry(); 174 frontend()->OnSyncConfigureRetry();
171 if (synchronous_init_) 175 if (synchronous_init_)
172 MessageLoop::current()->Quit(); 176 MessageLoop::current()->Quit();
173 } else { 177 } else {
174 initial_download_closure_.Run(); 178 initial_download_closure_.Run();
175 initial_download_closure_.Reset(); 179 initial_download_closure_.Reset();
176 } 180 }
177 } 181 }
178 182
179 void SyncBackendHostForProfileSyncTest::EmitOnInvalidatorStateChange(
180 syncer::InvalidatorState state) {
181 frontend()->OnInvalidatorStateChange(state);
182 }
183
184 void SyncBackendHostForProfileSyncTest::EmitOnIncomingInvalidation(
185 const syncer::ObjectIdInvalidationMap& invalidation_map) {
186 frontend()->OnIncomingInvalidation(invalidation_map);
187 }
188
189 void SyncBackendHostForProfileSyncTest::ContinueInitialization( 183 void SyncBackendHostForProfileSyncTest::ContinueInitialization(
190 const syncer::WeakHandle<syncer::JsBackend>& js_backend, 184 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
191 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& 185 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
192 debug_info_listener, 186 debug_info_listener,
193 syncer::ModelTypeSet restored_types) { 187 syncer::ModelTypeSet restored_types) {
194 SyncBackendHost::HandleSyncManagerInitializationOnFrontendLoop( 188 SyncBackendHost::HandleSyncManagerInitializationOnFrontendLoop(
195 js_backend, debug_info_listener, restored_types); 189 js_backend, debug_info_listener, restored_types);
196 } 190 }
197 191
198 } // namespace browser_sync 192 } // namespace browser_sync
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 278 }
285 void TestProfileSyncService::set_storage_option( 279 void TestProfileSyncService::set_storage_option(
286 syncer::StorageOption storage_option) { 280 syncer::StorageOption storage_option) {
287 storage_option_ = storage_option; 281 storage_option_ = storage_option;
288 } 282 }
289 283
290 void TestProfileSyncService::CreateBackend() { 284 void TestProfileSyncService::CreateBackend() {
291 backend_.reset(new browser_sync::SyncBackendHostForProfileSyncTest( 285 backend_.reset(new browser_sync::SyncBackendHostForProfileSyncTest(
292 profile(), 286 profile(),
293 sync_prefs_.AsWeakPtr(), 287 sync_prefs_.AsWeakPtr(),
294 invalidator_storage_.AsWeakPtr(),
295 id_factory_, 288 id_factory_,
296 callback_, 289 callback_,
297 set_initial_sync_ended_on_init_, 290 set_initial_sync_ended_on_init_,
298 synchronous_backend_initialization_, 291 synchronous_backend_initialization_,
299 fail_initial_download_, 292 fail_initial_download_,
300 storage_option_)); 293 storage_option_));
301 } 294 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698