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/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
15 #include "sync/internal_api/public/http_post_provider_factory.h" | 15 #include "sync/internal_api/public/http_post_provider_factory.h" |
16 #include "sync/internal_api/public/internal_components_factory.h" | 16 #include "sync/internal_api/public/internal_components_factory.h" |
17 #include "sync/internal_api/public/util/weak_handle.h" | 17 #include "sync/internal_api/public/util/weak_handle.h" |
18 #include "sync/notifier/notifications_disabled_reason.h" | 18 #include "sync/notifier/notifications_disabled_reason.h" |
19 #include "sync/notifier/object_id_payload_map.h" | 19 #include "sync/notifier/object_id_payload_map.h" |
20 #include "sync/notifier/sync_notifier.h" | 20 #include "sync/notifier/sync_notifier.h" |
| 21 #include "sync/test/fake_sync_encryption_handler.h" |
21 | 22 |
22 namespace syncer { | 23 namespace syncer { |
23 | 24 |
24 FakeSyncManager::FakeSyncManager() {} | 25 FakeSyncManager::FakeSyncManager() { |
| 26 fake_encryption_handler_.reset(new FakeSyncEncryptionHandler()); |
| 27 } |
25 | 28 |
26 FakeSyncManager::~FakeSyncManager() {} | 29 FakeSyncManager::~FakeSyncManager() {} |
27 | 30 |
28 void FakeSyncManager::set_initial_sync_ended_types(ModelTypeSet types) { | 31 void FakeSyncManager::set_initial_sync_ended_types(ModelTypeSet types) { |
29 initial_sync_ended_types_ = types; | 32 initial_sync_ended_types_ = types; |
30 } | 33 } |
31 | 34 |
32 void FakeSyncManager::set_progress_marker_types(ModelTypeSet types) { | 35 void FakeSyncManager::set_progress_marker_types(ModelTypeSet types) { |
33 progress_marker_types_ = types; | 36 progress_marker_types_ = types; |
34 } | 37 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 SyncNotifierObserver* handler, | 155 SyncNotifierObserver* handler, |
153 const ObjectIdSet& ids) { | 156 const ObjectIdSet& ids) { |
154 notifier_helper_.UpdateRegisteredIds(handler, ids); | 157 notifier_helper_.UpdateRegisteredIds(handler, ids); |
155 } | 158 } |
156 | 159 |
157 void FakeSyncManager::StartSyncingNormally( | 160 void FakeSyncManager::StartSyncingNormally( |
158 const ModelSafeRoutingInfo& routing_info) { | 161 const ModelSafeRoutingInfo& routing_info) { |
159 // Do nothing. | 162 // Do nothing. |
160 } | 163 } |
161 | 164 |
162 void FakeSyncManager::SetEncryptionPassphrase(const std::string& passphrase, | |
163 bool is_explicit) { | |
164 NOTIMPLEMENTED(); | |
165 } | |
166 | |
167 void FakeSyncManager::SetDecryptionPassphrase(const std::string& passphrase) { | |
168 NOTIMPLEMENTED(); | |
169 } | |
170 | |
171 void FakeSyncManager::ConfigureSyncer( | 165 void FakeSyncManager::ConfigureSyncer( |
172 ConfigureReason reason, | 166 ConfigureReason reason, |
173 const ModelTypeSet& types_to_config, | 167 const ModelTypeSet& types_to_config, |
174 const ModelSafeRoutingInfo& new_routing_info, | 168 const ModelSafeRoutingInfo& new_routing_info, |
175 const base::Closure& ready_task, | 169 const base::Closure& ready_task, |
176 const base::Closure& retry_task) { | 170 const base::Closure& retry_task) { |
177 ModelTypeSet enabled_types = GetRoutingInfoTypes(new_routing_info); | 171 ModelTypeSet enabled_types = GetRoutingInfoTypes(new_routing_info); |
178 ModelTypeSet disabled_types = Difference( | 172 ModelTypeSet disabled_types = Difference( |
179 ModelTypeSet::All(), enabled_types); | 173 ModelTypeSet::All(), enabled_types); |
180 ModelTypeSet success_types = types_to_config; | 174 ModelTypeSet success_types = types_to_config; |
(...skipping 26 matching lines...) Expand all Loading... |
207 | 201 |
208 void FakeSyncManager::RemoveObserver(Observer* observer) { | 202 void FakeSyncManager::RemoveObserver(Observer* observer) { |
209 observers_.RemoveObserver(observer); | 203 observers_.RemoveObserver(observer); |
210 } | 204 } |
211 | 205 |
212 SyncStatus FakeSyncManager::GetDetailedStatus() const { | 206 SyncStatus FakeSyncManager::GetDetailedStatus() const { |
213 NOTIMPLEMENTED(); | 207 NOTIMPLEMENTED(); |
214 return SyncStatus(); | 208 return SyncStatus(); |
215 } | 209 } |
216 | 210 |
217 bool FakeSyncManager::IsUsingExplicitPassphrase() { | |
218 NOTIMPLEMENTED(); | |
219 return false; | |
220 } | |
221 | |
222 bool FakeSyncManager::GetKeystoreKeyBootstrapToken(std::string* token) { | 211 bool FakeSyncManager::GetKeystoreKeyBootstrapToken(std::string* token) { |
223 return false; | 212 return false; |
224 } | 213 } |
225 | 214 |
226 void FakeSyncManager::SaveChanges() { | 215 void FakeSyncManager::SaveChanges() { |
227 // Do nothing. | 216 // Do nothing. |
228 } | 217 } |
229 | 218 |
230 void FakeSyncManager::StopSyncingForShutdown(const base::Closure& callback) { | 219 void FakeSyncManager::StopSyncingForShutdown(const base::Closure& callback) { |
231 if (!sync_task_runner_->PostTask(FROM_HERE, callback)) { | 220 if (!sync_task_runner_->PostTask(FROM_HERE, callback)) { |
232 NOTREACHED(); | 221 NOTREACHED(); |
233 } | 222 } |
234 } | 223 } |
235 | 224 |
236 void FakeSyncManager::ShutdownOnSyncThread() { | 225 void FakeSyncManager::ShutdownOnSyncThread() { |
237 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); | 226 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); |
238 } | 227 } |
239 | 228 |
240 UserShare* FakeSyncManager::GetUserShare() { | 229 UserShare* FakeSyncManager::GetUserShare() { |
241 NOTIMPLEMENTED(); | |
242 return NULL; | 230 return NULL; |
243 } | 231 } |
244 | 232 |
245 void FakeSyncManager::RefreshNigori(const std::string& chrome_version, | |
246 const base::Closure& done_callback) { | |
247 done_callback.Run(); | |
248 } | |
249 | |
250 void FakeSyncManager::EnableEncryptEverything() { | |
251 NOTIMPLEMENTED(); | |
252 } | |
253 | |
254 bool FakeSyncManager::ReceivedExperiment(Experiments* experiments) { | 233 bool FakeSyncManager::ReceivedExperiment(Experiments* experiments) { |
255 return false; | 234 return false; |
256 } | 235 } |
257 | 236 |
258 bool FakeSyncManager::HasUnsyncedItems() { | 237 bool FakeSyncManager::HasUnsyncedItems() { |
259 NOTIMPLEMENTED(); | 238 NOTIMPLEMENTED(); |
260 return false; | 239 return false; |
261 } | 240 } |
262 | 241 |
| 242 SyncEncryptionHandler* FakeSyncManager::GetEncryptionHandler() { |
| 243 return fake_encryption_handler_.get(); |
| 244 } |
| 245 |
263 void FakeSyncManager::InvalidateOnSyncThread( | 246 void FakeSyncManager::InvalidateOnSyncThread( |
264 const ObjectIdPayloadMap& id_payloads, | 247 const ObjectIdPayloadMap& id_payloads, |
265 IncomingNotificationSource source) { | 248 IncomingNotificationSource source) { |
266 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); | 249 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); |
267 notifier_helper_.DispatchInvalidationsToHandlers(id_payloads, source); | 250 notifier_helper_.DispatchInvalidationsToHandlers(id_payloads, source); |
268 } | 251 } |
269 | 252 |
270 void FakeSyncManager::EnableNotificationsOnSyncThread() { | 253 void FakeSyncManager::EnableNotificationsOnSyncThread() { |
271 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); | 254 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); |
272 notifier_helper_.EmitOnNotificationsEnabled(); | 255 notifier_helper_.EmitOnNotificationsEnabled(); |
273 } | 256 } |
274 | 257 |
275 void FakeSyncManager::DisableNotificationsOnSyncThread( | 258 void FakeSyncManager::DisableNotificationsOnSyncThread( |
276 NotificationsDisabledReason reason) { | 259 NotificationsDisabledReason reason) { |
277 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); | 260 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); |
278 notifier_helper_.EmitOnNotificationsDisabled(reason); | 261 notifier_helper_.EmitOnNotificationsDisabled(reason); |
279 } | 262 } |
280 | 263 |
281 } // namespace syncer | 264 } // namespace syncer |
OLD | NEW |