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 <list> | 8 #include <list> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 namespace invalidation { | 23 namespace invalidation { |
24 | 24 |
25 class InvalidationLogger; | 25 class InvalidationLogger; |
26 | 26 |
27 // An InvalidationService that emits invalidations only when | 27 // An InvalidationService that emits invalidations only when |
28 // its EmitInvalidationForTest method is called. | 28 // its EmitInvalidationForTest method is called. |
29 class FakeInvalidationService : public InvalidationService { | 29 class FakeInvalidationService : public InvalidationService { |
30 public: | 30 public: |
31 FakeInvalidationService(); | 31 FakeInvalidationService(); |
32 virtual ~FakeInvalidationService(); | 32 ~FakeInvalidationService() override; |
33 | 33 |
34 virtual void RegisterInvalidationHandler( | 34 void RegisterInvalidationHandler( |
35 syncer::InvalidationHandler* handler) override; | 35 syncer::InvalidationHandler* handler) override; |
36 virtual void UpdateRegisteredInvalidationIds( | 36 void UpdateRegisteredInvalidationIds(syncer::InvalidationHandler* handler, |
37 syncer::InvalidationHandler* handler, | 37 const syncer::ObjectIdSet& ids) override; |
38 const syncer::ObjectIdSet& ids) override; | 38 void UnregisterInvalidationHandler( |
39 virtual void UnregisterInvalidationHandler( | |
40 syncer::InvalidationHandler* handler) override; | 39 syncer::InvalidationHandler* handler) override; |
41 | 40 |
42 virtual syncer::InvalidatorState GetInvalidatorState() const override; | 41 syncer::InvalidatorState GetInvalidatorState() const override; |
43 virtual std::string GetInvalidatorClientId() const override; | 42 std::string GetInvalidatorClientId() const override; |
44 virtual InvalidationLogger* GetInvalidationLogger() override; | 43 InvalidationLogger* GetInvalidationLogger() override; |
45 virtual void RequestDetailedStatus( | 44 void RequestDetailedStatus( |
46 base::Callback<void(const base::DictionaryValue&)> caller) const override; | 45 base::Callback<void(const base::DictionaryValue&)> caller) const override; |
47 virtual IdentityProvider* GetIdentityProvider() override; | 46 IdentityProvider* GetIdentityProvider() override; |
48 | 47 |
49 void SetInvalidatorState(syncer::InvalidatorState state); | 48 void SetInvalidatorState(syncer::InvalidatorState state); |
50 | 49 |
51 const syncer::InvalidatorRegistrar& invalidator_registrar() const { | 50 const syncer::InvalidatorRegistrar& invalidator_registrar() const { |
52 return invalidator_registrar_; | 51 return invalidator_registrar_; |
53 } | 52 } |
54 | 53 |
55 void EmitInvalidationForTest(const syncer::Invalidation& invalidation); | 54 void EmitInvalidationForTest(const syncer::Invalidation& invalidation); |
56 | 55 |
57 // Emitted invalidations will be hooked up to this AckHandler. Clients can | 56 // Emitted invalidations will be hooked up to this AckHandler. Clients can |
58 // query it to assert the invalidaitons are being acked properly. | 57 // query it to assert the invalidaitons are being acked properly. |
59 syncer::MockAckHandler* GetMockAckHandler(); | 58 syncer::MockAckHandler* GetMockAckHandler(); |
60 | 59 |
61 private: | 60 private: |
62 std::string client_id_; | 61 std::string client_id_; |
63 syncer::InvalidatorRegistrar invalidator_registrar_; | 62 syncer::InvalidatorRegistrar invalidator_registrar_; |
64 syncer::MockAckHandler mock_ack_handler_; | 63 syncer::MockAckHandler mock_ack_handler_; |
65 FakeProfileOAuth2TokenService token_service_; | 64 FakeProfileOAuth2TokenService token_service_; |
66 FakeIdentityProvider identity_provider_; | 65 FakeIdentityProvider identity_provider_; |
67 | 66 |
68 DISALLOW_COPY_AND_ASSIGN(FakeInvalidationService); | 67 DISALLOW_COPY_AND_ASSIGN(FakeInvalidationService); |
69 }; | 68 }; |
70 | 69 |
71 } // namespace invalidation | 70 } // namespace invalidation |
72 | 71 |
73 #endif // CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_ | 72 #endif // CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_ |
OLD | NEW |