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