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 <cstddef> | 5 #include <cstddef> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 state_(TRANSIENT_INVALIDATION_ERROR) {} | 141 state_(TRANSIENT_INVALIDATION_ERROR) {} |
142 virtual ~FakeDelegate() {} | 142 virtual ~FakeDelegate() {} |
143 | 143 |
144 int GetInvalidationCount(const ObjectId& id) const { | 144 int GetInvalidationCount(const ObjectId& id) const { |
145 ObjectIdCountMap::const_iterator it = invalidation_counts_.find(id); | 145 ObjectIdCountMap::const_iterator it = invalidation_counts_.find(id); |
146 return (it == invalidation_counts_.end()) ? 0 : it->second; | 146 return (it == invalidation_counts_.end()) ? 0 : it->second; |
147 } | 147 } |
148 | 148 |
149 std::string GetPayload(const ObjectId& id) const { | 149 std::string GetPayload(const ObjectId& id) const { |
150 ObjectIdInvalidationMap::const_iterator it = invalidations_.find(id); | 150 ObjectIdInvalidationMap::const_iterator it = invalidations_.find(id); |
151 return (it == invalidations_.end()) ? "" : it->second.payload; | 151 return (it == invalidations_.end()) ? std::string() : it->second.payload; |
152 } | 152 } |
153 | 153 |
154 InvalidatorState GetInvalidatorState() const { | 154 InvalidatorState GetInvalidatorState() const { |
155 return state_; | 155 return state_; |
156 } | 156 } |
157 | 157 |
158 void Acknowledge(const ObjectId& id) { | 158 void Acknowledge(const ObjectId& id) { |
159 listener_->Acknowledge(id, invalidations_[id].ack_handle); | 159 listener_->Acknowledge(id, invalidations_[id].ack_handle); |
160 } | 160 } |
161 | 161 |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 EXPECT_EQ(INVALIDATION_CREDENTIALS_REJECTED, GetInvalidatorState()); | 955 EXPECT_EQ(INVALIDATION_CREDENTIALS_REJECTED, GetInvalidatorState()); |
956 | 956 |
957 listener_.Ready(fake_invalidation_client_); | 957 listener_.Ready(fake_invalidation_client_); |
958 | 958 |
959 EXPECT_EQ(INVALIDATIONS_ENABLED, GetInvalidatorState()); | 959 EXPECT_EQ(INVALIDATIONS_ENABLED, GetInvalidatorState()); |
960 } | 960 } |
961 | 961 |
962 } // namespace | 962 } // namespace |
963 | 963 |
964 } // namespace syncer | 964 } // namespace syncer |
OLD | NEW |