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 // This class defines tests that implementations of Invalidator should pass in | 5 // This class defines tests that implementations of Invalidator should pass in |
6 // order to be conformant. Here's how you use it to test your implementation. | 6 // order to be conformant. Here's how you use it to test your implementation. |
7 // | 7 // |
8 // Say your class is called MyInvalidator. Then you need to define a class | 8 // Say your class is called MyInvalidator. Then you need to define a class |
9 // called MyInvalidatorTestDelegate in my_sync_notifier_unittest.cc like this: | 9 // called MyInvalidatorTestDelegate in my_sync_notifier_unittest.cc like this: |
10 // | 10 // |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 class InvalidatorTest : public testing::Test { | 95 class InvalidatorTest : public testing::Test { |
96 protected: | 96 protected: |
97 InvalidatorTest() | 97 InvalidatorTest() |
98 : id1(ipc::invalidation::ObjectSource::TEST, "a"), | 98 : id1(ipc::invalidation::ObjectSource::TEST, "a"), |
99 id2(ipc::invalidation::ObjectSource::TEST, "b"), | 99 id2(ipc::invalidation::ObjectSource::TEST, "b"), |
100 id3(ipc::invalidation::ObjectSource::TEST, "c"), | 100 id3(ipc::invalidation::ObjectSource::TEST, "c"), |
101 id4(ipc::invalidation::ObjectSource::TEST, "d") { | 101 id4(ipc::invalidation::ObjectSource::TEST, "d") { |
102 } | 102 } |
103 | 103 |
104 Invalidator* CreateAndInitializeInvalidator() { | 104 Invalidator* CreateAndInitializeInvalidator() { |
105 this->delegate_.CreateInvalidator("fake_initial_state", | 105 this->delegate_.CreateInvalidator("fake_invalidator_client_id", |
| 106 "fake_initial_state", |
106 this->fake_tracker_.AsWeakPtr()); | 107 this->fake_tracker_.AsWeakPtr()); |
107 Invalidator* const invalidator = this->delegate_.GetInvalidator(); | 108 Invalidator* const invalidator = this->delegate_.GetInvalidator(); |
108 | 109 |
109 invalidator->SetUniqueId("fake_id"); | |
110 this->delegate_.WaitForInvalidator(); | 110 this->delegate_.WaitForInvalidator(); |
111 invalidator->UpdateCredentials("foo@bar.com", "fake_token"); | 111 invalidator->UpdateCredentials("foo@bar.com", "fake_token"); |
112 this->delegate_.WaitForInvalidator(); | 112 this->delegate_.WaitForInvalidator(); |
113 | 113 |
114 return invalidator; | 114 return invalidator; |
115 } | 115 } |
116 | 116 |
117 FakeInvalidationStateTracker fake_tracker_; | 117 FakeInvalidationStateTracker fake_tracker_; |
118 InvalidatorTestDelegate delegate_; | 118 InvalidatorTestDelegate delegate_; |
119 | 119 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 invalidator->UnregisterHandler(&handler); | 372 invalidator->UnregisterHandler(&handler); |
373 } | 373 } |
374 | 374 |
375 REGISTER_TYPED_TEST_CASE_P(InvalidatorTest, | 375 REGISTER_TYPED_TEST_CASE_P(InvalidatorTest, |
376 Basic, MultipleHandlers, EmptySetUnregisters, | 376 Basic, MultipleHandlers, EmptySetUnregisters, |
377 GetInvalidatorStateAlwaysCurrent); | 377 GetInvalidatorStateAlwaysCurrent); |
378 | 378 |
379 } // namespace syncer | 379 } // namespace syncer |
380 | 380 |
381 #endif // SYNC_NOTIFIER_INVALIDATOR_TEST_TEMPLATE_H_ | 381 #endif // SYNC_NOTIFIER_INVALIDATOR_TEST_TEMPLATE_H_ |
OLD | NEW |