| 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 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE { | 42 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE { |
| 43 registrar_.UnregisterHandler(handler); | 43 registrar_.UnregisterHandler(handler); |
| 44 } | 44 } |
| 45 | 45 |
| 46 virtual InvalidatorState GetInvalidatorState() const OVERRIDE { | 46 virtual InvalidatorState GetInvalidatorState() const OVERRIDE { |
| 47 return registrar_.GetInvalidatorState(); | 47 return registrar_.GetInvalidatorState(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE { | |
| 51 // Do nothing. | |
| 52 } | |
| 53 | |
| 54 virtual void UpdateCredentials( | 50 virtual void UpdateCredentials( |
| 55 const std::string& email, const std::string& token) OVERRIDE { | 51 const std::string& email, const std::string& token) OVERRIDE { |
| 56 // Do nothing. | 52 // Do nothing. |
| 57 } | 53 } |
| 58 | 54 |
| 59 virtual void SendInvalidation( | 55 virtual void SendInvalidation( |
| 60 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE { | 56 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE { |
| 61 // Do nothing. | 57 // Do nothing. |
| 62 } | 58 } |
| 63 | 59 |
| 64 private: | 60 private: |
| 65 InvalidatorRegistrar registrar_; | 61 InvalidatorRegistrar registrar_; |
| 66 | 62 |
| 67 DISALLOW_COPY_AND_ASSIGN(RegistrarInvalidator); | 63 DISALLOW_COPY_AND_ASSIGN(RegistrarInvalidator); |
| 68 }; | 64 }; |
| 69 | 65 |
| 70 class RegistrarInvalidatorTestDelegate { | 66 class RegistrarInvalidatorTestDelegate { |
| 71 public: | 67 public: |
| 72 RegistrarInvalidatorTestDelegate() {} | 68 RegistrarInvalidatorTestDelegate() {} |
| 73 | 69 |
| 74 ~RegistrarInvalidatorTestDelegate() { | 70 ~RegistrarInvalidatorTestDelegate() { |
| 75 DestroyInvalidator(); | 71 DestroyInvalidator(); |
| 76 } | 72 } |
| 77 | 73 |
| 78 void CreateInvalidator( | 74 void CreateInvalidator( |
| 75 const std::string& invalidator_client_id, |
| 79 const std::string& initial_state, | 76 const std::string& initial_state, |
| 80 const base::WeakPtr<InvalidationStateTracker>& | 77 const base::WeakPtr<InvalidationStateTracker>& |
| 81 invalidation_state_tracker) { | 78 invalidation_state_tracker) { |
| 82 DCHECK(!invalidator_.get()); | 79 DCHECK(!invalidator_.get()); |
| 83 invalidator_.reset(new RegistrarInvalidator()); | 80 invalidator_.reset(new RegistrarInvalidator()); |
| 84 } | 81 } |
| 85 | 82 |
| 86 RegistrarInvalidator* GetInvalidator() { | 83 RegistrarInvalidator* GetInvalidator() { |
| 87 return invalidator_.get(); | 84 return invalidator_.get(); |
| 88 } | 85 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 EXPECT_DEATH({ registrar.UpdateRegisteredIds(&handler2, ids); }, ""); | 156 EXPECT_DEATH({ registrar.UpdateRegisteredIds(&handler2, ids); }, ""); |
| 160 | 157 |
| 161 registrar.UnregisterHandler(&handler2); | 158 registrar.UnregisterHandler(&handler2); |
| 162 registrar.UnregisterHandler(&handler1); | 159 registrar.UnregisterHandler(&handler1); |
| 163 } | 160 } |
| 164 #endif // GTEST_HAS_DEATH_TEST | 161 #endif // GTEST_HAS_DEATH_TEST |
| 165 | 162 |
| 166 } // namespace | 163 } // namespace |
| 167 | 164 |
| 168 } // namespace syncer | 165 } // namespace syncer |
| OLD | NEW |