| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/compiler_specific.h" |
| 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "sync/notifier/fake_invalidator.h" |
| 8 #include "sync/notifier/invalidator_test_template.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 |
| 11 namespace syncer { |
| 12 |
| 13 namespace { |
| 14 |
| 15 class FakeInvalidatorTestDelegate { |
| 16 public: |
| 17 FakeInvalidatorTestDelegate() {} |
| 18 |
| 19 ~FakeInvalidatorTestDelegate() { |
| 20 DestroyInvalidator(); |
| 21 } |
| 22 |
| 23 void CreateInvalidator( |
| 24 const std::string& initial_state, |
| 25 const base::WeakPtr<InvalidationStateTracker>& |
| 26 invalidation_state_tracker) { |
| 27 DCHECK(!invalidator_.get()); |
| 28 invalidator_.reset(new FakeInvalidator()); |
| 29 } |
| 30 |
| 31 FakeInvalidator* GetInvalidator() { |
| 32 return invalidator_.get(); |
| 33 } |
| 34 |
| 35 void DestroyInvalidator() { |
| 36 invalidator_.reset(); |
| 37 } |
| 38 |
| 39 void WaitForInvalidator() { |
| 40 // Do Nothing. |
| 41 } |
| 42 |
| 43 void TriggerOnNotificationsEnabled() { |
| 44 invalidator_->EmitOnNotificationsEnabled(); |
| 45 } |
| 46 |
| 47 void TriggerOnIncomingNotification(const ObjectIdStateMap& id_state_map, |
| 48 IncomingNotificationSource source) { |
| 49 invalidator_->EmitOnIncomingNotification(id_state_map, source); |
| 50 } |
| 51 |
| 52 void TriggerOnNotificationsDisabled(NotificationsDisabledReason reason) { |
| 53 invalidator_->EmitOnNotificationsDisabled(reason); |
| 54 } |
| 55 |
| 56 static bool InvalidatorHandlesDeprecatedState() { |
| 57 return false; |
| 58 } |
| 59 |
| 60 private: |
| 61 scoped_ptr<FakeInvalidator> invalidator_; |
| 62 }; |
| 63 |
| 64 INSTANTIATE_TYPED_TEST_CASE_P( |
| 65 FakeInvalidatorTest, InvalidatorTest, |
| 66 FakeInvalidatorTestDelegate); |
| 67 |
| 68 } // namespace |
| 69 |
| 70 } // namespace syncer |
| OLD | NEW |