OLD | NEW |
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 #include "google_apis/gcm/base/encryptor.h" | |
14 | 13 |
15 namespace gcm { | 14 namespace gcm { |
16 | 15 |
17 GCMClientMock::GCMClientMock(StartMode start_mode) | 16 GCMClientMock::GCMClientMock(StartMode start_mode) |
18 : delegate_(NULL), | 17 : delegate_(NULL), |
19 status_(UNINITIALIZED), | 18 status_(UNINITIALIZED), |
20 start_mode_(start_mode), | 19 start_mode_(start_mode), |
21 weak_ptr_factory_(this) { | 20 weak_ptr_factory_(this) { |
22 } | 21 } |
23 | 22 |
24 GCMClientMock::~GCMClientMock() { | 23 GCMClientMock::~GCMClientMock() { |
25 } | 24 } |
26 | 25 |
27 void GCMClientMock::Initialize( | 26 void GCMClientMock::Initialize( |
28 const checkin_proto::ChromeBuildProto& chrome_build_proto, | 27 const checkin_proto::ChromeBuildProto& chrome_build_proto, |
29 const base::FilePath& store_path, | 28 const base::FilePath& store_path, |
30 const std::vector<std::string>& account_ids, | 29 const std::vector<std::string>& account_ids, |
31 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, | 30 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, |
32 const scoped_refptr<net::URLRequestContextGetter>& | 31 const scoped_refptr<net::URLRequestContextGetter>& |
33 url_request_context_getter, | 32 url_request_context_getter, |
34 scoped_ptr<Encryptor> encryptor, | |
35 Delegate* delegate) { | 33 Delegate* delegate) { |
36 delegate_ = delegate; | 34 delegate_ = delegate; |
37 } | 35 } |
38 | 36 |
39 void GCMClientMock::Start() { | 37 void GCMClientMock::Start() { |
40 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 38 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
41 DCHECK_NE(STARTED, status_); | 39 DCHECK_NE(STARTED, status_); |
42 | 40 |
43 if (start_mode_ == DELAY_START) | 41 if (start_mode_ == DELAY_START) |
44 return; | 42 return; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 208 } |
211 | 209 |
212 void GCMClientMock::MessageSendError( | 210 void GCMClientMock::MessageSendError( |
213 const std::string& app_id, | 211 const std::string& app_id, |
214 const GCMClient::SendErrorDetails& send_error_details) { | 212 const GCMClient::SendErrorDetails& send_error_details) { |
215 if (delegate_) | 213 if (delegate_) |
216 delegate_->OnMessageSendError(app_id, send_error_details); | 214 delegate_->OnMessageSendError(app_id, send_error_details); |
217 } | 215 } |
218 | 216 |
219 } // namespace gcm | 217 } // namespace gcm |
OLD | NEW |