OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SYNC_TEST_INTEGRATION_FAKE_SERVER_INVALIDATION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_FAKE_SERVER_INVALIDATION_SERVICE_H_ |
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_FAKE_SERVER_INVALIDATION_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_FAKE_SERVER_INVALIDATION_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 12 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
13 #include "components/invalidation/invalidation_service.h" | 13 #include "components/invalidation/invalidation_service.h" |
14 #include "components/invalidation/invalidator_registrar.h" | 14 #include "components/invalidation/invalidator_registrar.h" |
15 #include "google_apis/gaia/fake_identity_provider.h" | 15 #include "google_apis/gaia/fake_identity_provider.h" |
16 #include "sync/internal_api/public/base/model_type.h" | 16 #include "sync/internal_api/public/base/model_type.h" |
17 #include "sync/test/fake_server/fake_server.h" | 17 #include "sync/test/fake_server/fake_server.h" |
18 | 18 |
19 namespace invalidation { | 19 namespace invalidation { |
20 class InvalidationLogger; | 20 class InvalidationLogger; |
21 } | 21 } |
22 | 22 |
23 namespace fake_server { | 23 namespace fake_server { |
24 | 24 |
25 // An InvalidationService that is used in conjunction with FakeServer. | 25 // An InvalidationService that is used in conjunction with FakeServer. |
26 class FakeServerInvalidationService : public invalidation::InvalidationService, | 26 class FakeServerInvalidationService : public invalidation::InvalidationService, |
27 public FakeServer::Observer { | 27 public FakeServer::Observer { |
28 public: | 28 public: |
29 FakeServerInvalidationService(); | 29 FakeServerInvalidationService(); |
30 virtual ~FakeServerInvalidationService(); | 30 ~FakeServerInvalidationService() override; |
31 | 31 |
32 virtual void RegisterInvalidationHandler( | 32 void RegisterInvalidationHandler( |
33 syncer::InvalidationHandler* handler) override; | 33 syncer::InvalidationHandler* handler) override; |
34 virtual void UpdateRegisteredInvalidationIds( | 34 void UpdateRegisteredInvalidationIds(syncer::InvalidationHandler* handler, |
35 syncer::InvalidationHandler* handler, | 35 const syncer::ObjectIdSet& ids) override; |
36 const syncer::ObjectIdSet& ids) override; | 36 void UnregisterInvalidationHandler( |
37 virtual void UnregisterInvalidationHandler( | |
38 syncer::InvalidationHandler* handler) override; | 37 syncer::InvalidationHandler* handler) override; |
39 | 38 |
40 virtual syncer::InvalidatorState GetInvalidatorState() const override; | 39 syncer::InvalidatorState GetInvalidatorState() const override; |
41 virtual std::string GetInvalidatorClientId() const override; | 40 std::string GetInvalidatorClientId() const override; |
42 virtual invalidation::InvalidationLogger* GetInvalidationLogger() override; | 41 invalidation::InvalidationLogger* GetInvalidationLogger() override; |
43 virtual void RequestDetailedStatus( | 42 void RequestDetailedStatus( |
44 base::Callback<void(const base::DictionaryValue&)> caller) const override; | 43 base::Callback<void(const base::DictionaryValue&)> caller) const override; |
45 virtual IdentityProvider* GetIdentityProvider() override; | 44 IdentityProvider* GetIdentityProvider() override; |
46 | 45 |
47 // Functions to enable or disable sending of self-notifications. In the real | 46 // Functions to enable or disable sending of self-notifications. In the real |
48 // world, clients do not receive notifications of their own commits. | 47 // world, clients do not receive notifications of their own commits. |
49 void EnableSelfNotifications(); | 48 void EnableSelfNotifications(); |
50 void DisableSelfNotifications(); | 49 void DisableSelfNotifications(); |
51 | 50 |
52 // FakeServer::Observer: | 51 // FakeServer::Observer: |
53 virtual void OnCommit( | 52 void OnCommit(const std::string& committer_id, |
54 const std::string& committer_id, | 53 syncer::ModelTypeSet committed_model_types) override; |
55 syncer::ModelTypeSet committed_model_types) override; | |
56 | 54 |
57 private: | 55 private: |
58 std::string client_id_; | 56 std::string client_id_; |
59 bool self_notify_; | 57 bool self_notify_; |
60 | 58 |
61 syncer::InvalidatorRegistrar invalidator_registrar_; | 59 syncer::InvalidatorRegistrar invalidator_registrar_; |
62 FakeProfileOAuth2TokenService token_service_; | 60 FakeProfileOAuth2TokenService token_service_; |
63 FakeIdentityProvider identity_provider_; | 61 FakeIdentityProvider identity_provider_; |
64 | 62 |
65 DISALLOW_COPY_AND_ASSIGN(FakeServerInvalidationService); | 63 DISALLOW_COPY_AND_ASSIGN(FakeServerInvalidationService); |
66 }; | 64 }; |
67 | 65 |
68 } // namespace fake_server | 66 } // namespace fake_server |
69 | 67 |
70 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_FAKE_SERVER_INVALIDATION_SERVICE
_H_ | 68 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_FAKE_SERVER_INVALIDATION_SERVICE
_H_ |
OLD | NEW |