OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/test/test_chromoting_client.h" | 5 #include "remoting/test/test_chromoting_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ptr_util.h" |
12 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
13 #include "jingle/glue/thread_wrapper.h" | 14 #include "jingle/glue/thread_wrapper.h" |
14 #include "net/base/request_priority.h" | 15 #include "net/base/request_priority.h" |
15 #include "net/socket/client_socket_factory.h" | 16 #include "net/socket/client_socket_factory.h" |
16 #include "remoting/base/chromium_url_request.h" | 17 #include "remoting/base/chromium_url_request.h" |
17 #include "remoting/base/url_request_context_getter.h" | 18 #include "remoting/base/url_request_context_getter.h" |
18 #include "remoting/client/audio_player.h" | 19 #include "remoting/client/audio_player.h" |
19 #include "remoting/client/chromoting_client.h" | 20 #include "remoting/client/chromoting_client.h" |
20 #include "remoting/client/client_context.h" | 21 #include "remoting/client/client_context.h" |
21 #include "remoting/protocol/chromium_port_allocator_factory.h" | 22 #include "remoting/protocol/chromium_port_allocator_factory.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const protocol::SecretFetchedCallback& secret_fetched_callback) { | 57 const protocol::SecretFetchedCallback& secret_fetched_callback) { |
57 secret_fetched_callback.Run(client_secret); | 58 secret_fetched_callback.Run(client_secret); |
58 } | 59 } |
59 | 60 |
60 } // namespace | 61 } // namespace |
61 | 62 |
62 TestChromotingClient::TestChromotingClient() | 63 TestChromotingClient::TestChromotingClient() |
63 : TestChromotingClient(nullptr) {} | 64 : TestChromotingClient(nullptr) {} |
64 | 65 |
65 TestChromotingClient::TestChromotingClient( | 66 TestChromotingClient::TestChromotingClient( |
66 scoped_ptr<protocol::VideoRenderer> video_renderer) | 67 std::unique_ptr<protocol::VideoRenderer> video_renderer) |
67 : connection_to_host_state_(protocol::ConnectionToHost::INITIALIZING), | 68 : connection_to_host_state_(protocol::ConnectionToHost::INITIALIZING), |
68 connection_error_code_(protocol::OK), | 69 connection_error_code_(protocol::OK), |
69 video_renderer_(std::move(video_renderer)) {} | 70 video_renderer_(std::move(video_renderer)) {} |
70 | 71 |
71 TestChromotingClient::~TestChromotingClient() { | 72 TestChromotingClient::~TestChromotingClient() { |
72 // Ensure any connections are closed and the members are destroyed in the | 73 // Ensure any connections are closed and the members are destroyed in the |
73 // appropriate order. | 74 // appropriate order. |
74 EndConnection(); | 75 EndConnection(); |
75 } | 76 } |
76 | 77 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(), | 115 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(), |
115 request_context_getter, xmpp_server_config)); | 116 request_context_getter, xmpp_server_config)); |
116 } | 117 } |
117 | 118 |
118 protocol::NetworkSettings network_settings( | 119 protocol::NetworkSettings network_settings( |
119 protocol::NetworkSettings::NAT_TRAVERSAL_FULL); | 120 protocol::NetworkSettings::NAT_TRAVERSAL_FULL); |
120 | 121 |
121 scoped_refptr<protocol::TransportContext> transport_context( | 122 scoped_refptr<protocol::TransportContext> transport_context( |
122 new protocol::TransportContext( | 123 new protocol::TransportContext( |
123 signal_strategy_.get(), | 124 signal_strategy_.get(), |
124 make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory()), | 125 base::WrapUnique(new protocol::ChromiumPortAllocatorFactory()), |
125 make_scoped_ptr( | 126 base::WrapUnique( |
126 new ChromiumUrlRequestFactory(request_context_getter)), | 127 new ChromiumUrlRequestFactory(request_context_getter)), |
127 network_settings, protocol::TransportRole::CLIENT)); | 128 network_settings, protocol::TransportRole::CLIENT)); |
128 | 129 |
129 protocol::ClientAuthenticationConfig client_auth_config; | 130 protocol::ClientAuthenticationConfig client_auth_config; |
130 client_auth_config.host_id = connection_setup_info.host_id; | 131 client_auth_config.host_id = connection_setup_info.host_id; |
131 client_auth_config.pairing_client_id = connection_setup_info.pairing_id; | 132 client_auth_config.pairing_client_id = connection_setup_info.pairing_id; |
132 client_auth_config.pairing_secret = connection_setup_info.shared_secret; | 133 client_auth_config.pairing_secret = connection_setup_info.shared_secret; |
133 | 134 |
134 if (!connection_setup_info.pin.empty()) { | 135 if (!connection_setup_info.pin.empty()) { |
135 client_auth_config.fetch_secret_callback = | 136 client_auth_config.fetch_secret_callback = |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 171 } |
171 | 172 |
172 void TestChromotingClient::RemoveRemoteConnectionObserver( | 173 void TestChromotingClient::RemoveRemoteConnectionObserver( |
173 RemoteConnectionObserver* observer) { | 174 RemoteConnectionObserver* observer) { |
174 DCHECK(observer); | 175 DCHECK(observer); |
175 | 176 |
176 connection_observers_.RemoveObserver(observer); | 177 connection_observers_.RemoveObserver(observer); |
177 } | 178 } |
178 | 179 |
179 void TestChromotingClient::SetSignalStrategyForTests( | 180 void TestChromotingClient::SetSignalStrategyForTests( |
180 scoped_ptr<SignalStrategy> signal_strategy) { | 181 std::unique_ptr<SignalStrategy> signal_strategy) { |
181 signal_strategy_ = std::move(signal_strategy); | 182 signal_strategy_ = std::move(signal_strategy); |
182 } | 183 } |
183 | 184 |
184 void TestChromotingClient::SetConnectionToHostForTests( | 185 void TestChromotingClient::SetConnectionToHostForTests( |
185 scoped_ptr<protocol::ConnectionToHost> connection_to_host) { | 186 std::unique_ptr<protocol::ConnectionToHost> connection_to_host) { |
186 test_connection_to_host_ = std::move(connection_to_host); | 187 test_connection_to_host_ = std::move(connection_to_host); |
187 } | 188 } |
188 | 189 |
189 void TestChromotingClient::OnConnectionState( | 190 void TestChromotingClient::OnConnectionState( |
190 protocol::ConnectionToHost::State state, | 191 protocol::ConnectionToHost::State state, |
191 protocol::ErrorCode error_code) { | 192 protocol::ErrorCode error_code) { |
192 VLOG(1) << "TestChromotingClient::OnConnectionState(" | 193 VLOG(1) << "TestChromotingClient::OnConnectionState(" |
193 << "state: " << protocol::ConnectionToHost::StateToString(state) | 194 << "state: " << protocol::ConnectionToHost::StateToString(state) |
194 << ", error_code: " << protocol::ErrorCodeToString(error_code) | 195 << ", error_code: " << protocol::ErrorCodeToString(error_code) |
195 << ") Called"; | 196 << ") Called"; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 VLOG(1) << "TestChromotingClient::InjectClipboardEvent() Called"; | 271 VLOG(1) << "TestChromotingClient::InjectClipboardEvent() Called"; |
271 } | 272 } |
272 | 273 |
273 void TestChromotingClient::SetCursorShape( | 274 void TestChromotingClient::SetCursorShape( |
274 const protocol::CursorShapeInfo& cursor_shape) { | 275 const protocol::CursorShapeInfo& cursor_shape) { |
275 VLOG(1) << "TestChromotingClient::SetCursorShape() Called"; | 276 VLOG(1) << "TestChromotingClient::SetCursorShape() Called"; |
276 } | 277 } |
277 | 278 |
278 } // namespace test | 279 } // namespace test |
279 } // namespace remoting | 280 } // namespace remoting |
OLD | NEW |