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

Side by Side Diff: chrome/browser/services/gcm/gcm_client_mock.h

Issue 183013007: [GCM] Stop/restart GCM when the state is forced off/on (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_SERVICES_GCM_GCM_CLIENT_MOCK_H_ 5 #ifndef CHROME_BROWSER_SERVICES_GCM_GCM_CLIENT_MOCK_H_
6 #define CHROME_BROWSER_SERVICES_GCM_GCM_CLIENT_MOCK_H_ 6 #define CHROME_BROWSER_SERVICES_GCM_GCM_CLIENT_MOCK_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "google_apis/gcm/gcm_client.h" 10 #include "google_apis/gcm/gcm_client.h"
11 11
12 namespace gcm { 12 namespace gcm {
13 13
14 class GCMClientMock : public GCMClient { 14 class GCMClientMock : public GCMClient {
15 public: 15 public:
16 enum Status { 16 enum Status {
17 UNINITIALIZED, 17 UNINITIALIZED,
18 LOADED, 18 LOADED,
19 STOPPED,
19 CHECKED_OUT 20 CHECKED_OUT
20 }; 21 };
21 22
22 enum LoadingDelay { 23 enum LoadingDelay {
23 NO_DELAY_LOADING, 24 NO_DELAY_LOADING,
24 DELAY_LOADING, 25 DELAY_LOADING,
25 }; 26 };
26 27
27 enum ErrorSimulation { 28 enum ErrorSimulation {
28 ALWAYS_SUCCEED, 29 ALWAYS_SUCCEED,
29 FORCE_ERROR 30 FORCE_ERROR
30 }; 31 };
31 32
32 // |loading_delay| denotes if the check-in should be delayed. 33 // |loading_delay| denotes if the check-in should be delayed.
33 // |error_simulation| denotes if we should simulate server error. 34 // |error_simulation| denotes if we should simulate server error.
34 GCMClientMock(LoadingDelay loading_delay, ErrorSimulation error_simulation); 35 GCMClientMock(LoadingDelay loading_delay, ErrorSimulation error_simulation);
35 virtual ~GCMClientMock(); 36 virtual ~GCMClientMock();
36 37
37 // Overridden from GCMClient: 38 // Overridden from GCMClient:
38 // Called on IO thread. 39 // Called on IO thread.
39 virtual void Initialize( 40 virtual void Initialize(
40 const checkin_proto::ChromeBuildProto& chrome_build_proto, 41 const checkin_proto::ChromeBuildProto& chrome_build_proto,
41 const base::FilePath& store_path, 42 const base::FilePath& store_path,
42 const std::vector<std::string>& account_ids, 43 const std::vector<std::string>& account_ids,
43 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, 44 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner,
44 const scoped_refptr<net::URLRequestContextGetter>& 45 const scoped_refptr<net::URLRequestContextGetter>&
45 url_request_context_getter, 46 url_request_context_getter,
46 Delegate* delegate) OVERRIDE; 47 Delegate* delegate) OVERRIDE;
47 virtual void Load() OVERRIDE; 48 virtual void Load() OVERRIDE;
49 virtual void Stop() OVERRIDE;
48 virtual void CheckOut() OVERRIDE; 50 virtual void CheckOut() OVERRIDE;
49 virtual void Register(const std::string& app_id, 51 virtual void Register(const std::string& app_id,
50 const std::string& cert, 52 const std::string& cert,
51 const std::vector<std::string>& sender_ids) OVERRIDE; 53 const std::vector<std::string>& sender_ids) OVERRIDE;
52 virtual void Unregister(const std::string& app_id) OVERRIDE; 54 virtual void Unregister(const std::string& app_id) OVERRIDE;
53 virtual void Send(const std::string& app_id, 55 virtual void Send(const std::string& app_id,
54 const std::string& receiver_id, 56 const std::string& receiver_id,
55 const OutgoingMessage& message) OVERRIDE; 57 const OutgoingMessage& message) OVERRIDE;
56 58
57 // Initiate the loading that has been delayed. 59 // Initiate the loading that has been delayed.
(...skipping 29 matching lines...) Expand all
87 LoadingDelay loading_delay_; 89 LoadingDelay loading_delay_;
88 ErrorSimulation error_simulation_; 90 ErrorSimulation error_simulation_;
89 base::WeakPtrFactory<GCMClientMock> weak_ptr_factory_; 91 base::WeakPtrFactory<GCMClientMock> weak_ptr_factory_;
90 92
91 DISALLOW_COPY_AND_ASSIGN(GCMClientMock); 93 DISALLOW_COPY_AND_ASSIGN(GCMClientMock);
92 }; 94 };
93 95
94 } // namespace gcm 96 } // namespace gcm
95 97
96 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_CLIENT_MOCK_H_ 98 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_CLIENT_MOCK_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/services/gcm/gcm_client_mock.cc » ('j') | chrome/browser/services/gcm/gcm_profile_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698