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

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

Issue 285623002: Rename GCMClient::Load to GCMClient::Start (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch 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 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 #include "chrome/browser/services/gcm/gcm_client_mock.h" 5 #include "chrome/browser/services/gcm/gcm_client_mock.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/sys_byteorder.h" 10 #include "base/sys_byteorder.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 13
14 namespace gcm { 14 namespace gcm {
15 15
16 GCMClientMock::GCMClientMock(LoadingDelay loading_delay) 16 GCMClientMock::GCMClientMock(StartMode start_mode)
17 : delegate_(NULL), 17 : delegate_(NULL),
18 status_(UNINITIALIZED), 18 status_(UNINITIALIZED),
19 loading_delay_(loading_delay), 19 start_mode_(start_mode),
20 weak_ptr_factory_(this) { 20 weak_ptr_factory_(this) {
21 } 21 }
22 22
23 GCMClientMock::~GCMClientMock() { 23 GCMClientMock::~GCMClientMock() {
24 } 24 }
25 25
26 void GCMClientMock::Initialize( 26 void GCMClientMock::Initialize(
27 const checkin_proto::ChromeBuildProto& chrome_build_proto, 27 const checkin_proto::ChromeBuildProto& chrome_build_proto,
28 const base::FilePath& store_path, 28 const base::FilePath& store_path,
29 const std::vector<std::string>& account_ids, 29 const std::vector<std::string>& account_ids,
30 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, 30 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner,
31 const scoped_refptr<net::URLRequestContextGetter>& 31 const scoped_refptr<net::URLRequestContextGetter>&
32 url_request_context_getter, 32 url_request_context_getter,
33 Delegate* delegate) { 33 Delegate* delegate) {
34 delegate_ = delegate; 34 delegate_ = delegate;
35 } 35 }
36 36
37 void GCMClientMock::Load() { 37 void GCMClientMock::Start() {
38 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 38 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
39 DCHECK_NE(LOADED, status_); 39 DCHECK_NE(STARTED, status_);
40 40
41 if (loading_delay_ == DELAY_LOADING) 41 if (start_mode_ == DELAY_START)
42 return; 42 return;
43 DoLoading(); 43 DoLoading();
44 } 44 }
45 45
46 void GCMClientMock::DoLoading() { 46 void GCMClientMock::DoLoading() {
47 status_ = LOADED; 47 status_ = STARTED;
48 base::MessageLoop::current()->PostTask( 48 base::MessageLoop::current()->PostTask(
49 FROM_HERE, 49 FROM_HERE,
50 base::Bind(&GCMClientMock::CheckinFinished, 50 base::Bind(&GCMClientMock::CheckinFinished,
51 weak_ptr_factory_.GetWeakPtr())); 51 weak_ptr_factory_.GetWeakPtr()));
52 } 52 }
53 53
54 void GCMClientMock::Stop() { 54 void GCMClientMock::Stop() {
55 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 55 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
56 status_ = STOPPED; 56 status_ = STOPPED;
57 } 57 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 209
210 void GCMClientMock::MessageSendError( 210 void GCMClientMock::MessageSendError(
211 const std::string& app_id, 211 const std::string& app_id,
212 const GCMClient::SendErrorDetails& send_error_details) { 212 const GCMClient::SendErrorDetails& send_error_details) {
213 if (delegate_) 213 if (delegate_)
214 delegate_->OnMessageSendError(app_id, send_error_details); 214 delegate_->OnMessageSendError(app_id, send_error_details);
215 } 215 }
216 216
217 } // namespace gcm 217 } // namespace gcm
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/gcm_client_mock.h ('k') | chrome/browser/services/gcm/gcm_profile_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698