| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 InvalidationService should | 5 // This class defines tests that implementations of InvalidationService should |
| 6 // pass in order to be conformant. Here's how you use it to test your | 6 // pass in order to be conformant. Here's how you use it to test your |
| 7 // implementation. | 7 // implementation. |
| 8 // | 8 // |
| 9 // Say your class is called MyInvalidationService. Then you need to define a | 9 // Say your class is called MyInvalidationService. Then you need to define a |
| 10 // class called MyInvalidationServiceTestDelegate in | 10 // class called MyInvalidationServiceTestDelegate in |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // Then you simply #include this file as well as gtest.h and add the | 61 // Then you simply #include this file as well as gtest.h and add the |
| 62 // following statement to my_sync_notifier_unittest.cc: | 62 // following statement to my_sync_notifier_unittest.cc: |
| 63 // | 63 // |
| 64 // INSTANTIATE_TYPED_TEST_CASE_P( | 64 // INSTANTIATE_TYPED_TEST_CASE_P( |
| 65 // MyInvalidationService, | 65 // MyInvalidationService, |
| 66 // InvalidationServiceTest, | 66 // InvalidationServiceTest, |
| 67 // MyInvalidatorTestDelegate); | 67 // MyInvalidatorTestDelegate); |
| 68 // | 68 // |
| 69 // Easy! | 69 // Easy! |
| 70 | 70 |
| 71 #ifndef COMPONENTS_INVALIDATION_INVALIDATION_SERVICE_TEST_TEMPLATE_H_ | 71 #ifndef COMPONENTS_INVALIDATION_IMPL_INVALIDATION_SERVICE_TEST_TEMPLATE_H_ |
| 72 #define COMPONENTS_INVALIDATION_INVALIDATION_SERVICE_TEST_TEMPLATE_H_ | 72 #define COMPONENTS_INVALIDATION_IMPL_INVALIDATION_SERVICE_TEST_TEMPLATE_H_ |
| 73 | 73 |
| 74 #include "base/basictypes.h" | 74 #include "base/basictypes.h" |
| 75 #include "base/compiler_specific.h" | 75 #include "base/compiler_specific.h" |
| 76 #include "components/invalidation/ack_handle.h" | 76 #include "components/invalidation/impl/fake_invalidation_handler.h" |
| 77 #include "components/invalidation/fake_invalidation_handler.h" | 77 #include "components/invalidation/impl/object_id_invalidation_map_test_util.h" |
| 78 #include "components/invalidation/invalidation.h" | 78 #include "components/invalidation/public/ack_handle.h" |
| 79 #include "components/invalidation/invalidation_service.h" | 79 #include "components/invalidation/public/invalidation.h" |
| 80 #include "components/invalidation/object_id_invalidation_map.h" | 80 #include "components/invalidation/public/invalidation_service.h" |
| 81 #include "components/invalidation/object_id_invalidation_map_test_util.h" | 81 #include "components/invalidation/public/object_id_invalidation_map.h" |
| 82 #include "google/cacheinvalidation/include/types.h" | 82 #include "google/cacheinvalidation/include/types.h" |
| 83 #include "google/cacheinvalidation/types.pb.h" | 83 #include "google/cacheinvalidation/types.pb.h" |
| 84 #include "testing/gtest/include/gtest/gtest.h" | 84 #include "testing/gtest/include/gtest/gtest.h" |
| 85 | 85 |
| 86 template <typename InvalidatorTestDelegate> | 86 template <typename InvalidatorTestDelegate> |
| 87 class InvalidationServiceTest : public testing::Test { | 87 class InvalidationServiceTest : public testing::Test { |
| 88 protected: | 88 protected: |
| 89 InvalidationServiceTest() | 89 InvalidationServiceTest() |
| 90 : id1(ipc::invalidation::ObjectSource::CHROME_SYNC, "BOOKMARK"), | 90 : id1(ipc::invalidation::ObjectSource::CHROME_SYNC, "BOOKMARK"), |
| 91 id2(ipc::invalidation::ObjectSource::CHROME_SYNC, "PREFERENCE"), | 91 id2(ipc::invalidation::ObjectSource::CHROME_SYNC, "PREFERENCE"), |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 invalidator->UnregisterInvalidationHandler(&handler); | 403 invalidator->UnregisterInvalidationHandler(&handler); |
| 404 } | 404 } |
| 405 | 405 |
| 406 REGISTER_TYPED_TEST_CASE_P(InvalidationServiceTest, | 406 REGISTER_TYPED_TEST_CASE_P(InvalidationServiceTest, |
| 407 Basic, | 407 Basic, |
| 408 MultipleHandlers, | 408 MultipleHandlers, |
| 409 MultipleRegistrations, | 409 MultipleRegistrations, |
| 410 EmptySetUnregisters, | 410 EmptySetUnregisters, |
| 411 GetInvalidatorStateAlwaysCurrent); | 411 GetInvalidatorStateAlwaysCurrent); |
| 412 | 412 |
| 413 #endif // COMPONENTS_INVALIDATION_INVALIDATION_SERVICE_TEST_TEMPLATE_H_ | 413 #endif // COMPONENTS_INVALIDATION_IMPL_INVALIDATION_SERVICE_TEST_TEMPLATE_H_ |
| OLD | NEW |