Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / invalidation / fake_invalidation_service.h
blob87a1f48bab74d0729f22093f98b6d416aa7c2b16
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.
5 #ifndef CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_
6 #define CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_
8 #include <list>
9 #include <utility>
11 #include "base/basictypes.h"
12 #include "base/callback_forward.h"
13 #include "components/invalidation/impl/invalidator_registrar.h"
14 #include "components/invalidation/impl/mock_ack_handler.h"
15 #include "components/invalidation/public/invalidation_service.h"
16 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h"
17 #include "google_apis/gaia/fake_identity_provider.h"
19 namespace syncer {
20 class Invalidation;
23 namespace invalidation {
25 class InvalidationLogger;
27 // An InvalidationService that emits invalidations only when
28 // its EmitInvalidationForTest method is called.
29 class FakeInvalidationService : public InvalidationService {
30 public:
31 FakeInvalidationService();
32 ~FakeInvalidationService() override;
34 void RegisterInvalidationHandler(
35 syncer::InvalidationHandler* handler) override;
36 bool UpdateRegisteredInvalidationIds(syncer::InvalidationHandler* handler,
37 const syncer::ObjectIdSet& ids) override;
38 void UnregisterInvalidationHandler(
39 syncer::InvalidationHandler* handler) override;
41 syncer::InvalidatorState GetInvalidatorState() const override;
42 std::string GetInvalidatorClientId() const override;
43 InvalidationLogger* GetInvalidationLogger() override;
44 void RequestDetailedStatus(
45 base::Callback<void(const base::DictionaryValue&)> caller) const override;
46 IdentityProvider* GetIdentityProvider() override;
48 void SetInvalidatorState(syncer::InvalidatorState state);
50 const syncer::InvalidatorRegistrar& invalidator_registrar() const {
51 return invalidator_registrar_;
54 void EmitInvalidationForTest(const syncer::Invalidation& invalidation);
56 // Emitted invalidations will be hooked up to this AckHandler. Clients can
57 // query it to assert the invalidaitons are being acked properly.
58 syncer::MockAckHandler* GetMockAckHandler();
60 private:
61 std::string client_id_;
62 syncer::InvalidatorRegistrar invalidator_registrar_;
63 syncer::MockAckHandler mock_ack_handler_;
64 FakeProfileOAuth2TokenService token_service_;
65 FakeIdentityProvider identity_provider_;
67 DISALLOW_COPY_AND_ASSIGN(FakeInvalidationService);
70 } // namespace invalidation
72 #endif // CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_