| 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_SERVER_H_ | 5 #ifndef REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_ |
| 6 #define REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_ | 6 #define REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_ |
| 7 | 7 |
| 8 #include "remoting/host/security_key/security_key_ipc_server.h" | 8 #include "remoting/host/security_key/security_key_ipc_server.h" |
| 9 | 9 |
| 10 #include <cstdint> | 10 #include <cstdint> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 namespace remoting { | 25 namespace remoting { |
| 26 | 26 |
| 27 // Used to send/receive security key messages for testing. It provides a | 27 // Used to send/receive security key messages for testing. It provides a |
| 28 // WeakPtr reference to itself which allows tests to verify its lifetime is | 28 // WeakPtr reference to itself which allows tests to verify its lifetime is |
| 29 // managed properly without interfering with it. | 29 // managed properly without interfering with it. |
| 30 class FakeSecurityKeyIpcServer : public SecurityKeyIpcServer, | 30 class FakeSecurityKeyIpcServer : public SecurityKeyIpcServer, |
| 31 public IPC::Listener { | 31 public IPC::Listener { |
| 32 public: | 32 public: |
| 33 FakeSecurityKeyIpcServer( | 33 FakeSecurityKeyIpcServer( |
| 34 int connection_id, | 34 int connection_id, |
| 35 uint32_t peer_session_id, | 35 ClientSessionDetails* client_session_details, |
| 36 base::TimeDelta initial_connect_timeout, | 36 base::TimeDelta initial_connect_timeout, |
| 37 const SecurityKeyAuthHandler::SendMessageCallback& send_message_callback, | 37 const SecurityKeyAuthHandler::SendMessageCallback& send_message_callback, |
| 38 const base::Closure& channel_closed_callback); | 38 const base::Closure& channel_closed_callback); |
| 39 ~FakeSecurityKeyIpcServer() override; | 39 ~FakeSecurityKeyIpcServer() override; |
| 40 | 40 |
| 41 // SecurityKeyIpcServer interface. | 41 // SecurityKeyIpcServer interface. |
| 42 bool CreateChannel(const std::string& channel_name, | 42 bool CreateChannel(const std::string& channel_name, |
| 43 base::TimeDelta request_timeout) override; | 43 base::TimeDelta request_timeout) override; |
| 44 bool SendResponse(const std::string& message_data) override; | 44 bool SendResponse(const std::string& message_data) override; |
| 45 | 45 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // this factory creates. This allows tests to inject/retrieve messages and | 105 // this factory creates. This allows tests to inject/retrieve messages and |
| 106 // verify the backing instance is destroyed at the appropriate time. | 106 // verify the backing instance is destroyed at the appropriate time. |
| 107 class FakeSecurityKeyIpcServerFactory : public SecurityKeyIpcServerFactory { | 107 class FakeSecurityKeyIpcServerFactory : public SecurityKeyIpcServerFactory { |
| 108 public: | 108 public: |
| 109 FakeSecurityKeyIpcServerFactory(); | 109 FakeSecurityKeyIpcServerFactory(); |
| 110 ~FakeSecurityKeyIpcServerFactory() override; | 110 ~FakeSecurityKeyIpcServerFactory() override; |
| 111 | 111 |
| 112 // SecurityKeyIpcServerFactory implementation. | 112 // SecurityKeyIpcServerFactory implementation. |
| 113 std::unique_ptr<SecurityKeyIpcServer> Create( | 113 std::unique_ptr<SecurityKeyIpcServer> Create( |
| 114 int connection_id, | 114 int connection_id, |
| 115 uint32_t peer_session_id, | 115 ClientSessionDetails* client_session_details, |
| 116 base::TimeDelta initial_connect_timeout, | 116 base::TimeDelta initial_connect_timeout, |
| 117 const SecurityKeyAuthHandler::SendMessageCallback& message_callback, | 117 const SecurityKeyAuthHandler::SendMessageCallback& message_callback, |
| 118 const base::Closure& done_callback) override; | 118 const base::Closure& done_callback) override; |
| 119 | 119 |
| 120 // Provide a WeakPtr reference to the FakeSecurityKeyIpcServer object | 120 // Provide a WeakPtr reference to the FakeSecurityKeyIpcServer object |
| 121 // created for the |connection_id| IPC channel. | 121 // created for the |connection_id| IPC channel. |
| 122 base::WeakPtr<FakeSecurityKeyIpcServer> GetIpcServerObject(int connection_id); | 122 base::WeakPtr<FakeSecurityKeyIpcServer> GetIpcServerObject(int connection_id); |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 // Tracks each FakeSecurityKeyIpcServer instance created by this | 125 // Tracks each FakeSecurityKeyIpcServer instance created by this |
| 126 // factory which allows them to be retrieved and queried for tests. | 126 // factory which allows them to be retrieved and queried for tests. |
| 127 std::map<int, base::WeakPtr<FakeSecurityKeyIpcServer>> ipc_server_map_; | 127 std::map<int, base::WeakPtr<FakeSecurityKeyIpcServer>> ipc_server_map_; |
| 128 | 128 |
| 129 DISALLOW_COPY_AND_ASSIGN(FakeSecurityKeyIpcServerFactory); | 129 DISALLOW_COPY_AND_ASSIGN(FakeSecurityKeyIpcServerFactory); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 } // namespace remoting | 132 } // namespace remoting |
| 133 | 133 |
| 134 #endif // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_ | 134 #endif // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_ |
| OLD | NEW |