| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" |
| 13 #include "remoting/host/security_key/remote_security_key_ipc_client.h" | 14 #include "remoting/host/security_key/remote_security_key_ipc_client.h" |
| 14 | 15 |
| 15 namespace IPC { | 16 namespace IPC { |
| 16 class Channel; | 17 class Channel; |
| 17 class Message; | 18 class Message; |
| 18 } // IPC | 19 } // IPC |
| 19 | 20 |
| 20 namespace remoting { | 21 namespace remoting { |
| 21 | 22 |
| 22 // Simulates the RemoteSecurityKeyIpcClient and provides access to data members | 23 // Simulates the RemoteSecurityKeyIpcClient and provides access to data members |
| (...skipping 15 matching lines...) Expand all Loading... |
| 38 const ResponseCallback& response_callback) override; | 39 const ResponseCallback& response_callback) override; |
| 39 void CloseIpcConnection() override; | 40 void CloseIpcConnection() override; |
| 40 | 41 |
| 41 // Connects as a client to the |channel_name| IPC Channel. | 42 // Connects as a client to the |channel_name| IPC Channel. |
| 42 bool ConnectViaIpc(const std::string& channel_name); | 43 bool ConnectViaIpc(const std::string& channel_name); |
| 43 | 44 |
| 44 // Override of SendSecurityKeyRequest() interface method for tests which use | 45 // Override of SendSecurityKeyRequest() interface method for tests which use |
| 45 // an IPC channel for testing. | 46 // an IPC channel for testing. |
| 46 void SendSecurityKeyRequestViaIpc(const std::string& request_payload); | 47 void SendSecurityKeyRequestViaIpc(const std::string& request_payload); |
| 47 | 48 |
| 49 base::WeakPtr<FakeRemoteSecurityKeyIpcClient> AsWeakPtr(); |
| 50 |
| 48 const std::string& last_message_received() const { | 51 const std::string& last_message_received() const { |
| 49 return last_message_received_; | 52 return last_message_received_; |
| 50 } | 53 } |
| 51 | 54 |
| 52 void set_wait_for_ipc_channel_return_value(bool return_value) { | 55 void set_wait_for_ipc_channel_return_value(bool return_value) { |
| 53 wait_for_ipc_channel_return_value_ = return_value; | 56 wait_for_ipc_channel_return_value_ = return_value; |
| 54 } | 57 } |
| 55 | 58 |
| 56 void set_establish_ipc_connection_should_succeed(bool should_succeed) { | 59 void set_establish_ipc_connection_should_succeed(bool should_succeed) { |
| 57 establish_ipc_connection_should_succeed_ = should_succeed; | 60 establish_ipc_connection_should_succeed_ = should_succeed; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 95 |
| 93 // Determines whether SendSecurityKeyRequest() returns success or failure. | 96 // Determines whether SendSecurityKeyRequest() returns success or failure. |
| 94 bool send_security_request_should_succeed_ = true; | 97 bool send_security_request_should_succeed_ = true; |
| 95 | 98 |
| 96 // Value returned by WaitForSecurityKeyIpcServerChannel() method. | 99 // Value returned by WaitForSecurityKeyIpcServerChannel() method. |
| 97 bool wait_for_ipc_channel_return_value_ = true; | 100 bool wait_for_ipc_channel_return_value_ = true; |
| 98 | 101 |
| 99 // Value returned by SendSecurityKeyRequest() method. | 102 // Value returned by SendSecurityKeyRequest() method. |
| 100 std::string security_key_response_payload_; | 103 std::string security_key_response_payload_; |
| 101 | 104 |
| 105 base::WeakPtrFactory<FakeRemoteSecurityKeyIpcClient> weak_factory_; |
| 106 |
| 102 DISALLOW_COPY_AND_ASSIGN(FakeRemoteSecurityKeyIpcClient); | 107 DISALLOW_COPY_AND_ASSIGN(FakeRemoteSecurityKeyIpcClient); |
| 103 }; | 108 }; |
| 104 | 109 |
| 105 } // namespace remoting | 110 } // namespace remoting |
| 106 | 111 |
| 107 #endif // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_CLIENT_H_ | 112 #endif // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_CLIENT_H_ |
| OLD | NEW |