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

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

Issue 292813007: Remove dependency on content::BrowserThread from GCMDriver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use SequencedTaskRunner Created 6 years, 7 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 2014 The Chromium Authors. All rights reserved. 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 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_FAKE_GCM_CLIENT_H_ 5 #ifndef CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_CLIENT_H_
6 #define CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_CLIENT_H_ 6 #define CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_CLIENT_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 base {
13 class SequencedTaskRunner;
14 }
15
12 namespace gcm { 16 namespace gcm {
13 17
14 class FakeGCMClient : public GCMClient { 18 class FakeGCMClient : public GCMClient {
15 public: 19 public:
16 enum Status { 20 enum Status {
17 UNINITIALIZED, 21 UNINITIALIZED,
18 STARTED, 22 STARTED,
19 STOPPED, 23 STOPPED,
20 CHECKED_OUT 24 CHECKED_OUT
21 }; 25 };
22 26
23 enum StartMode { 27 enum StartMode {
24 NO_DELAY_START, 28 NO_DELAY_START,
25 DELAY_START, 29 DELAY_START,
26 }; 30 };
27 31
28 explicit FakeGCMClient(StartMode start_mode); 32 FakeGCMClient(StartMode start_mode,
33 const scoped_refptr<base::SequencedTaskRunner>& ui_thread,
34 const scoped_refptr<base::SequencedTaskRunner>& io_thread);
29 virtual ~FakeGCMClient(); 35 virtual ~FakeGCMClient();
30 36
31 // Overridden from GCMClient: 37 // Overridden from GCMClient:
32 // Called on IO thread. 38 // Called on IO thread.
33 virtual void Initialize( 39 virtual void Initialize(
34 const checkin_proto::ChromeBuildProto& chrome_build_proto, 40 const checkin_proto::ChromeBuildProto& chrome_build_proto,
35 const base::FilePath& store_path, 41 const base::FilePath& store_path,
36 const std::vector<std::string>& account_ids, 42 const std::vector<std::string>& account_ids,
37 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, 43 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner,
38 const scoped_refptr<net::URLRequestContextGetter>& 44 const scoped_refptr<net::URLRequestContextGetter>&
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void SendFinished(const std::string& app_id, const OutgoingMessage& message); 83 void SendFinished(const std::string& app_id, const OutgoingMessage& message);
78 void MessageReceived(const std::string& app_id, 84 void MessageReceived(const std::string& app_id,
79 const IncomingMessage& message); 85 const IncomingMessage& message);
80 void MessagesDeleted(const std::string& app_id); 86 void MessagesDeleted(const std::string& app_id);
81 void MessageSendError(const std::string& app_id, 87 void MessageSendError(const std::string& app_id,
82 const SendErrorDetails& send_error_details); 88 const SendErrorDetails& send_error_details);
83 89
84 Delegate* delegate_; 90 Delegate* delegate_;
85 Status status_; 91 Status status_;
86 StartMode start_mode_; 92 StartMode start_mode_;
93 scoped_refptr<base::SequencedTaskRunner> ui_thread_;
94 scoped_refptr<base::SequencedTaskRunner> io_thread_;
87 base::WeakPtrFactory<FakeGCMClient> weak_ptr_factory_; 95 base::WeakPtrFactory<FakeGCMClient> weak_ptr_factory_;
88 96
89 DISALLOW_COPY_AND_ASSIGN(FakeGCMClient); 97 DISALLOW_COPY_AND_ASSIGN(FakeGCMClient);
90 }; 98 };
91 99
92 } // namespace gcm 100 } // namespace gcm
93 101
94 #endif // CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_CLIENT_H_ 102 #endif // CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698