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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // tests. | 67 // tests. |
68 // | 68 // |
69 // Then you simply #include this file as well as gtest.h and add the | 69 // Then you simply #include this file as well as gtest.h and add the |
70 // following statement to my_sync_notifier_unittest.cc: | 70 // following statement to my_sync_notifier_unittest.cc: |
71 // | 71 // |
72 // INSTANTIATE_TYPED_TEST_CASE_P( | 72 // INSTANTIATE_TYPED_TEST_CASE_P( |
73 // MyInvalidator, InvalidatorTest, MyInvalidatorTestDelegate); | 73 // MyInvalidator, InvalidatorTest, MyInvalidatorTestDelegate); |
74 // | 74 // |
75 // Easy! | 75 // Easy! |
76 | 76 |
77 #ifndef SYNC_NOTIFIER_INVALIDATOR_TEST_TEMPLATE_H_ | 77 #ifndef COMPONENTS_INVALIDATION_INVALIDATOR_TEST_TEMPLATE_H_ |
78 #define SYNC_NOTIFIER_INVALIDATOR_TEST_TEMPLATE_H_ | 78 #define COMPONENTS_INVALIDATION_INVALIDATOR_TEST_TEMPLATE_H_ |
79 | 79 |
80 #include "base/basictypes.h" | 80 #include "base/basictypes.h" |
81 #include "base/compiler_specific.h" | 81 #include "base/compiler_specific.h" |
| 82 #include "components/invalidation/fake_invalidation_handler.h" |
| 83 #include "components/invalidation/fake_invalidation_state_tracker.h" |
82 #include "google/cacheinvalidation/include/types.h" | 84 #include "google/cacheinvalidation/include/types.h" |
83 #include "google/cacheinvalidation/types.pb.h" | 85 #include "google/cacheinvalidation/types.pb.h" |
84 #include "sync/internal_api/public/base/object_id_invalidation_map_test_util.h" | 86 #include "sync/internal_api/public/base/object_id_invalidation_map_test_util.h" |
85 #include "sync/notifier/fake_invalidation_handler.h" | |
86 #include "sync/notifier/fake_invalidation_state_tracker.h" | |
87 #include "sync/notifier/invalidator.h" | 87 #include "sync/notifier/invalidator.h" |
88 #include "testing/gtest/include/gtest/gtest.h" | 88 #include "testing/gtest/include/gtest/gtest.h" |
89 | 89 |
90 namespace syncer { | 90 namespace syncer { |
91 | 91 |
92 template <typename InvalidatorTestDelegate> | 92 template <typename InvalidatorTestDelegate> |
93 class InvalidatorTest : public testing::Test { | 93 class InvalidatorTest : public testing::Test { |
94 protected: | 94 protected: |
95 InvalidatorTest() | 95 InvalidatorTest() |
96 : id1(ipc::invalidation::ObjectSource::TEST, "a"), | 96 : id1(ipc::invalidation::ObjectSource::TEST, "a"), |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 367 |
368 invalidator->UnregisterHandler(&handler); | 368 invalidator->UnregisterHandler(&handler); |
369 } | 369 } |
370 | 370 |
371 REGISTER_TYPED_TEST_CASE_P(InvalidatorTest, | 371 REGISTER_TYPED_TEST_CASE_P(InvalidatorTest, |
372 Basic, MultipleHandlers, EmptySetUnregisters, | 372 Basic, MultipleHandlers, EmptySetUnregisters, |
373 GetInvalidatorStateAlwaysCurrent); | 373 GetInvalidatorStateAlwaysCurrent); |
374 | 374 |
375 } // namespace syncer | 375 } // namespace syncer |
376 | 376 |
377 #endif // SYNC_NOTIFIER_INVALIDATOR_TEST_TEMPLATE_H_ | 377 #endif // COMPONENTS_INVALIDATION_INVALIDATOR_TEST_TEMPLATE_H_ |
OLD | NEW |