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/non_blocking_invalidator.h" | 5 #include "sync/notifier/non_blocking_invalidator.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 void WaitForInvalidator() { | 69 void WaitForInvalidator() { |
70 base::RunLoop run_loop; | 70 base::RunLoop run_loop; |
71 ASSERT_TRUE( | 71 ASSERT_TRUE( |
72 io_thread_.message_loop_proxy()->PostTaskAndReply( | 72 io_thread_.message_loop_proxy()->PostTaskAndReply( |
73 FROM_HERE, | 73 FROM_HERE, |
74 base::Bind(&DoNothing), | 74 base::Bind(&DoNothing), |
75 run_loop.QuitClosure())); | 75 run_loop.QuitClosure())); |
76 run_loop.Run(); | 76 run_loop.Run(); |
77 } | 77 } |
78 | 78 |
79 void TriggerOnNotificationsEnabled() { | 79 void TriggerOnInvalidatorStateChange(InvalidatorState state) { |
80 invalidator_->OnNotificationsEnabled(); | 80 invalidator_->OnInvalidatorStateChange(state); |
81 } | 81 } |
82 | 82 |
83 void TriggerOnIncomingNotification(const ObjectIdStateMap& id_state_map, | 83 void TriggerOnIncomingInvalidation(const ObjectIdStateMap& id_state_map, |
84 IncomingNotificationSource source) { | 84 IncomingInvalidationSource source) { |
85 invalidator_->OnIncomingNotification(id_state_map, source); | 85 invalidator_->OnIncomingInvalidation(id_state_map, source); |
86 } | |
87 | |
88 void TriggerOnNotificationsDisabled(NotificationsDisabledReason reason) { | |
89 invalidator_->OnNotificationsDisabled(reason); | |
90 } | 86 } |
91 | 87 |
92 static bool InvalidatorHandlesDeprecatedState() { | 88 static bool InvalidatorHandlesDeprecatedState() { |
93 return true; | 89 return true; |
94 } | 90 } |
95 | 91 |
96 private: | 92 private: |
97 MessageLoop message_loop_; | 93 MessageLoop message_loop_; |
98 base::Thread io_thread_; | 94 base::Thread io_thread_; |
99 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 95 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
100 scoped_ptr<NonBlockingInvalidator> invalidator_; | 96 scoped_ptr<NonBlockingInvalidator> invalidator_; |
101 }; | 97 }; |
102 | 98 |
103 INSTANTIATE_TYPED_TEST_CASE_P( | 99 INSTANTIATE_TYPED_TEST_CASE_P( |
104 NonBlockingInvalidatorTest, InvalidatorTest, | 100 NonBlockingInvalidatorTest, InvalidatorTest, |
105 NonBlockingInvalidatorTestDelegate); | 101 NonBlockingInvalidatorTestDelegate); |
106 | 102 |
107 } // namespace | 103 } // namespace |
108 | 104 |
109 } // namespace syncer | 105 } // namespace syncer |
OLD | NEW |