| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_CLIENT_H_ | 5 #ifndef REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_CLIENT_H_ |
| 6 #define REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_CLIENT_H_ | 6 #define REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_CLIENT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 void set_send_security_request_should_succeed(bool should_succeed) { | 70 void set_send_security_request_should_succeed(bool should_succeed) { |
| 71 send_security_request_should_succeed_ = should_succeed; | 71 send_security_request_should_succeed_ = should_succeed; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void set_security_key_response_payload(const std::string& response_payload) { | 74 void set_security_key_response_payload(const std::string& response_payload) { |
| 75 security_key_response_payload_ = response_payload; | 75 security_key_response_payload_ = response_payload; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void set_on_channel_connected_callback(const base::Closure& callback) { |
| 79 on_channel_connected_callback_ = callback; |
| 80 } |
| 81 |
| 78 private: | 82 private: |
| 79 // IPC::Listener implementation. | 83 // IPC::Listener implementation. |
| 80 bool OnMessageReceived(const IPC::Message& message) override; | 84 bool OnMessageReceived(const IPC::Message& message) override; |
| 81 void OnChannelConnected(int32_t peer_pid) override; | 85 void OnChannelConnected(int32_t peer_pid) override; |
| 82 void OnChannelError() override; | 86 void OnChannelError() override; |
| 83 | 87 |
| 84 // Handles security key response IPC messages. | 88 // Handles security key response IPC messages. |
| 85 void OnSecurityKeyResponse(const std::string& request_data); | 89 void OnSecurityKeyResponse(const std::string& request_data); |
| 86 | 90 |
| 87 // Handles the ConnectionReady IPC message. | 91 // Handles the ConnectionReady IPC message. |
| 88 void OnConnectionReady(); | 92 void OnConnectionReady(); |
| 89 | 93 |
| 90 // Handles the InvalidSession IPC message. | 94 // Handles the InvalidSession IPC message. |
| 91 void OnInvalidSession(); | 95 void OnInvalidSession(); |
| 92 | 96 |
| 93 // Called when a change in the IPC channel state has occurred. | 97 // Called when a change in the IPC channel state has occurred. |
| 94 base::Closure channel_event_callback_; | 98 base::Closure channel_event_callback_; |
| 95 | 99 |
| 100 // Called when the IPC Channel is connected. |
| 101 base::Closure on_channel_connected_callback_; |
| 102 |
| 96 // Used for sending/receiving security key messages between processes. | 103 // Used for sending/receiving security key messages between processes. |
| 97 std::unique_ptr<IPC::Channel> client_channel_; | 104 std::unique_ptr<IPC::Channel> client_channel_; |
| 98 | 105 |
| 99 // Provides the contents of the last IPC message received. | 106 // Provides the contents of the last IPC message received. |
| 100 std::string last_message_received_; | 107 std::string last_message_received_; |
| 101 | 108 |
| 102 // Determines whether EstablishIpcConnection() returns success or failure. | 109 // Determines whether EstablishIpcConnection() returns success or failure. |
| 103 bool establish_ipc_connection_should_succeed_ = true; | 110 bool establish_ipc_connection_should_succeed_ = true; |
| 104 | 111 |
| 105 // Determines whether SendSecurityKeyRequest() returns success or failure. | 112 // Determines whether SendSecurityKeyRequest() returns success or failure. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 121 std::string security_key_response_payload_; | 128 std::string security_key_response_payload_; |
| 122 | 129 |
| 123 base::WeakPtrFactory<FakeSecurityKeyIpcClient> weak_factory_; | 130 base::WeakPtrFactory<FakeSecurityKeyIpcClient> weak_factory_; |
| 124 | 131 |
| 125 DISALLOW_COPY_AND_ASSIGN(FakeSecurityKeyIpcClient); | 132 DISALLOW_COPY_AND_ASSIGN(FakeSecurityKeyIpcClient); |
| 126 }; | 133 }; |
| 127 | 134 |
| 128 } // namespace remoting | 135 } // namespace remoting |
| 129 | 136 |
| 130 #endif // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_CLIENT_H_ | 137 #endif // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_CLIENT_H_ |
| OLD | NEW |