| 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "sync/notifier/fake_invalidator.h" | 7 #include "sync/notifier/fake_invalidator.h" |
| 8 #include "sync/notifier/invalidator_test_template.h" | 8 #include "sync/notifier/invalidator_test_template.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace syncer { | 11 namespace syncer { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 class FakeInvalidatorTestDelegate { | 15 class FakeInvalidatorTestDelegate { |
| 16 public: | 16 public: |
| 17 FakeInvalidatorTestDelegate() {} | 17 FakeInvalidatorTestDelegate() {} |
| 18 | 18 |
| 19 ~FakeInvalidatorTestDelegate() { | 19 ~FakeInvalidatorTestDelegate() { |
| 20 DestroyInvalidator(); | 20 DestroyInvalidator(); |
| 21 } | 21 } |
| 22 | 22 |
| 23 void CreateInvalidator( | 23 void CreateInvalidator( |
| 24 const std::string& invalidator_client_id, | 24 const std::string& invalidator_client_id, |
| 25 const std::string& initial_state, | 25 const std::string& initial_state, |
| 26 const base::WeakPtr<InvalidationStateTracker>& | 26 InvalidationStateTracker* invalidation_state_tracker) { |
| 27 invalidation_state_tracker) { | |
| 28 DCHECK(!invalidator_.get()); | 27 DCHECK(!invalidator_.get()); |
| 29 invalidator_.reset(new FakeInvalidator()); | 28 invalidator_.reset(new FakeInvalidator()); |
| 30 } | 29 } |
| 31 | 30 |
| 32 FakeInvalidator* GetInvalidator() { | 31 FakeInvalidator* GetInvalidator() { |
| 33 return invalidator_.get(); | 32 return invalidator_.get(); |
| 34 } | 33 } |
| 35 | 34 |
| 36 void DestroyInvalidator() { | 35 void DestroyInvalidator() { |
| 37 invalidator_.reset(); | 36 invalidator_.reset(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 54 scoped_ptr<FakeInvalidator> invalidator_; | 53 scoped_ptr<FakeInvalidator> invalidator_; |
| 55 }; | 54 }; |
| 56 | 55 |
| 57 INSTANTIATE_TYPED_TEST_CASE_P( | 56 INSTANTIATE_TYPED_TEST_CASE_P( |
| 58 FakeInvalidatorTest, InvalidatorTest, | 57 FakeInvalidatorTest, InvalidatorTest, |
| 59 FakeInvalidatorTestDelegate); | 58 FakeInvalidatorTestDelegate); |
| 60 | 59 |
| 61 } // namespace | 60 } // namespace |
| 62 | 61 |
| 63 } // namespace syncer | 62 } // namespace syncer |
| OLD | NEW |