| 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 #ifndef COMPONENTS_GCM_DRIVER_FAKE_GCM_APP_HANDLER_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_FAKE_GCM_APP_HANDLER_H_ |
| 6 #define COMPONENTS_GCM_DRIVER_FAKE_GCM_APP_HANDLER_H_ | 6 #define COMPONENTS_GCM_DRIVER_FAKE_GCM_APP_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/gcm_driver/gcm_app_handler.h" | 10 #include "components/gcm_driver/gcm_app_handler.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 FakeGCMAppHandler(); | 27 FakeGCMAppHandler(); |
| 28 virtual ~FakeGCMAppHandler(); | 28 virtual ~FakeGCMAppHandler(); |
| 29 | 29 |
| 30 const Event& received_event() const { return received_event_; } | 30 const Event& received_event() const { return received_event_; } |
| 31 const std::string& app_id() const { return app_id_; } | 31 const std::string& app_id() const { return app_id_; } |
| 32 const std::string& acked_message_id() const { return acked_message_id_; } | 32 const std::string& acked_message_id() const { return acked_message_id_; } |
| 33 const GCMClient::IncomingMessage& message() const { return message_; } | 33 const GCMClient::IncomingMessage& message() const { return message_; } |
| 34 const GCMClient::SendErrorDetails& send_error_details() const { | 34 const GCMClient::SendErrorDetails& send_error_details() const { |
| 35 return send_error_details_; | 35 return send_error_details_; |
| 36 } | 36 } |
| 37 bool connected() const { return connected_; } | |
| 38 | 37 |
| 39 void WaitForNotification(); | 38 void WaitForNotification(); |
| 40 | 39 |
| 41 // GCMAppHandler implementation. | 40 // GCMAppHandler implementation. |
| 42 virtual void ShutdownHandler() OVERRIDE; | 41 virtual void ShutdownHandler() OVERRIDE; |
| 43 virtual void OnMessage(const std::string& app_id, | 42 virtual void OnMessage(const std::string& app_id, |
| 44 const GCMClient::IncomingMessage& message) OVERRIDE; | 43 const GCMClient::IncomingMessage& message) OVERRIDE; |
| 45 virtual void OnMessagesDeleted(const std::string& app_id) OVERRIDE; | 44 virtual void OnMessagesDeleted(const std::string& app_id) OVERRIDE; |
| 46 virtual void OnSendError( | 45 virtual void OnSendError( |
| 47 const std::string& app_id, | 46 const std::string& app_id, |
| 48 const GCMClient::SendErrorDetails& send_error_details) OVERRIDE; | 47 const GCMClient::SendErrorDetails& send_error_details) OVERRIDE; |
| 49 virtual void OnSendAcknowledged(const std::string& app_id, | 48 virtual void OnSendAcknowledged(const std::string& app_id, |
| 50 const std::string& message_id) OVERRIDE; | 49 const std::string& message_id) OVERRIDE; |
| 51 virtual void OnConnected(const net::IPEndPoint& ip_endpoint) OVERRIDE; | |
| 52 virtual void OnDisconnected() OVERRIDE; | |
| 53 | 50 |
| 54 private: | 51 private: |
| 55 void ClearResults(); | 52 void ClearResults(); |
| 56 | 53 |
| 57 scoped_ptr<base::RunLoop> run_loop_; | 54 scoped_ptr<base::RunLoop> run_loop_; |
| 58 | 55 |
| 59 Event received_event_; | 56 Event received_event_; |
| 60 std::string app_id_; | 57 std::string app_id_; |
| 61 std::string acked_message_id_; | 58 std::string acked_message_id_; |
| 62 GCMClient::IncomingMessage message_; | 59 GCMClient::IncomingMessage message_; |
| 63 GCMClient::SendErrorDetails send_error_details_; | 60 GCMClient::SendErrorDetails send_error_details_; |
| 64 bool connected_; | |
| 65 | 61 |
| 66 DISALLOW_COPY_AND_ASSIGN(FakeGCMAppHandler); | 62 DISALLOW_COPY_AND_ASSIGN(FakeGCMAppHandler); |
| 67 }; | 63 }; |
| 68 | 64 |
| 69 } // namespace gcm | 65 } // namespace gcm |
| 70 | 66 |
| 71 #endif // COMPONENTS_GCM_DRIVER_FAKE_GCM_APP_HANDLER_H_ | 67 #endif // COMPONENTS_GCM_DRIVER_FAKE_GCM_APP_HANDLER_H_ |
| OLD | NEW |