Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: chrome/browser/invalidation/fake_invalidation_service.h

Issue 179843002: Make invalidations work for Chrome OS Kiosk Apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "chrome/browser/invalidation/invalidation_auth_provider.h"
12 #include "chrome/browser/invalidation/invalidation_service.h" 13 #include "chrome/browser/invalidation/invalidation_service.h"
14 #include "google_apis/gaia/fake_oauth2_token_service.h"
13 #include "sync/notifier/invalidator_registrar.h" 15 #include "sync/notifier/invalidator_registrar.h"
14 #include "sync/notifier/mock_ack_handler.h" 16 #include "sync/notifier/mock_ack_handler.h"
15 17
16 namespace syncer { 18 namespace syncer {
17 class Invalidation; 19 class Invalidation;
18 } 20 }
19 21
20 namespace invalidation { 22 namespace invalidation {
21 23
22 class InvalidationLogger; 24 class InvalidationLogger;
23 25
26 // Fake invalidation auth provider implementation.
27 class FakeInvalidationAuthProvider : public InvalidationAuthProvider {
28 public:
29 FakeInvalidationAuthProvider();
30 virtual ~FakeInvalidationAuthProvider();
31
32 // InvalidationAuthProvider:
33 virtual OAuth2TokenService* GetTokenService() OVERRIDE;
34 virtual std::string GetAccountId() OVERRIDE;
35 virtual bool ShowLoginUI() OVERRIDE;
36
37 private:
38 // TODO(mnissler): This doesn't compile, because FakeOAuth2TokenService is not
39 // compiled into the Chrome binary, but FakeInvalidationService is (but
40 // probably shouldn't be).
41 // FakeOAuth2TokenService token_service_;
42
43 DISALLOW_COPY_AND_ASSIGN(FakeInvalidationAuthProvider);
44 };
45
24 // An InvalidationService that emits invalidations only when 46 // An InvalidationService that emits invalidations only when
25 // its EmitInvalidationForTest method is called. 47 // its EmitInvalidationForTest method is called.
26 class FakeInvalidationService : public InvalidationService { 48 class FakeInvalidationService : public InvalidationService {
27 public: 49 public:
28 FakeInvalidationService(); 50 FakeInvalidationService();
29 virtual ~FakeInvalidationService(); 51 virtual ~FakeInvalidationService();
30 52
31 virtual void RegisterInvalidationHandler( 53 virtual void RegisterInvalidationHandler(
32 syncer::InvalidationHandler* handler) OVERRIDE; 54 syncer::InvalidationHandler* handler) OVERRIDE;
33 virtual void UpdateRegisteredInvalidationIds( 55 virtual void UpdateRegisteredInvalidationIds(
34 syncer::InvalidationHandler* handler, 56 syncer::InvalidationHandler* handler,
35 const syncer::ObjectIdSet& ids) OVERRIDE; 57 const syncer::ObjectIdSet& ids) OVERRIDE;
36 virtual void UnregisterInvalidationHandler( 58 virtual void UnregisterInvalidationHandler(
37 syncer::InvalidationHandler* handler) OVERRIDE; 59 syncer::InvalidationHandler* handler) OVERRIDE;
38 60
39 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; 61 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE;
40 virtual std::string GetInvalidatorClientId() const OVERRIDE; 62 virtual std::string GetInvalidatorClientId() const OVERRIDE;
41 virtual InvalidationLogger* GetInvalidationLogger() OVERRIDE; 63 virtual InvalidationLogger* GetInvalidationLogger() OVERRIDE;
64 virtual InvalidationAuthProvider* GetInvalidationAuthProvider() OVERRIDE;
42 65
43 void SetInvalidatorState(syncer::InvalidatorState state); 66 void SetInvalidatorState(syncer::InvalidatorState state);
44 67
45 const syncer::InvalidatorRegistrar& invalidator_registrar() const { 68 const syncer::InvalidatorRegistrar& invalidator_registrar() const {
46 return invalidator_registrar_; 69 return invalidator_registrar_;
47 } 70 }
48 71
49 void EmitInvalidationForTest(const syncer::Invalidation& invalidation); 72 void EmitInvalidationForTest(const syncer::Invalidation& invalidation);
50 73
51 // Emitted invalidations will be hooked up to this AckHandler. Clients can 74 // Emitted invalidations will be hooked up to this AckHandler. Clients can
52 // query it to assert the invalidaitons are being acked properly. 75 // query it to assert the invalidaitons are being acked properly.
53 syncer::MockAckHandler* GetMockAckHandler(); 76 syncer::MockAckHandler* GetMockAckHandler();
54 77
55 private: 78 private:
56 std::string client_id_; 79 std::string client_id_;
57 syncer::InvalidatorRegistrar invalidator_registrar_; 80 syncer::InvalidatorRegistrar invalidator_registrar_;
58 syncer::MockAckHandler mock_ack_handler_; 81 syncer::MockAckHandler mock_ack_handler_;
82 FakeInvalidationAuthProvider auth_provider_;
59 83
60 DISALLOW_COPY_AND_ASSIGN(FakeInvalidationService); 84 DISALLOW_COPY_AND_ASSIGN(FakeInvalidationService);
61 }; 85 };
62 86
63 } // namespace invalidation 87 } // namespace invalidation
64 88
65 #endif // CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_ 89 #endif // CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698