| 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 #ifndef SYNC_NOTIFIER_FAKE_INVALIDATOR_H_ | 5 #ifndef SYNC_NOTIFIER_FAKE_INVALIDATOR_H_ |
| 6 #define SYNC_NOTIFIER_FAKE_INVALIDATOR_H_ | 6 #define SYNC_NOTIFIER_FAKE_INVALIDATOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "sync/notifier/invalidation_util.h" | 11 #include "sync/notifier/invalidation_util.h" |
| 12 #include "sync/notifier/invalidator.h" | 12 #include "sync/notifier/invalidator.h" |
| 13 #include "sync/notifier/invalidator_registrar.h" | 13 #include "sync/notifier/invalidator_registrar.h" |
| 14 | 14 |
| 15 namespace syncer { | 15 namespace syncer { |
| 16 | 16 |
| 17 class FakeInvalidator : public Invalidator { | 17 class FakeInvalidator : public Invalidator { |
| 18 public: | 18 public: |
| 19 FakeInvalidator(); | 19 FakeInvalidator(); |
| 20 virtual ~FakeInvalidator(); | 20 virtual ~FakeInvalidator(); |
| 21 | 21 |
| 22 bool IsHandlerRegistered(InvalidationHandler* handler) const; | 22 bool IsHandlerRegistered(InvalidationHandler* handler) const; |
| 23 ObjectIdSet GetRegisteredIds(InvalidationHandler* handler) const; | 23 ObjectIdSet GetRegisteredIds(InvalidationHandler* handler) const; |
| 24 const std::string& GetUniqueId() const; | 24 const std::string& GetUniqueId() const; |
| 25 const std::string& GetStateDeprecated() const; | 25 const std::string& GetStateDeprecated() const; |
| 26 const std::string& GetCredentialsEmail() const; | 26 const std::string& GetCredentialsEmail() const; |
| 27 const std::string& GetCredentialsToken() const; | 27 const std::string& GetCredentialsToken() const; |
| 28 const ObjectIdStateMap& GetLastSentIdStateMap() const; | 28 const ObjectIdInvalidationMap& GetLastSentInvalidationMap() const; |
| 29 | 29 |
| 30 void EmitOnInvalidatorStateChange(InvalidatorState state); | 30 void EmitOnInvalidatorStateChange(InvalidatorState state); |
| 31 void EmitOnIncomingInvalidation(const ObjectIdStateMap& id_state_map, | 31 void EmitOnIncomingInvalidation( |
| 32 IncomingInvalidationSource source); | 32 const ObjectIdInvalidationMap& invalidation_map, |
| 33 IncomingInvalidationSource source); |
| 33 | 34 |
| 34 virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE; | 35 virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE; |
| 35 virtual void UpdateRegisteredIds(InvalidationHandler* handler, | 36 virtual void UpdateRegisteredIds(InvalidationHandler* handler, |
| 36 const ObjectIdSet& ids) OVERRIDE; | 37 const ObjectIdSet& ids) OVERRIDE; |
| 37 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE; | 38 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE; |
| 38 virtual InvalidatorState GetInvalidatorState() const OVERRIDE; | 39 virtual InvalidatorState GetInvalidatorState() const OVERRIDE; |
| 39 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; | 40 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; |
| 40 virtual void SetStateDeprecated(const std::string& state) OVERRIDE; | 41 virtual void SetStateDeprecated(const std::string& state) OVERRIDE; |
| 41 virtual void UpdateCredentials( | 42 virtual void UpdateCredentials( |
| 42 const std::string& email, const std::string& token) OVERRIDE; | 43 const std::string& email, const std::string& token) OVERRIDE; |
| 43 virtual void SendInvalidation(const ObjectIdStateMap& id_state_map) OVERRIDE; | 44 virtual void SendInvalidation( |
| 45 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE; |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 InvalidatorRegistrar registrar_; | 48 InvalidatorRegistrar registrar_; |
| 47 std::string unique_id_; | 49 std::string unique_id_; |
| 48 std::string state_; | 50 std::string state_; |
| 49 std::string email_; | 51 std::string email_; |
| 50 std::string token_; | 52 std::string token_; |
| 51 ObjectIdStateMap last_sent_id_state_map_; | 53 ObjectIdInvalidationMap last_sent_invalidation_map_; |
| 52 }; | 54 }; |
| 53 | 55 |
| 54 } // namespace syncer | 56 } // namespace syncer |
| 55 | 57 |
| 56 #endif // SYNC_NOTIFIER_FAKE_INVALIDATOR_H_ | 58 #endif // SYNC_NOTIFIER_FAKE_INVALIDATOR_H_ |
| OLD | NEW |