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 #include "remoting/host/security_key/fake_remote_security_key_ipc_server.h" | 5 #include "remoting/host/security_key/fake_remote_security_key_ipc_server.h" |
6 | 6 |
| 7 #include <cstdint> |
7 #include <memory> | 8 #include <memory> |
| 9 #include <string> |
8 | 10 |
9 #include "base/callback.h" | 11 #include "base/callback.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
12 #include "ipc/ipc_channel.h" | 14 #include "ipc/ipc_channel.h" |
13 #include "ipc/ipc_message.h" | 15 #include "ipc/ipc_message.h" |
14 #include "ipc/ipc_message_macros.h" | 16 #include "ipc/ipc_message_macros.h" |
15 #include "remoting/host/chromoting_messages.h" | 17 #include "remoting/host/chromoting_messages.h" |
16 #include "remoting/host/security_key/gnubby_auth_handler.h" | 18 #include "remoting/host/security_key/gnubby_auth_handler.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
18 | 20 |
19 namespace remoting { | 21 namespace remoting { |
20 | 22 |
21 FakeRemoteSecurityKeyIpcServer::FakeRemoteSecurityKeyIpcServer( | 23 FakeRemoteSecurityKeyIpcServer::FakeRemoteSecurityKeyIpcServer( |
22 int connection_id, | 24 int connection_id, |
| 25 uint32_t peer_session_id, |
23 base::TimeDelta initial_connect_timeout, | 26 base::TimeDelta initial_connect_timeout, |
24 const GnubbyAuthHandler::SendMessageCallback& send_message_callback, | 27 const GnubbyAuthHandler::SendMessageCallback& send_message_callback, |
25 const base::Closure& channel_closed_callback) | 28 const base::Closure& channel_closed_callback) |
26 : connection_id_(connection_id), | 29 : connection_id_(connection_id), |
27 send_message_callback_(send_message_callback), | 30 send_message_callback_(send_message_callback), |
28 channel_closed_callback_(channel_closed_callback), | 31 channel_closed_callback_(channel_closed_callback), |
29 weak_factory_(this) {} | 32 weak_factory_(this) {} |
30 | 33 |
31 FakeRemoteSecurityKeyIpcServer::~FakeRemoteSecurityKeyIpcServer() {} | 34 FakeRemoteSecurityKeyIpcServer::~FakeRemoteSecurityKeyIpcServer() {} |
32 | 35 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 98 } |
96 | 99 |
97 FakeRemoteSecurityKeyIpcServerFactory:: | 100 FakeRemoteSecurityKeyIpcServerFactory:: |
98 ~FakeRemoteSecurityKeyIpcServerFactory() { | 101 ~FakeRemoteSecurityKeyIpcServerFactory() { |
99 RemoteSecurityKeyIpcServer::SetFactoryForTest(nullptr); | 102 RemoteSecurityKeyIpcServer::SetFactoryForTest(nullptr); |
100 } | 103 } |
101 | 104 |
102 std::unique_ptr<RemoteSecurityKeyIpcServer> | 105 std::unique_ptr<RemoteSecurityKeyIpcServer> |
103 FakeRemoteSecurityKeyIpcServerFactory::Create( | 106 FakeRemoteSecurityKeyIpcServerFactory::Create( |
104 int connection_id, | 107 int connection_id, |
| 108 uint32_t peer_session_id, |
105 base::TimeDelta initial_connect_timeout, | 109 base::TimeDelta initial_connect_timeout, |
106 const GnubbyAuthHandler::SendMessageCallback& send_message_callback, | 110 const GnubbyAuthHandler::SendMessageCallback& send_message_callback, |
107 const base::Closure& done_callback) { | 111 const base::Closure& done_callback) { |
108 std::unique_ptr<FakeRemoteSecurityKeyIpcServer> fake_ipc_server( | 112 std::unique_ptr<FakeRemoteSecurityKeyIpcServer> fake_ipc_server( |
109 new FakeRemoteSecurityKeyIpcServer(connection_id, initial_connect_timeout, | 113 new FakeRemoteSecurityKeyIpcServer(connection_id, peer_session_id, |
| 114 initial_connect_timeout, |
110 send_message_callback, done_callback)); | 115 send_message_callback, done_callback)); |
111 | 116 |
112 ipc_server_map_[connection_id] = fake_ipc_server->AsWeakPtr(); | 117 ipc_server_map_[connection_id] = fake_ipc_server->AsWeakPtr(); |
113 | 118 |
114 return base::WrapUnique(fake_ipc_server.release()); | 119 return base::WrapUnique(fake_ipc_server.release()); |
115 } | 120 } |
116 | 121 |
117 base::WeakPtr<FakeRemoteSecurityKeyIpcServer> | 122 base::WeakPtr<FakeRemoteSecurityKeyIpcServer> |
118 FakeRemoteSecurityKeyIpcServerFactory::GetIpcServerObject(int connection_id) { | 123 FakeRemoteSecurityKeyIpcServerFactory::GetIpcServerObject(int connection_id) { |
119 return ipc_server_map_[connection_id]; | 124 return ipc_server_map_[connection_id]; |
120 } | 125 } |
121 | 126 |
122 } // namespace remoting | 127 } // namespace remoting |
OLD | NEW |