| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_ |
| 6 #define CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_ | 6 #define CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" |
| 8 #include "chrome/browser/invalidation/invalidation_service.h" | 9 #include "chrome/browser/invalidation/invalidation_service.h" |
| 9 #include "sync/notifier/invalidator_registrar.h" | 10 #include "sync/notifier/invalidator_registrar.h" |
| 10 | 11 |
| 11 namespace invalidation { | 12 namespace invalidation { |
| 12 | 13 |
| 13 // An InvalidationService that emits invalidations only when | 14 // An InvalidationService that emits invalidations only when |
| 14 // its EmitInvalidationForTest method is called. | 15 // its EmitInvalidationForTest method is called. |
| 15 class FakeInvalidationService : public InvalidationService { | 16 class FakeInvalidationService : public InvalidationService { |
| 16 public: | 17 public: |
| 17 FakeInvalidationService(); | 18 FakeInvalidationService(); |
| 18 virtual ~FakeInvalidationService(); | 19 virtual ~FakeInvalidationService(); |
| 19 | 20 |
| 20 virtual void RegisterInvalidationHandler( | 21 virtual void RegisterInvalidationHandler( |
| 21 syncer::InvalidationHandler* handler) OVERRIDE; | 22 syncer::InvalidationHandler* handler) OVERRIDE; |
| 22 virtual void UpdateRegisteredInvalidationIds( | 23 virtual void UpdateRegisteredInvalidationIds( |
| 23 syncer::InvalidationHandler* handler, | 24 syncer::InvalidationHandler* handler, |
| 24 const syncer::ObjectIdSet& ids) OVERRIDE; | 25 const syncer::ObjectIdSet& ids) OVERRIDE; |
| 25 virtual void UnregisterInvalidationHandler( | 26 virtual void UnregisterInvalidationHandler( |
| 26 syncer::InvalidationHandler* handler) OVERRIDE; | 27 syncer::InvalidationHandler* handler) OVERRIDE; |
| 27 | 28 |
| 28 virtual void AcknowledgeInvalidation( | 29 virtual void AcknowledgeInvalidation( |
| 29 const invalidation::ObjectId& id, | 30 const invalidation::ObjectId& id, |
| 30 const syncer::AckHandle& ack_handle) OVERRIDE; | 31 const syncer::AckHandle& ack_handle) OVERRIDE; |
| 31 | 32 |
| 32 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; | 33 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; |
| 33 virtual std::string GetInvalidatorClientId() const OVERRIDE; | 34 virtual std::string GetInvalidatorClientId() const OVERRIDE; |
| 34 | 35 |
| 35 void EmitInvalidationForTest( | 36 void EmitInvalidationForTest( |
| 36 const invalidation::ObjectId& object_id, | 37 const invalidation::ObjectId& object_id, |
| 38 int64 version, |
| 37 const std::string& payload); | 39 const std::string& payload); |
| 38 | 40 |
| 39 private: | 41 private: |
| 40 std::string client_id_; | 42 std::string client_id_; |
| 41 syncer::InvalidatorRegistrar invalidator_registrar_; | 43 syncer::InvalidatorRegistrar invalidator_registrar_; |
| 42 | 44 |
| 43 DISALLOW_COPY_AND_ASSIGN(FakeInvalidationService); | 45 DISALLOW_COPY_AND_ASSIGN(FakeInvalidationService); |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 } // namespace invalidation | 48 } // namespace invalidation |
| 47 | 49 |
| 48 #endif // CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_ | 50 #endif // CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_ |
| OLD | NEW |