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

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: Fix merge error leading to uninitialized memory access. Created 6 years, 9 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 "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "chrome/browser/invalidation/invalidation_auth_provider.h"
13 #include "chrome/browser/invalidation/invalidation_service.h" 14 #include "chrome/browser/invalidation/invalidation_service.h"
15 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
14 #include "sync/notifier/invalidator_registrar.h" 16 #include "sync/notifier/invalidator_registrar.h"
15 #include "sync/notifier/mock_ack_handler.h" 17 #include "sync/notifier/mock_ack_handler.h"
16 18
17 namespace content { 19 namespace content {
18 class BrowserContext; 20 class BrowserContext;
19 } 21 }
20 22
21 namespace syncer { 23 namespace syncer {
22 class Invalidation; 24 class Invalidation;
23 } 25 }
24 26
25 namespace invalidation { 27 namespace invalidation {
26 28
27 class InvalidationLogger; 29 class InvalidationLogger;
28 30
31 // Fake invalidation auth provider implementation.
32 class FakeInvalidationAuthProvider : public InvalidationAuthProvider {
33 public:
34 FakeInvalidationAuthProvider();
35 virtual ~FakeInvalidationAuthProvider();
36
37 // InvalidationAuthProvider:
38 virtual OAuth2TokenService* GetTokenService() OVERRIDE;
39 virtual std::string GetAccountId() OVERRIDE;
40 virtual bool ShowLoginUI() OVERRIDE;
41
42 FakeProfileOAuth2TokenService* fake_token_service() {
43 return &token_service_;
44 }
45
46 private:
47 FakeProfileOAuth2TokenService token_service_;
48
49 DISALLOW_COPY_AND_ASSIGN(FakeInvalidationAuthProvider);
50 };
51
29 // An InvalidationService that emits invalidations only when 52 // An InvalidationService that emits invalidations only when
30 // its EmitInvalidationForTest method is called. 53 // its EmitInvalidationForTest method is called.
31 class FakeInvalidationService : public InvalidationService { 54 class FakeInvalidationService : public InvalidationService {
32 public: 55 public:
33 FakeInvalidationService(); 56 FakeInvalidationService();
34 virtual ~FakeInvalidationService(); 57 virtual ~FakeInvalidationService();
35 58
36 static KeyedService* Build(content::BrowserContext* context); 59 static KeyedService* Build(content::BrowserContext* context);
37 60
38 virtual void RegisterInvalidationHandler( 61 virtual void RegisterInvalidationHandler(
39 syncer::InvalidationHandler* handler) OVERRIDE; 62 syncer::InvalidationHandler* handler) OVERRIDE;
40 virtual void UpdateRegisteredInvalidationIds( 63 virtual void UpdateRegisteredInvalidationIds(
41 syncer::InvalidationHandler* handler, 64 syncer::InvalidationHandler* handler,
42 const syncer::ObjectIdSet& ids) OVERRIDE; 65 const syncer::ObjectIdSet& ids) OVERRIDE;
43 virtual void UnregisterInvalidationHandler( 66 virtual void UnregisterInvalidationHandler(
44 syncer::InvalidationHandler* handler) OVERRIDE; 67 syncer::InvalidationHandler* handler) OVERRIDE;
45 68
46 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; 69 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE;
47 virtual std::string GetInvalidatorClientId() const OVERRIDE; 70 virtual std::string GetInvalidatorClientId() const OVERRIDE;
48 virtual InvalidationLogger* GetInvalidationLogger() OVERRIDE; 71 virtual InvalidationLogger* GetInvalidationLogger() OVERRIDE;
49 virtual void RequestDetailedStatus( 72 virtual void RequestDetailedStatus(
50 base::Callback<void(const base::DictionaryValue&)> caller) OVERRIDE; 73 base::Callback<void(const base::DictionaryValue&)> caller) OVERRIDE;
74 virtual InvalidationAuthProvider* GetInvalidationAuthProvider() OVERRIDE;
51 75
52 void SetInvalidatorState(syncer::InvalidatorState state); 76 void SetInvalidatorState(syncer::InvalidatorState state);
53 77
54 const syncer::InvalidatorRegistrar& invalidator_registrar() const { 78 const syncer::InvalidatorRegistrar& invalidator_registrar() const {
55 return invalidator_registrar_; 79 return invalidator_registrar_;
56 } 80 }
57 81
58 void EmitInvalidationForTest(const syncer::Invalidation& invalidation); 82 void EmitInvalidationForTest(const syncer::Invalidation& invalidation);
59 83
60 // Emitted invalidations will be hooked up to this AckHandler. Clients can 84 // Emitted invalidations will be hooked up to this AckHandler. Clients can
61 // query it to assert the invalidaitons are being acked properly. 85 // query it to assert the invalidaitons are being acked properly.
62 syncer::MockAckHandler* GetMockAckHandler(); 86 syncer::MockAckHandler* GetMockAckHandler();
63 87
64 private: 88 private:
65 std::string client_id_; 89 std::string client_id_;
66 syncer::InvalidatorRegistrar invalidator_registrar_; 90 syncer::InvalidatorRegistrar invalidator_registrar_;
67 syncer::MockAckHandler mock_ack_handler_; 91 syncer::MockAckHandler mock_ack_handler_;
92 FakeInvalidationAuthProvider auth_provider_;
68 93
69 DISALLOW_COPY_AND_ASSIGN(FakeInvalidationService); 94 DISALLOW_COPY_AND_ASSIGN(FakeInvalidationService);
70 }; 95 };
71 96
72 } // namespace invalidation 97 } // namespace invalidation
73 98
74 #endif // CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_ 99 #endif // CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698