| 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/invalidation_notifier.h" | 5 #include "sync/notifier/invalidation_notifier.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "jingle/notifier/base/fake_base_task.h" | 9 #include "jingle/notifier/base/fake_base_task.h" |
| 10 #include "jingle/notifier/base/notifier_options.h" | 10 #include "jingle/notifier/base/notifier_options.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // task. Stopping does not schedule any tasks, so it's both necessary and | 57 // task. Stopping does not schedule any tasks, so it's both necessary and |
| 58 // sufficient to drain the task queue before stopping the notifier. | 58 // sufficient to drain the task queue before stopping the notifier. |
| 59 message_loop_.RunAllPending(); | 59 message_loop_.RunAllPending(); |
| 60 invalidator_.reset(); | 60 invalidator_.reset(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void WaitForInvalidator() { | 63 void WaitForInvalidator() { |
| 64 message_loop_.RunAllPending(); | 64 message_loop_.RunAllPending(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void TriggerOnNotificationsEnabled() { | 67 void TriggerOnInvalidatorStateChange(InvalidatorState state) { |
| 68 invalidator_->OnNotificationsEnabled(); | 68 invalidator_->OnInvalidatorStateChange(state); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void TriggerOnIncomingNotification(const ObjectIdStateMap& id_state_map, | 71 void TriggerOnIncomingInvalidation(const ObjectIdStateMap& id_state_map, |
| 72 IncomingNotificationSource source) { | 72 IncomingInvalidationSource source) { |
| 73 // None of the tests actually care about |source|. | 73 // None of the tests actually care about |source|. |
| 74 invalidator_->OnInvalidate(id_state_map); | 74 invalidator_->OnInvalidate(id_state_map); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void TriggerOnNotificationsDisabled(NotificationsDisabledReason reason) { | |
| 78 invalidator_->OnNotificationsDisabled(reason); | |
| 79 } | |
| 80 | |
| 81 static bool InvalidatorHandlesDeprecatedState() { | 77 static bool InvalidatorHandlesDeprecatedState() { |
| 82 return true; | 78 return true; |
| 83 } | 79 } |
| 84 | 80 |
| 85 private: | 81 private: |
| 86 MessageLoop message_loop_; | 82 MessageLoop message_loop_; |
| 87 scoped_ptr<InvalidationNotifier> invalidator_; | 83 scoped_ptr<InvalidationNotifier> invalidator_; |
| 88 }; | 84 }; |
| 89 | 85 |
| 90 INSTANTIATE_TYPED_TEST_CASE_P( | 86 INSTANTIATE_TYPED_TEST_CASE_P( |
| 91 InvalidationNotifierTest, InvalidatorTest, | 87 InvalidationNotifierTest, InvalidatorTest, |
| 92 InvalidationNotifierTestDelegate); | 88 InvalidationNotifierTestDelegate); |
| 93 | 89 |
| 94 } // namespace | 90 } // namespace |
| 95 | 91 |
| 96 } // namespace syncer | 92 } // namespace syncer |
| OLD | NEW |