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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 chromoting_client_.reset(new ChromotingClient(client_context_.get(), | 100 chromoting_client_.reset(new ChromotingClient(client_context_.get(), |
101 this, // client_user_interface. | 101 this, // client_user_interface. |
102 video_renderer_.get(), | 102 video_renderer_.get(), |
103 nullptr)); // audio_player | 103 nullptr)); // audio_player |
104 | 104 |
105 if (test_connection_to_host_) { | 105 if (test_connection_to_host_) { |
106 chromoting_client_->SetConnectionToHostForTests( | 106 chromoting_client_->SetConnectionToHostForTests( |
107 test_connection_to_host_.Pass()); | 107 test_connection_to_host_.Pass()); |
108 } | 108 } |
109 | 109 |
110 XmppSignalStrategy::XmppServerConfig xmpp_server_config; | 110 if (!signal_strategy_) { |
111 xmpp_server_config.host = kXmppHostName; | 111 XmppSignalStrategy::XmppServerConfig xmpp_server_config; |
112 xmpp_server_config.port = kXmppPortNumber; | 112 xmpp_server_config.host = kXmppHostName; |
113 xmpp_server_config.use_tls = true; | 113 xmpp_server_config.port = kXmppPortNumber; |
114 xmpp_server_config.username = connection_setup_info.user_name; | 114 xmpp_server_config.use_tls = true; |
115 xmpp_server_config.auth_token = connection_setup_info.access_token; | 115 xmpp_server_config.username = connection_setup_info.user_name; |
| 116 xmpp_server_config.auth_token = connection_setup_info.access_token; |
116 | 117 |
117 // Set up the signal strategy. This must outlive the client object. | 118 // Set up the signal strategy. This must outlive the client object. |
118 signal_strategy_.reset( | 119 signal_strategy_.reset( |
119 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(), | 120 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(), |
120 request_context_getter, xmpp_server_config)); | 121 request_context_getter, xmpp_server_config)); |
| 122 } |
121 | 123 |
122 protocol::NetworkSettings network_settings( | 124 protocol::NetworkSettings network_settings( |
123 protocol::NetworkSettings::NAT_TRAVERSAL_FULL); | 125 protocol::NetworkSettings::NAT_TRAVERSAL_FULL); |
124 | 126 |
125 scoped_ptr<protocol::ChromiumPortAllocatorFactory> port_allocator_factory( | 127 scoped_ptr<protocol::ChromiumPortAllocatorFactory> port_allocator_factory( |
126 new protocol::ChromiumPortAllocatorFactory(request_context_getter)); | 128 new protocol::ChromiumPortAllocatorFactory(request_context_getter)); |
127 | 129 |
128 scoped_refptr<protocol::TransportContext> transport_context( | 130 scoped_refptr<protocol::TransportContext> transport_context( |
129 new protocol::TransportContext( | 131 new protocol::TransportContext( |
130 signal_strategy_.get(), port_allocator_factory.Pass(), | 132 signal_strategy_.get(), port_allocator_factory.Pass(), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 connection_observers_.AddObserver(observer); | 182 connection_observers_.AddObserver(observer); |
181 } | 183 } |
182 | 184 |
183 void TestChromotingClient::RemoveRemoteConnectionObserver( | 185 void TestChromotingClient::RemoveRemoteConnectionObserver( |
184 RemoteConnectionObserver* observer) { | 186 RemoteConnectionObserver* observer) { |
185 DCHECK(observer); | 187 DCHECK(observer); |
186 | 188 |
187 connection_observers_.RemoveObserver(observer); | 189 connection_observers_.RemoveObserver(observer); |
188 } | 190 } |
189 | 191 |
| 192 void TestChromotingClient::SetSignalStrategyForTests( |
| 193 scoped_ptr<SignalStrategy> signal_strategy) { |
| 194 signal_strategy_ = signal_strategy.Pass(); |
| 195 } |
| 196 |
190 void TestChromotingClient::SetConnectionToHostForTests( | 197 void TestChromotingClient::SetConnectionToHostForTests( |
191 scoped_ptr<protocol::ConnectionToHost> connection_to_host) { | 198 scoped_ptr<protocol::ConnectionToHost> connection_to_host) { |
192 test_connection_to_host_ = connection_to_host.Pass(); | 199 test_connection_to_host_ = connection_to_host.Pass(); |
193 } | 200 } |
194 | 201 |
195 void TestChromotingClient::OnConnectionState( | 202 void TestChromotingClient::OnConnectionState( |
196 protocol::ConnectionToHost::State state, | 203 protocol::ConnectionToHost::State state, |
197 protocol::ErrorCode error_code) { | 204 protocol::ErrorCode error_code) { |
198 VLOG(1) << "TestChromotingClient::OnConnectionState(" | 205 VLOG(1) << "TestChromotingClient::OnConnectionState(" |
199 << "state: " << protocol::ConnectionToHost::StateToString(state) | 206 << "state: " << protocol::ConnectionToHost::StateToString(state) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 VLOG(1) << "TestChromotingClient::InjectClipboardEvent() Called"; | 278 VLOG(1) << "TestChromotingClient::InjectClipboardEvent() Called"; |
272 } | 279 } |
273 | 280 |
274 void TestChromotingClient::SetCursorShape( | 281 void TestChromotingClient::SetCursorShape( |
275 const protocol::CursorShapeInfo& cursor_shape) { | 282 const protocol::CursorShapeInfo& cursor_shape) { |
276 VLOG(1) << "TestChromotingClient::SetCursorShape() Called"; | 283 VLOG(1) << "TestChromotingClient::SetCursorShape() Called"; |
277 } | 284 } |
278 | 285 |
279 } // namespace test | 286 } // namespace test |
280 } // namespace remoting | 287 } // namespace remoting |
OLD | NEW |