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