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" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 base::Bind(&GCMClientMock::CheckinFinished, | 52 base::Bind(&GCMClientMock::CheckinFinished, |
53 weak_ptr_factory_.GetWeakPtr())); | 53 weak_ptr_factory_.GetWeakPtr())); |
54 } | 54 } |
55 | 55 |
56 void GCMClientMock::CheckOut() { | 56 void GCMClientMock::CheckOut() { |
57 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 57 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
58 status_ = CHECKED_OUT; | 58 status_ = CHECKED_OUT; |
59 } | 59 } |
60 | 60 |
61 void GCMClientMock::Register(const std::string& app_id, | 61 void GCMClientMock::Register(const std::string& app_id, |
62 const std::string& cert, | |
63 const std::vector<std::string>& sender_ids) { | 62 const std::vector<std::string>& sender_ids) { |
64 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 63 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
65 | 64 |
66 std::string registration_id; | 65 std::string registration_id; |
67 if (error_simulation_ == ALWAYS_SUCCEED) | 66 if (error_simulation_ == ALWAYS_SUCCEED) |
68 registration_id = GetRegistrationIdFromSenderIds(sender_ids); | 67 registration_id = GetRegistrationIdFromSenderIds(sender_ids); |
69 | 68 |
70 base::MessageLoop::current()->PostTask( | 69 base::MessageLoop::current()->PostTask( |
71 FROM_HERE, | 70 FROM_HERE, |
72 base::Bind(&GCMClientMock::RegisterFinished, | 71 base::Bind(&GCMClientMock::RegisterFinished, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 delegate_->OnMessagesDeleted(app_id); | 182 delegate_->OnMessagesDeleted(app_id); |
184 } | 183 } |
185 | 184 |
186 void GCMClientMock::MessageSendError(const std::string& app_id, | 185 void GCMClientMock::MessageSendError(const std::string& app_id, |
187 const std::string& message_id) { | 186 const std::string& message_id) { |
188 if (delegate_) | 187 if (delegate_) |
189 delegate_->OnMessageSendError(app_id, message_id, NETWORK_ERROR); | 188 delegate_->OnMessageSendError(app_id, message_id, NETWORK_ERROR); |
190 } | 189 } |
191 | 190 |
192 } // namespace gcm | 191 } // namespace gcm |
OLD | NEW |