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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "google/cacheinvalidation/types.pb.h" | 8 #include "google/cacheinvalidation/types.pb.h" |
9 #include "sync/notifier/fake_invalidation_handler.h" | 9 #include "sync/notifier/fake_invalidation_handler.h" |
10 #include "sync/notifier/invalidator_registrar.h" | 10 #include "sync/notifier/invalidator_registrar.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 virtual void Acknowledge(const invalidation::ObjectId& id, | 46 virtual void Acknowledge(const invalidation::ObjectId& id, |
47 const AckHandle& ack_handle) OVERRIDE { | 47 const AckHandle& ack_handle) OVERRIDE { |
48 // Do nothing. | 48 // Do nothing. |
49 } | 49 } |
50 | 50 |
51 virtual InvalidatorState GetInvalidatorState() const OVERRIDE { | 51 virtual InvalidatorState GetInvalidatorState() const OVERRIDE { |
52 return registrar_.GetInvalidatorState(); | 52 return registrar_.GetInvalidatorState(); |
53 } | 53 } |
54 | 54 |
55 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE { | |
56 // Do nothing. | |
57 } | |
58 | |
59 virtual void UpdateCredentials( | 55 virtual void UpdateCredentials( |
60 const std::string& email, const std::string& token) OVERRIDE { | 56 const std::string& email, const std::string& token) OVERRIDE { |
61 // Do nothing. | 57 // Do nothing. |
62 } | 58 } |
63 | 59 |
64 virtual void SendInvalidation( | 60 virtual void SendInvalidation( |
65 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE { | 61 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE { |
66 // Do nothing. | 62 // Do nothing. |
67 } | 63 } |
68 | 64 |
69 private: | 65 private: |
70 InvalidatorRegistrar registrar_; | 66 InvalidatorRegistrar registrar_; |
71 | 67 |
72 DISALLOW_COPY_AND_ASSIGN(RegistrarInvalidator); | 68 DISALLOW_COPY_AND_ASSIGN(RegistrarInvalidator); |
73 }; | 69 }; |
74 | 70 |
75 class RegistrarInvalidatorTestDelegate { | 71 class RegistrarInvalidatorTestDelegate { |
76 public: | 72 public: |
77 RegistrarInvalidatorTestDelegate() {} | 73 RegistrarInvalidatorTestDelegate() {} |
78 | 74 |
79 ~RegistrarInvalidatorTestDelegate() { | 75 ~RegistrarInvalidatorTestDelegate() { |
80 DestroyInvalidator(); | 76 DestroyInvalidator(); |
81 } | 77 } |
82 | 78 |
83 void CreateInvalidator( | 79 void CreateInvalidator( |
| 80 const std::string& invalidator_client_id, |
84 const std::string& initial_state, | 81 const std::string& initial_state, |
85 const base::WeakPtr<InvalidationStateTracker>& | 82 const base::WeakPtr<InvalidationStateTracker>& |
86 invalidation_state_tracker) { | 83 invalidation_state_tracker) { |
87 DCHECK(!invalidator_.get()); | 84 DCHECK(!invalidator_.get()); |
88 invalidator_.reset(new RegistrarInvalidator()); | 85 invalidator_.reset(new RegistrarInvalidator()); |
89 } | 86 } |
90 | 87 |
91 RegistrarInvalidator* GetInvalidator() { | 88 RegistrarInvalidator* GetInvalidator() { |
92 return invalidator_.get(); | 89 return invalidator_.get(); |
93 } | 90 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 EXPECT_DEATH({ registrar.UpdateRegisteredIds(&handler2, ids); }, ""); | 160 EXPECT_DEATH({ registrar.UpdateRegisteredIds(&handler2, ids); }, ""); |
164 | 161 |
165 registrar.UnregisterHandler(&handler2); | 162 registrar.UnregisterHandler(&handler2); |
166 registrar.UnregisterHandler(&handler1); | 163 registrar.UnregisterHandler(&handler1); |
167 } | 164 } |
168 #endif // GTEST_HAS_DEATH_TEST | 165 #endif // GTEST_HAS_DEATH_TEST |
169 | 166 |
170 } // namespace | 167 } // namespace |
171 | 168 |
172 } // namespace syncer | 169 } // namespace syncer |
OLD | NEW |