| 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_IPC_GNUBBY_AUTH_HANDLER_H_ | 5 #ifndef REMOTING_HOST_SECURITY_KEY_FAKE_IPC_SECURITY_KEY_AUTH_HANDLER_H_ |
| 6 #define REMOTING_HOST_SECURITY_KEY_FAKE_IPC_GNUBBY_AUTH_HANDLER_H_ | 6 #define REMOTING_HOST_SECURITY_KEY_FAKE_IPC_SECURITY_KEY_AUTH_HANDLER_H_ |
| 7 | 7 |
| 8 #include "remoting/host/security_key/gnubby_auth_handler.h" | 8 #include "remoting/host/security_key/security_key_auth_handler.h" |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "ipc/ipc_listener.h" | 14 #include "ipc/ipc_listener.h" |
| 15 | 15 |
| 16 namespace IPC { | 16 namespace IPC { |
| 17 class Channel; | 17 class Channel; |
| 18 class Message; | 18 class Message; |
| 19 } // IPC | 19 } // IPC |
| 20 | 20 |
| 21 namespace remoting { | 21 namespace remoting { |
| 22 | 22 |
| 23 // Simplified implementation of an IPC based GnubbyAuthHandler class used for | 23 // Simplified implementation of an IPC based SecurityKeyAuthHandler class used |
| 24 // testing. | 24 // for testing. |
| 25 class FakeIpcGnubbyAuthHandler : public GnubbyAuthHandler, | 25 class FakeIpcSecurityKeyAuthHandler : public SecurityKeyAuthHandler, |
| 26 public IPC::Listener { | 26 public IPC::Listener { |
| 27 public: | 27 public: |
| 28 FakeIpcGnubbyAuthHandler(); | 28 FakeIpcSecurityKeyAuthHandler(); |
| 29 ~FakeIpcGnubbyAuthHandler() override; | 29 ~FakeIpcSecurityKeyAuthHandler() override; |
| 30 | 30 |
| 31 // GnubbyAuthHandler interface. | 31 // SecurityKeyAuthHandler interface. |
| 32 void CreateGnubbyConnection() override; | 32 void CreateSecurityKeyConnection() override; |
| 33 bool IsValidConnectionId(int gnubby_connection_id) const override; | 33 bool IsValidConnectionId(int security_key_connection_id) const override; |
| 34 void SendClientResponse(int gnubby_connection_id, | 34 void SendClientResponse(int security_key_connection_id, |
| 35 const std::string& response) override; | 35 const std::string& response) override; |
| 36 void SendErrorAndCloseConnection(int gnubby_connection_id) override; | 36 void SendErrorAndCloseConnection(int security_key_connection_id) override; |
| 37 void SetSendMessageCallback(const SendMessageCallback& callback) override; | 37 void SetSendMessageCallback(const SendMessageCallback& callback) override; |
| 38 size_t GetActiveConnectionCountForTest() const override; | 38 size_t GetActiveConnectionCountForTest() const override; |
| 39 void SetRequestTimeoutForTest(base::TimeDelta timeout) override; | 39 void SetRequestTimeoutForTest(base::TimeDelta timeout) override; |
| 40 | 40 |
| 41 void set_ipc_security_key_channel_name( | 41 void set_ipc_security_key_channel_name( |
| 42 const std::string& ipc_security_key_channel_name) { | 42 const std::string& ipc_security_key_channel_name) { |
| 43 ipc_security_key_channel_name_ = ipc_security_key_channel_name; | 43 ipc_security_key_channel_name_ = ipc_security_key_channel_name; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void set_ipc_server_channel_name(const std::string& ipc_server_channel_name) { | 46 void set_ipc_server_channel_name(const std::string& ipc_server_channel_name) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 57 std::string ipc_server_channel_name_; | 57 std::string ipc_server_channel_name_; |
| 58 | 58 |
| 59 // The channel name returned in the test connection details message and used | 59 // The channel name returned in the test connection details message and used |
| 60 // to exchange security key messages over IPC. | 60 // to exchange security key messages over IPC. |
| 61 std::string ipc_security_key_channel_name_; | 61 std::string ipc_security_key_channel_name_; |
| 62 | 62 |
| 63 // IPC Clients connect to this channel first to receive their own unique IPC | 63 // IPC Clients connect to this channel first to receive their own unique IPC |
| 64 // channel to start a security key forwarding session on. | 64 // channel to start a security key forwarding session on. |
| 65 std::unique_ptr<IPC::Channel> ipc_server_channel_; | 65 std::unique_ptr<IPC::Channel> ipc_server_channel_; |
| 66 | 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(FakeIpcGnubbyAuthHandler); | 67 DISALLOW_COPY_AND_ASSIGN(FakeIpcSecurityKeyAuthHandler); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 } // namespace remoting | 70 } // namespace remoting |
| 71 | 71 |
| 72 #endif // REMOTING_HOST_SECURITY_KEY_FAKE_IPC_GNUBBY_AUTH_HANDLER_H_ | 72 #endif // REMOTING_HOST_SECURITY_KEY_FAKE_IPC_SECURITY_KEY_AUTH_HANDLER_H_ |
| OLD | NEW |