| 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 13 matching lines...) Expand all Loading... |
| 24 #include "remoting/protocol/negotiating_client_authenticator.h" | 24 #include "remoting/protocol/negotiating_client_authenticator.h" |
| 25 #include "remoting/protocol/network_settings.h" | 25 #include "remoting/protocol/network_settings.h" |
| 26 #include "remoting/protocol/session_config.h" | 26 #include "remoting/protocol/session_config.h" |
| 27 #include "remoting/protocol/third_party_client_authenticator.h" | 27 #include "remoting/protocol/third_party_client_authenticator.h" |
| 28 #include "remoting/signaling/xmpp_signal_strategy.h" | 28 #include "remoting/signaling/xmpp_signal_strategy.h" |
| 29 #include "remoting/test/remote_host_info_fetcher.h" | 29 #include "remoting/test/remote_host_info_fetcher.h" |
| 30 #include "remoting/test/test_video_renderer.h" | 30 #include "remoting/test/test_video_renderer.h" |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 const char kAppRemotingCapabilities[] = |
| 35 "rateLimitResizeRequests desktopShape sendInitialResolution googleDrive"; |
| 36 |
| 34 const char kXmppHostName[] = "talk.google.com"; | 37 const char kXmppHostName[] = "talk.google.com"; |
| 35 const int kXmppPortNumber = 5222; | 38 const int kXmppPortNumber = 5222; |
| 36 | 39 |
| 37 // Used as the TokenFetcherCallback for App Remoting sessions. | 40 // Used as the TokenFetcherCallback for App Remoting sessions. |
| 38 void FetchThirdPartyToken( | 41 void FetchThirdPartyToken( |
| 39 const std::string& authorization_token, | 42 const std::string& authorization_token, |
| 40 const std::string& shared_secret, | 43 const std::string& shared_secret, |
| 41 const GURL& token_url, | 44 const GURL& token_url, |
| 42 const std::string& host_public_key, | 45 const std::string& host_public_key, |
| 43 const std::string& scope, | 46 const std::string& scope, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 base::ThreadTaskRunnerHandle::Get(), // network_runner | 156 base::ThreadTaskRunnerHandle::Get(), // network_runner |
| 154 base::ThreadTaskRunnerHandle::Get()); // file_runner | 157 base::ThreadTaskRunnerHandle::Get()); // file_runner |
| 155 | 158 |
| 156 client_context_.reset(new ClientContext(base::ThreadTaskRunnerHandle::Get())); | 159 client_context_.reset(new ClientContext(base::ThreadTaskRunnerHandle::Get())); |
| 157 | 160 |
| 158 video_renderer_.reset(new TestVideoRenderer()); | 161 video_renderer_.reset(new TestVideoRenderer()); |
| 159 | 162 |
| 160 chromoting_client_.reset(new ChromotingClient(client_context_.get(), | 163 chromoting_client_.reset(new ChromotingClient(client_context_.get(), |
| 161 this, // client_user_interface. | 164 this, // client_user_interface. |
| 162 video_renderer_.get(), | 165 video_renderer_.get(), |
| 163 nullptr // audio_player | 166 nullptr)); // audio_player |
| 164 )); | |
| 165 | 167 |
| 166 if (test_connection_to_host_) { | 168 if (test_connection_to_host_) { |
| 167 chromoting_client_->SetConnectionToHostForTests( | 169 chromoting_client_->SetConnectionToHostForTests( |
| 168 test_connection_to_host_.Pass()); | 170 test_connection_to_host_.Pass()); |
| 169 } | 171 } |
| 170 | 172 |
| 171 XmppSignalStrategy::XmppServerConfig xmpp_server_config; | 173 XmppSignalStrategy::XmppServerConfig xmpp_server_config; |
| 172 xmpp_server_config.host = kXmppHostName; | 174 xmpp_server_config.host = kXmppHostName; |
| 173 xmpp_server_config.port = kXmppPortNumber; | 175 xmpp_server_config.port = kXmppPortNumber; |
| 174 xmpp_server_config.use_tls = true; | 176 xmpp_server_config.use_tls = true; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 205 protocol::FetchSecretCallback fetch_secret_callback; | 207 protocol::FetchSecretCallback fetch_secret_callback; |
| 206 scoped_ptr<protocol::Authenticator> authenticator( | 208 scoped_ptr<protocol::Authenticator> authenticator( |
| 207 new protocol::NegotiatingClientAuthenticator( | 209 new protocol::NegotiatingClientAuthenticator( |
| 208 std::string(), // client_pairing_id | 210 std::string(), // client_pairing_id |
| 209 std::string(), // shared_secret | 211 std::string(), // shared_secret |
| 210 std::string(), // authentication_tag | 212 std::string(), // authentication_tag |
| 211 fetch_secret_callback, token_fetcher.Pass(), auth_methods)); | 213 fetch_secret_callback, token_fetcher.Pass(), auth_methods)); |
| 212 | 214 |
| 213 chromoting_client_->Start(signal_strategy_.get(), authenticator.Pass(), | 215 chromoting_client_->Start(signal_strategy_.get(), authenticator.Pass(), |
| 214 transport_factory.Pass(), remote_host_info.host_jid, | 216 transport_factory.Pass(), remote_host_info.host_jid, |
| 215 std::string() // capabilities | 217 kAppRemotingCapabilities); |
| 216 ); | |
| 217 } | 218 } |
| 218 | 219 |
| 219 void TestChromotingClient::EndConnection() { | 220 void TestChromotingClient::EndConnection() { |
| 220 // Clearing out the client will close the connection. | 221 // Clearing out the client will close the connection. |
| 221 chromoting_client_.reset(); | 222 chromoting_client_.reset(); |
| 222 | 223 |
| 223 // The signal strategy object must outlive the client so destroy it next. | 224 // The signal strategy object must outlive the client so destroy it next. |
| 224 signal_strategy_.reset(); | 225 signal_strategy_.reset(); |
| 225 | 226 |
| 226 // The connection state will be updated when the chromoting client was | 227 // The connection state will be updated when the chromoting client was |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 DVLOG(1) << "TestChromotingClient::InjectClipboardEvent() Called"; | 332 DVLOG(1) << "TestChromotingClient::InjectClipboardEvent() Called"; |
| 332 } | 333 } |
| 333 | 334 |
| 334 void TestChromotingClient::SetCursorShape( | 335 void TestChromotingClient::SetCursorShape( |
| 335 const protocol::CursorShapeInfo& cursor_shape) { | 336 const protocol::CursorShapeInfo& cursor_shape) { |
| 336 DVLOG(1) << "TestChromotingClient::SetCursorShape() Called"; | 337 DVLOG(1) << "TestChromotingClient::SetCursorShape() Called"; |
| 337 } | 338 } |
| 338 | 339 |
| 339 } // namespace test | 340 } // namespace test |
| 340 } // namespace remoting | 341 } // namespace remoting |
| OLD | NEW |