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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_FAKE_SERVER_INVALIDATION_SERVICE_H_
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_FAKE_SERVER_INVALIDATION_SERVICE_H_
11 #include "base/basictypes.h"
12 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
13 #include "components/invalidation/invalidation_service.h"
14 #include "components/invalidation/invalidator_registrar.h"
15 #include "google_apis/gaia/fake_identity_provider.h"
16 #include "sync/internal_api/public/base/model_type.h"
17 #include "sync/test/fake_server/fake_server.h"
19 namespace invalidation {
20 class InvalidationLogger;
23 namespace fake_server {
25 // An InvalidationService that is used in conjunction with FakeServer.
26 class FakeServerInvalidationService : public invalidation::InvalidationService,
27 public FakeServer::Observer {
29 FakeServerInvalidationService();
30 ~FakeServerInvalidationService() override;
32 void RegisterInvalidationHandler(
33 syncer::InvalidationHandler* handler) override;
34 void UpdateRegisteredInvalidationIds(syncer::InvalidationHandler* handler,
35 const syncer::ObjectIdSet& ids) override;
36 void UnregisterInvalidationHandler(
37 syncer::InvalidationHandler* handler) override;
39 syncer::InvalidatorState GetInvalidatorState() const override;
40 std::string GetInvalidatorClientId() const override;
41 invalidation::InvalidationLogger* GetInvalidationLogger() override;
42 void RequestDetailedStatus(
43 base::Callback<void(const base::DictionaryValue&)> caller) const override;
44 IdentityProvider* GetIdentityProvider() override;
46 // Functions to enable or disable sending of self-notifications. In the real
47 // world, clients do not receive notifications of their own commits.
48 void EnableSelfNotifications();
49 void DisableSelfNotifications();
51 // FakeServer::Observer:
52 void OnCommit(const std::string& committer_id,
53 syncer::ModelTypeSet committed_model_types) override;
56 std::string client_id_;
59 syncer::InvalidatorRegistrar invalidator_registrar_;
60 FakeProfileOAuth2TokenService token_service_;
61 FakeIdentityProvider identity_provider_;
63 DISALLOW_COPY_AND_ASSIGN(FakeServerInvalidationService);
66 } // namespace fake_server
68 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_FAKE_SERVER_INVALIDATION_SERVICE_H_