| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/gcm_driver/fake_gcm_app_handler.h" | 5 #include "components/gcm_driver/fake_gcm_app_handler.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 | 8 |
| 9 namespace gcm { | 9 namespace gcm { |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 const std::string& app_id, | 46 const std::string& app_id, |
| 47 const GCMClient::SendErrorDetails& send_error_details) { | 47 const GCMClient::SendErrorDetails& send_error_details) { |
| 48 ClearResults(); | 48 ClearResults(); |
| 49 received_event_ = SEND_ERROR_EVENT; | 49 received_event_ = SEND_ERROR_EVENT; |
| 50 app_id_ = app_id; | 50 app_id_ = app_id; |
| 51 send_error_details_ = send_error_details; | 51 send_error_details_ = send_error_details; |
| 52 if (run_loop_) | 52 if (run_loop_) |
| 53 run_loop_->Quit(); | 53 run_loop_->Quit(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void FakeGCMAppHandler::OnSendAcknowledged( |
| 57 const std::string& app_id, |
| 58 const std::string& message_id) { |
| 59 // TODO(fgorski): Implement when needed in tests. |
| 60 } |
| 61 |
| 56 void FakeGCMAppHandler::ClearResults() { | 62 void FakeGCMAppHandler::ClearResults() { |
| 57 received_event_ = NO_EVENT; | 63 received_event_ = NO_EVENT; |
| 58 app_id_.clear(); | 64 app_id_.clear(); |
| 59 message_ = GCMClient::IncomingMessage(); | 65 message_ = GCMClient::IncomingMessage(); |
| 60 send_error_details_ = GCMClient::SendErrorDetails(); | 66 send_error_details_ = GCMClient::SendErrorDetails(); |
| 61 } | 67 } |
| 62 | 68 |
| 63 void FakeGCMAppHandler::OnConnected(const net::IPEndPoint& ip_endpoint) { | 69 void FakeGCMAppHandler::OnConnected(const net::IPEndPoint& ip_endpoint) { |
| 64 connected_ = true; | 70 connected_ = true; |
| 65 } | 71 } |
| 66 | 72 |
| 67 void FakeGCMAppHandler::OnDisconnected() { | 73 void FakeGCMAppHandler::OnDisconnected() { |
| 68 connected_ = false; | 74 connected_ = false; |
| 69 } | 75 } |
| 70 | 76 |
| 71 } // namespace gcm | 77 } // namespace gcm |
| OLD | NEW |