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

Side by Side Diff: sync/internal_api/test/fake_sync_manager.cc

Issue 10837214: Refactor ModelTypePayloadMap and ObjectIdPayloadMap to StateMaps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 "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/object_id_payload_map.h" 20 #include "sync/notifier/object_id_state_map.h"
21 #include "sync/notifier/sync_notifier.h" 21 #include "sync/notifier/sync_notifier.h"
22 22
23 namespace syncer { 23 namespace syncer {
24 24
25 FakeSyncManager::FakeSyncManager(ModelTypeSet initial_sync_ended_types, 25 FakeSyncManager::FakeSyncManager(ModelTypeSet initial_sync_ended_types,
26 ModelTypeSet progress_marker_types, 26 ModelTypeSet progress_marker_types,
27 ModelTypeSet configure_fail_types) : 27 ModelTypeSet configure_fail_types) :
28 initial_sync_ended_types_(initial_sync_ended_types), 28 initial_sync_ended_types_(initial_sync_ended_types),
29 progress_marker_types_(progress_marker_types), 29 progress_marker_types_(progress_marker_types),
30 configure_fail_types_(configure_fail_types) {} 30 configure_fail_types_(configure_fail_types) {}
(...skipping 11 matching lines...) Expand all
42 downloaded_types_.Clear(); 42 downloaded_types_.Clear();
43 return downloaded_types; 43 return downloaded_types;
44 } 44 }
45 45
46 ModelTypeSet FakeSyncManager::GetAndResetEnabledTypes() { 46 ModelTypeSet FakeSyncManager::GetAndResetEnabledTypes() {
47 ModelTypeSet enabled_types = enabled_types_; 47 ModelTypeSet enabled_types = enabled_types_;
48 enabled_types_.Clear(); 48 enabled_types_.Clear();
49 return enabled_types; 49 return enabled_types;
50 } 50 }
51 51
52 void FakeSyncManager::Invalidate(const ObjectIdPayloadMap& id_payloads, 52 void FakeSyncManager::Invalidate(const ObjectIdStateMap& id_state_map,
53 IncomingNotificationSource source) { 53 IncomingNotificationSource source) {
54 if (!sync_task_runner_->PostTask( 54 if (!sync_task_runner_->PostTask(
55 FROM_HERE, 55 FROM_HERE,
56 base::Bind(&FakeSyncManager::InvalidateOnSyncThread, 56 base::Bind(&FakeSyncManager::InvalidateOnSyncThread,
57 base::Unretained(this), id_payloads, source))) { 57 base::Unretained(this), id_state_map, source))) {
58 NOTREACHED(); 58 NOTREACHED();
59 } 59 }
60 } 60 }
61 61
62 void FakeSyncManager::EnableNotifications() { 62 void FakeSyncManager::EnableNotifications() {
63 if (!sync_task_runner_->PostTask( 63 if (!sync_task_runner_->PostTask(
64 FROM_HERE, 64 FROM_HERE,
65 base::Bind(&FakeSyncManager::EnableNotificationsOnSyncThread, 65 base::Bind(&FakeSyncManager::EnableNotificationsOnSyncThread,
66 base::Unretained(this)))) { 66 base::Unretained(this)))) {
67 NOTREACHED(); 67 NOTREACHED();
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 bool FakeSyncManager::ReceivedExperiment(Experiments* experiments) { 276 bool FakeSyncManager::ReceivedExperiment(Experiments* experiments) {
277 return false; 277 return false;
278 } 278 }
279 279
280 bool FakeSyncManager::HasUnsyncedItems() { 280 bool FakeSyncManager::HasUnsyncedItems() {
281 NOTIMPLEMENTED(); 281 NOTIMPLEMENTED();
282 return false; 282 return false;
283 } 283 }
284 284
285 void FakeSyncManager::InvalidateOnSyncThread( 285 void FakeSyncManager::InvalidateOnSyncThread(
286 const ObjectIdPayloadMap& id_payloads, 286 const ObjectIdStateMap& id_state_map,
287 IncomingNotificationSource source) { 287 IncomingNotificationSource source) {
288 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); 288 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread());
289 registrar_.DispatchInvalidationsToHandlers(id_payloads, source); 289 registrar_.DispatchInvalidationsToHandlers(id_state_map, source);
290 } 290 }
291 291
292 void FakeSyncManager::EnableNotificationsOnSyncThread() { 292 void FakeSyncManager::EnableNotificationsOnSyncThread() {
293 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); 293 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread());
294 registrar_.EmitOnNotificationsEnabled(); 294 registrar_.EmitOnNotificationsEnabled();
295 } 295 }
296 296
297 void FakeSyncManager::DisableNotificationsOnSyncThread( 297 void FakeSyncManager::DisableNotificationsOnSyncThread(
298 NotificationsDisabledReason reason) { 298 NotificationsDisabledReason reason) {
299 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); 299 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread());
300 registrar_.EmitOnNotificationsDisabled(reason); 300 registrar_.EmitOnNotificationsDisabled(reason);
301 } 301 }
302 302
303 } // namespace syncer 303 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698