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