| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 void GCMClientMock::DoLoading() { | 48 void GCMClientMock::DoLoading() { |
| 49 status_ = LOADED; | 49 status_ = LOADED; |
| 50 base::MessageLoop::current()->PostTask( | 50 base::MessageLoop::current()->PostTask( |
| 51 FROM_HERE, | 51 FROM_HERE, |
| 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::Stop() { |
| 57 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 58 status_ = STOPPED; |
| 59 } |
| 60 |
| 56 void GCMClientMock::CheckOut() { | 61 void GCMClientMock::CheckOut() { |
| 57 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 62 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 58 status_ = CHECKED_OUT; | 63 status_ = CHECKED_OUT; |
| 59 } | 64 } |
| 60 | 65 |
| 61 void GCMClientMock::Register(const std::string& app_id, | 66 void GCMClientMock::Register(const std::string& app_id, |
| 62 const std::string& cert, | 67 const std::string& cert, |
| 63 const std::vector<std::string>& sender_ids) { | 68 const std::vector<std::string>& sender_ids) { |
| 64 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 69 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 65 | 70 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 delegate_->OnMessagesDeleted(app_id); | 188 delegate_->OnMessagesDeleted(app_id); |
| 184 } | 189 } |
| 185 | 190 |
| 186 void GCMClientMock::MessageSendError(const std::string& app_id, | 191 void GCMClientMock::MessageSendError(const std::string& app_id, |
| 187 const std::string& message_id) { | 192 const std::string& message_id) { |
| 188 if (delegate_) | 193 if (delegate_) |
| 189 delegate_->OnMessageSendError(app_id, message_id, NETWORK_ERROR); | 194 delegate_->OnMessageSendError(app_id, message_id, NETWORK_ERROR); |
| 190 } | 195 } |
| 191 | 196 |
| 192 } // namespace gcm | 197 } // namespace gcm |
| OLD | NEW |