| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 84 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 85 | 85 |
| 86 base::MessageLoop::current()->PostTask( | 86 base::MessageLoop::current()->PostTask( |
| 87 FROM_HERE, | 87 FROM_HERE, |
| 88 base::Bind(&GCMClientMock::SendFinished, | 88 base::Bind(&GCMClientMock::SendFinished, |
| 89 weak_ptr_factory_.GetWeakPtr(), | 89 weak_ptr_factory_.GetWeakPtr(), |
| 90 app_id, | 90 app_id, |
| 91 message.id)); | 91 message.id)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 GCMClient::GCMStatistics GCMClientMock::GetStatistics() const { |
| 95 return GCMClient::GCMStatistics(); |
| 96 } |
| 97 |
| 94 void GCMClientMock::PerformDelayedLoading() { | 98 void GCMClientMock::PerformDelayedLoading() { |
| 95 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 99 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 96 | 100 |
| 97 content::BrowserThread::PostTask( | 101 content::BrowserThread::PostTask( |
| 98 content::BrowserThread::IO, | 102 content::BrowserThread::IO, |
| 99 FROM_HERE, | 103 FROM_HERE, |
| 100 base::Bind(&GCMClientMock::DoLoading, weak_ptr_factory_.GetWeakPtr())); | 104 base::Bind(&GCMClientMock::DoLoading, weak_ptr_factory_.GetWeakPtr())); |
| 101 } | 105 } |
| 102 | 106 |
| 103 void GCMClientMock::ReceiveMessage(const std::string& app_id, | 107 void GCMClientMock::ReceiveMessage(const std::string& app_id, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 delegate_->OnMessagesDeleted(app_id); | 187 delegate_->OnMessagesDeleted(app_id); |
| 184 } | 188 } |
| 185 | 189 |
| 186 void GCMClientMock::MessageSendError(const std::string& app_id, | 190 void GCMClientMock::MessageSendError(const std::string& app_id, |
| 187 const std::string& message_id) { | 191 const std::string& message_id) { |
| 188 if (delegate_) | 192 if (delegate_) |
| 189 delegate_->OnMessageSendError(app_id, message_id, NETWORK_ERROR); | 193 delegate_->OnMessageSendError(app_id, message_id, NETWORK_ERROR); |
| 190 } | 194 } |
| 191 | 195 |
| 192 } // namespace gcm | 196 } // namespace gcm |
| OLD | NEW |