| 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/notifier/fake_invalidation_handler.h" | 5 #include "sync/notifier/fake_invalidation_handler.h" |
| 6 | 6 |
| 7 namespace syncer { | 7 namespace syncer { |
| 8 | 8 |
| 9 FakeInvalidationHandler::FakeInvalidationHandler() | 9 FakeInvalidationHandler::FakeInvalidationHandler() |
| 10 : reason_(TRANSIENT_NOTIFICATION_ERROR), | 10 : state_(DEFAULT_INVALIDATION_ERROR), |
| 11 last_source_(LOCAL_NOTIFICATION), | 11 last_source_(LOCAL_INVALIDATION), |
| 12 notification_count_(0) {} | 12 invalidation_count_(0) {} |
| 13 | 13 |
| 14 FakeInvalidationHandler::~FakeInvalidationHandler() {} | 14 FakeInvalidationHandler::~FakeInvalidationHandler() {} |
| 15 | 15 |
| 16 NotificationsDisabledReason | 16 InvalidatorState FakeInvalidationHandler::GetInvalidatorState() const { |
| 17 FakeInvalidationHandler::GetNotificationsDisabledReason() const { | 17 return state_; |
| 18 return reason_; | |
| 19 } | 18 } |
| 20 | 19 |
| 21 const ObjectIdStateMap& | 20 const ObjectIdStateMap& |
| 22 FakeInvalidationHandler::GetLastNotificationIdStateMap() const { | 21 FakeInvalidationHandler::GetLastInvalidationIdStateMap() const { |
| 23 return last_id_state_map_; | 22 return last_id_state_map_; |
| 24 } | 23 } |
| 25 | 24 |
| 26 IncomingNotificationSource | 25 IncomingInvalidationSource |
| 27 FakeInvalidationHandler::GetLastNotificationSource() const { | 26 FakeInvalidationHandler::GetLastInvalidationSource() const { |
| 28 return last_source_; | 27 return last_source_; |
| 29 } | 28 } |
| 30 | 29 |
| 31 int FakeInvalidationHandler::GetNotificationCount() const { | 30 int FakeInvalidationHandler::GetInvalidationCount() const { |
| 32 return notification_count_; | 31 return invalidation_count_; |
| 33 } | 32 } |
| 34 | 33 |
| 35 void FakeInvalidationHandler::OnNotificationsEnabled() { | 34 void FakeInvalidationHandler::OnInvalidatorStateChange(InvalidatorState state) { |
| 36 reason_ = NO_NOTIFICATION_ERROR; | 35 state_ = state; |
| 37 } | 36 } |
| 38 | 37 |
| 39 void FakeInvalidationHandler::OnNotificationsDisabled( | 38 void FakeInvalidationHandler::OnIncomingInvalidation( |
| 40 NotificationsDisabledReason reason) { | |
| 41 reason_ = reason; | |
| 42 } | |
| 43 | |
| 44 void FakeInvalidationHandler::OnIncomingNotification( | |
| 45 const ObjectIdStateMap& id_state_map, | 39 const ObjectIdStateMap& id_state_map, |
| 46 IncomingNotificationSource source) { | 40 IncomingInvalidationSource source) { |
| 47 last_id_state_map_ = id_state_map; | 41 last_id_state_map_ = id_state_map; |
| 48 last_source_ = source; | 42 last_source_ = source; |
| 49 ++notification_count_; | 43 ++invalidation_count_; |
| 50 } | 44 } |
| 51 | 45 |
| 52 } // namespace syncer | 46 } // namespace syncer |
| OLD | NEW |