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

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

Issue 10805002: [Sync] Enable adding notifier observers from ProfileSyncService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 4 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/sync/abstract_profile_sync_service_test.h" 8 #include "chrome/browser/sync/abstract_profile_sync_service_test.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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 test_options.restored_key_for_bootstrapping = ""; 67 test_options.restored_key_for_bootstrapping = "";
68 syncer::StorageOption storage = storage_option_; 68 syncer::StorageOption storage = storage_option_;
69 69
70 // It'd be nice if we avoided creating the InternalComponentsFactory in the 70 // It'd be nice if we avoided creating the InternalComponentsFactory in the
71 // first place, but SyncBackendHost will have created one by now so we must 71 // first place, but SyncBackendHost will have created one by now so we must
72 // free it. 72 // free it.
73 delete test_options.internal_components_factory; 73 delete test_options.internal_components_factory;
74 test_options.internal_components_factory = 74 test_options.internal_components_factory =
75 new TestInternalComponentsFactory(storage); 75 new TestInternalComponentsFactory(storage);
76 SyncBackendHost::InitCore(test_options); 76 SyncBackendHost::InitCore(test_options);
77 // TODO(akalin): Figure out a better way to do this.
78 if (synchronous_init_) { 77 if (synchronous_init_) {
79 // The SyncBackend posts a task to the current loop when 78 // The SyncBackend posts a task to the current loop when
80 // initialization completes. 79 // initialization completes.
81 MessageLoop::current()->Run(); 80 MessageLoop::current()->Run();
82 } 81 }
83 } 82 }
84 83
85 void SyncBackendHostForProfileSyncTest::RequestConfigureSyncer( 84 void SyncBackendHostForProfileSyncTest::RequestConfigureSyncer(
86 syncer::ConfigureReason reason, 85 syncer::ConfigureReason reason,
87 syncer::ModelTypeSet types_to_config, 86 syncer::ModelTypeSet types_to_config,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 UserShare* user_share = GetUserShare(); 134 UserShare* user_share = GetUserShare();
136 Directory* directory = user_share->directory.get(); 135 Directory* directory = user_share->directory.get();
137 136
138 for (int i = syncer::FIRST_REAL_MODEL_TYPE; 137 for (int i = syncer::FIRST_REAL_MODEL_TYPE;
139 i < syncer::MODEL_TYPE_COUNT; ++i) { 138 i < syncer::MODEL_TYPE_COUNT; ++i) {
140 directory->set_initial_sync_ended_for_type( 139 directory->set_initial_sync_ended_for_type(
141 syncer::ModelTypeFromInt(i), true); 140 syncer::ModelTypeFromInt(i), true);
142 } 141 }
143 } 142 }
144 143
144 void SyncBackendHostForProfileSyncTest::EmitOnNotificationsEnabled() {
145 frontend()->OnNotificationsEnabled();
146 }
147
148 void SyncBackendHostForProfileSyncTest::EmitOnNotificationsDisabled(
149 syncer::NotificationsDisabledReason reason) {
150 frontend()->OnNotificationsDisabled(reason);
151 }
152
153 void SyncBackendHostForProfileSyncTest::EmitOnIncomingNotification(
154 const syncer::ObjectIdPayloadMap& id_payloads,
155 const syncer::IncomingNotificationSource source) {
156 frontend()->OnIncomingNotification(id_payloads, source);
157 }
158
145 } // namespace browser_sync 159 } // namespace browser_sync
146 160
147 syncer::TestIdFactory* TestProfileSyncService::id_factory() { 161 syncer::TestIdFactory* TestProfileSyncService::id_factory() {
148 return &id_factory_; 162 return &id_factory_;
149 } 163 }
150 164
151 browser_sync::SyncBackendHostForProfileSyncTest* 165 browser_sync::SyncBackendHostForProfileSyncTest*
152 TestProfileSyncService::GetBackendForTest() { 166 TestProfileSyncService::GetBackendForTest() {
153 return static_cast<browser_sync::SyncBackendHostForProfileSyncTest*>( 167 return static_cast<browser_sync::SyncBackendHostForProfileSyncTest*>(
154 ProfileSyncService::GetBackendForTest()); 168 ProfileSyncService::GetBackendForTest());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 profile(), 237 profile(),
224 sync_prefs_.AsWeakPtr(), 238 sync_prefs_.AsWeakPtr(),
225 invalidator_storage_.AsWeakPtr(), 239 invalidator_storage_.AsWeakPtr(),
226 id_factory_, 240 id_factory_,
227 callback_, 241 callback_,
228 set_initial_sync_ended_on_init_, 242 set_initial_sync_ended_on_init_,
229 synchronous_backend_initialization_, 243 synchronous_backend_initialization_,
230 fail_initial_download_, 244 fail_initial_download_,
231 storage_option_)); 245 storage_option_));
232 } 246 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698