OLD | NEW |
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 "sync/internal_api/public/test/fake_sync_manager.h" | 5 #include "sync/internal_api/public/test/fake_sync_manager.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
16 #include "sync/internal_api/public/http_post_provider_factory.h" | 16 #include "sync/internal_api/public/http_post_provider_factory.h" |
17 #include "sync/internal_api/public/internal_components_factory.h" | 17 #include "sync/internal_api/public/internal_components_factory.h" |
18 #include "sync/internal_api/public/util/weak_handle.h" | 18 #include "sync/internal_api/public/util/weak_handle.h" |
19 #include "sync/notifier/notifications_disabled_reason.h" | 19 #include "sync/notifier/notifications_disabled_reason.h" |
| 20 #include "sync/notifier/invalidator.h" |
20 #include "sync/notifier/object_id_state_map.h" | 21 #include "sync/notifier/object_id_state_map.h" |
21 #include "sync/notifier/sync_notifier.h" | |
22 #include "sync/test/fake_sync_encryption_handler.h" | 22 #include "sync/test/fake_sync_encryption_handler.h" |
23 | 23 |
24 namespace syncer { | 24 namespace syncer { |
25 | 25 |
26 FakeSyncManager::FakeSyncManager(ModelTypeSet initial_sync_ended_types, | 26 FakeSyncManager::FakeSyncManager(ModelTypeSet initial_sync_ended_types, |
27 ModelTypeSet progress_marker_types, | 27 ModelTypeSet progress_marker_types, |
28 ModelTypeSet configure_fail_types) : | 28 ModelTypeSet configure_fail_types) : |
29 initial_sync_ended_types_(initial_sync_ended_types), | 29 initial_sync_ended_types_(initial_sync_ended_types), |
30 progress_marker_types_(progress_marker_types), | 30 progress_marker_types_(progress_marker_types), |
31 configure_fail_types_(configure_fail_types) { | 31 configure_fail_types_(configure_fail_types) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 const WeakHandle<JsEventHandler>& event_handler, | 104 const WeakHandle<JsEventHandler>& event_handler, |
105 const std::string& sync_server_and_path, | 105 const std::string& sync_server_and_path, |
106 int sync_server_port, | 106 int sync_server_port, |
107 bool use_ssl, | 107 bool use_ssl, |
108 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 108 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
109 scoped_ptr<HttpPostProviderFactory> post_factory, | 109 scoped_ptr<HttpPostProviderFactory> post_factory, |
110 const std::vector<ModelSafeWorker*>& workers, | 110 const std::vector<ModelSafeWorker*>& workers, |
111 ExtensionsActivityMonitor* extensions_activity_monitor, | 111 ExtensionsActivityMonitor* extensions_activity_monitor, |
112 ChangeDelegate* change_delegate, | 112 ChangeDelegate* change_delegate, |
113 const SyncCredentials& credentials, | 113 const SyncCredentials& credentials, |
114 scoped_ptr<SyncNotifier> sync_notifier, | 114 scoped_ptr<Invalidator> invalidator, |
115 const std::string& restored_key_for_bootstrapping, | 115 const std::string& restored_key_for_bootstrapping, |
116 const std::string& restored_keystore_key_for_bootstrapping, | 116 const std::string& restored_keystore_key_for_bootstrapping, |
117 scoped_ptr<InternalComponentsFactory> internal_components_factory, | 117 scoped_ptr<InternalComponentsFactory> internal_components_factory, |
118 Encryptor* encryptor, | 118 Encryptor* encryptor, |
119 UnrecoverableErrorHandler* unrecoverable_error_handler, | 119 UnrecoverableErrorHandler* unrecoverable_error_handler, |
120 ReportUnrecoverableErrorFunction | 120 ReportUnrecoverableErrorFunction |
121 report_unrecoverable_error_function) { | 121 report_unrecoverable_error_function) { |
122 sync_task_runner_ = base::ThreadTaskRunnerHandle::Get(); | 122 sync_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
123 PurgePartiallySyncedTypes(); | 123 PurgePartiallySyncedTypes(); |
124 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 124 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 void FakeSyncManager::UpdateCredentials(const SyncCredentials& credentials) { | 157 void FakeSyncManager::UpdateCredentials(const SyncCredentials& credentials) { |
158 NOTIMPLEMENTED(); | 158 NOTIMPLEMENTED(); |
159 } | 159 } |
160 | 160 |
161 void FakeSyncManager::UpdateEnabledTypes(const ModelTypeSet& types) { | 161 void FakeSyncManager::UpdateEnabledTypes(const ModelTypeSet& types) { |
162 enabled_types_ = types; | 162 enabled_types_ = types; |
163 } | 163 } |
164 | 164 |
165 void FakeSyncManager::RegisterInvalidationHandler( | 165 void FakeSyncManager::RegisterInvalidationHandler( |
166 SyncNotifierObserver* handler) { | 166 InvalidationHandler* handler) { |
167 registrar_.RegisterHandler(handler); | 167 registrar_.RegisterHandler(handler); |
168 } | 168 } |
169 | 169 |
170 void FakeSyncManager::UpdateRegisteredInvalidationIds( | 170 void FakeSyncManager::UpdateRegisteredInvalidationIds( |
171 SyncNotifierObserver* handler, | 171 InvalidationHandler* handler, |
172 const ObjectIdSet& ids) { | 172 const ObjectIdSet& ids) { |
173 registrar_.UpdateRegisteredIds(handler, ids); | 173 registrar_.UpdateRegisteredIds(handler, ids); |
174 } | 174 } |
175 | 175 |
176 void FakeSyncManager::UnregisterInvalidationHandler( | 176 void FakeSyncManager::UnregisterInvalidationHandler( |
177 SyncNotifierObserver* handler) { | 177 InvalidationHandler* handler) { |
178 registrar_.UnregisterHandler(handler); | 178 registrar_.UnregisterHandler(handler); |
179 } | 179 } |
180 | 180 |
181 void FakeSyncManager::StartSyncingNormally( | 181 void FakeSyncManager::StartSyncingNormally( |
182 const ModelSafeRoutingInfo& routing_info) { | 182 const ModelSafeRoutingInfo& routing_info) { |
183 // Do nothing. | 183 // Do nothing. |
184 } | 184 } |
185 | 185 |
186 void FakeSyncManager::ConfigureSyncer( | 186 void FakeSyncManager::ConfigureSyncer( |
187 ConfigureReason reason, | 187 ConfigureReason reason, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 registrar_.EmitOnNotificationsEnabled(); | 276 registrar_.EmitOnNotificationsEnabled(); |
277 } | 277 } |
278 | 278 |
279 void FakeSyncManager::DisableNotificationsOnSyncThread( | 279 void FakeSyncManager::DisableNotificationsOnSyncThread( |
280 NotificationsDisabledReason reason) { | 280 NotificationsDisabledReason reason) { |
281 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); | 281 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); |
282 registrar_.EmitOnNotificationsDisabled(reason); | 282 registrar_.EmitOnNotificationsDisabled(reason); |
283 } | 283 } |
284 | 284 |
285 } // namespace syncer | 285 } // namespace syncer |
OLD | NEW |