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

Side by Side Diff: sync/notifier/fake_invalidator.cc

Issue 10874096: [Sync] Rework Invalidator-related unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 3 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
« no previous file with comments | « sync/notifier/fake_invalidator.h ('k') | sync/notifier/fake_invalidator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/notifier/fake_invalidator.h" 5 #include "sync/notifier/fake_invalidator.h"
6 6
7 namespace syncer { 7 namespace syncer {
8 8
9 FakeInvalidator::FakeInvalidator() {} 9 FakeInvalidator::FakeInvalidator() {}
10 10
11 FakeInvalidator::~FakeInvalidator() {} 11 FakeInvalidator::~FakeInvalidator() {}
12 12
13 bool FakeInvalidator::IsHandlerRegistered(InvalidationHandler* handler) const { 13 bool FakeInvalidator::IsHandlerRegistered(InvalidationHandler* handler) const {
14 return registrar_.IsHandlerRegisteredForTest(handler); 14 return registrar_.IsHandlerRegisteredForTest(handler);
15 } 15 }
16 16
17 ObjectIdSet FakeInvalidator::GetRegisteredIds( 17 ObjectIdSet FakeInvalidator::GetRegisteredIds(
18 InvalidationHandler* handler) const { 18 InvalidationHandler* handler) const {
19 return registrar_.GetRegisteredIdsForTest(handler); 19 return registrar_.GetRegisteredIds(handler);
20 }
21
22 void FakeInvalidator::RegisterHandler(InvalidationHandler* handler) {
23 registrar_.RegisterHandler(handler);
24 } 20 }
25 21
26 const std::string& FakeInvalidator::GetUniqueId() const { 22 const std::string& FakeInvalidator::GetUniqueId() const {
27 return unique_id_; 23 return unique_id_;
28 } 24 }
29 25
30 const std::string& FakeInvalidator::GetStateDeprecated() const { 26 const std::string& FakeInvalidator::GetStateDeprecated() const {
31 return state_; 27 return state_;
32 } 28 }
33 29
34 const std::string& FakeInvalidator::GetCredentialsEmail() const { 30 const std::string& FakeInvalidator::GetCredentialsEmail() const {
35 return email_; 31 return email_;
36 } 32 }
37 33
38 const std::string& FakeInvalidator::GetCredentialsToken() const { 34 const std::string& FakeInvalidator::GetCredentialsToken() const {
39 return token_; 35 return token_;
40 } 36 }
41 37
42 ModelTypeSet FakeInvalidator::GetLastChangedTypes() const { 38 const ObjectIdStateMap& FakeInvalidator::GetLastSentIdStateMap() const {
43 return last_changed_types_; 39 return last_sent_id_state_map_;
40 }
41
42 void FakeInvalidator::EmitOnNotificationsEnabled() {
43 registrar_.EmitOnNotificationsEnabled();
44 }
45
46 void FakeInvalidator::EmitOnIncomingNotification(
47 const ObjectIdStateMap& id_state_map,
48 IncomingNotificationSource source) {
49 registrar_.DispatchInvalidationsToHandlers(id_state_map, source);
50 }
51
52 void FakeInvalidator::EmitOnNotificationsDisabled(
53 NotificationsDisabledReason reason) {
54 registrar_.EmitOnNotificationsDisabled(reason);
55 }
56
57 void FakeInvalidator::RegisterHandler(InvalidationHandler* handler) {
58 registrar_.RegisterHandler(handler);
44 } 59 }
45 60
46 void FakeInvalidator::UpdateRegisteredIds(InvalidationHandler* handler, 61 void FakeInvalidator::UpdateRegisteredIds(InvalidationHandler* handler,
47 const ObjectIdSet& ids) { 62 const ObjectIdSet& ids) {
48 registrar_.UpdateRegisteredIds(handler, ids); 63 registrar_.UpdateRegisteredIds(handler, ids);
49 } 64 }
50 65
51 void FakeInvalidator::UnregisterHandler(InvalidationHandler* handler) { 66 void FakeInvalidator::UnregisterHandler(InvalidationHandler* handler) {
52 registrar_.UnregisterHandler(handler); 67 registrar_.UnregisterHandler(handler);
53 } 68 }
54 69
55 void FakeInvalidator::SetUniqueId(const std::string& unique_id) { 70 void FakeInvalidator::SetUniqueId(const std::string& unique_id) {
56 unique_id_ = unique_id; 71 unique_id_ = unique_id;
57 } 72 }
58 73
59 void FakeInvalidator::SetStateDeprecated(const std::string& state) { 74 void FakeInvalidator::SetStateDeprecated(const std::string& state) {
60 state_ = state; 75 state_ = state;
61 } 76 }
62 77
63 void FakeInvalidator::UpdateCredentials( 78 void FakeInvalidator::UpdateCredentials(
64 const std::string& email, const std::string& token) { 79 const std::string& email, const std::string& token) {
65 email_ = email; 80 email_ = email;
66 token_ = token; 81 token_ = token;
67 } 82 }
68 83
69 void FakeInvalidator::SendNotification(ModelTypeSet changed_types) { 84 void FakeInvalidator::SendNotification(const ObjectIdStateMap& id_state_map) {
70 last_changed_types_ = changed_types; 85 last_sent_id_state_map_ = id_state_map;
71 } 86 }
72 87
73 } // namespace syncer 88 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/notifier/fake_invalidator.h ('k') | sync/notifier/fake_invalidator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698