| 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 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 protocol::NetworkSettings::NAT_TRAVERSAL_FULL); | 119 protocol::NetworkSettings::NAT_TRAVERSAL_FULL); |
| 120 | 120 |
| 121 scoped_refptr<protocol::TransportContext> transport_context( | 121 scoped_refptr<protocol::TransportContext> transport_context( |
| 122 new protocol::TransportContext( | 122 new protocol::TransportContext( |
| 123 signal_strategy_.get(), | 123 signal_strategy_.get(), |
| 124 make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory()), | 124 make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory()), |
| 125 make_scoped_ptr( | 125 make_scoped_ptr( |
| 126 new ChromiumUrlRequestFactory(request_context_getter)), | 126 new ChromiumUrlRequestFactory(request_context_getter)), |
| 127 network_settings, protocol::TransportRole::CLIENT)); | 127 network_settings, protocol::TransportRole::CLIENT)); |
| 128 | 128 |
| 129 protocol::ClientAuthenticationConfig client_auth_config; | 129 protocol::FetchSecretCallback fetch_secret_callback; |
| 130 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_secret = connection_setup_info.shared_secret; | |
| 133 | |
| 134 if (!connection_setup_info.pin.empty()) { | 130 if (!connection_setup_info.pin.empty()) { |
| 135 client_auth_config.fetch_secret_callback = | 131 fetch_secret_callback = base::Bind(&FetchSecret, connection_setup_info.pin); |
| 136 base::Bind(&FetchSecret, connection_setup_info.pin); | |
| 137 } | 132 } |
| 138 | 133 |
| 139 client_auth_config.fetch_third_party_token_callback = base::Bind( | 134 protocol::FetchThirdPartyTokenCallback fetch_third_party_token_callback = |
| 140 &FetchThirdPartyToken, connection_setup_info.authorization_code, | 135 base::Bind(&FetchThirdPartyToken, |
| 141 connection_setup_info.shared_secret); | 136 connection_setup_info.authorization_code, |
| 137 connection_setup_info.shared_secret); |
| 142 | 138 |
| 143 chromoting_client_->Start(signal_strategy_.get(), client_auth_config, | 139 scoped_ptr<protocol::Authenticator> authenticator( |
| 144 transport_context, connection_setup_info.host_jid, | 140 new protocol::NegotiatingClientAuthenticator( |
| 145 connection_setup_info.capabilities); | 141 connection_setup_info.pairing_id, connection_setup_info.shared_secret, |
| 142 connection_setup_info.host_id, fetch_secret_callback, |
| 143 fetch_third_party_token_callback)); |
| 144 |
| 145 chromoting_client_->Start( |
| 146 signal_strategy_.get(), std::move(authenticator), transport_context, |
| 147 connection_setup_info.host_jid, connection_setup_info.capabilities); |
| 146 } | 148 } |
| 147 | 149 |
| 148 void TestChromotingClient::EndConnection() { | 150 void TestChromotingClient::EndConnection() { |
| 149 // Clearing out the client will close the connection. | 151 // Clearing out the client will close the connection. |
| 150 chromoting_client_.reset(); | 152 chromoting_client_.reset(); |
| 151 | 153 |
| 152 // The signal strategy object must outlive the client so destroy it next. | 154 // The signal strategy object must outlive the client so destroy it next. |
| 153 signal_strategy_.reset(); | 155 signal_strategy_.reset(); |
| 154 | 156 |
| 155 // The connection state will be updated when the chromoting client was | 157 // The connection state will be updated when the chromoting client was |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 VLOG(1) << "TestChromotingClient::InjectClipboardEvent() Called"; | 267 VLOG(1) << "TestChromotingClient::InjectClipboardEvent() Called"; |
| 266 } | 268 } |
| 267 | 269 |
| 268 void TestChromotingClient::SetCursorShape( | 270 void TestChromotingClient::SetCursorShape( |
| 269 const protocol::CursorShapeInfo& cursor_shape) { | 271 const protocol::CursorShapeInfo& cursor_shape) { |
| 270 VLOG(1) << "TestChromotingClient::SetCursorShape() Called"; | 272 VLOG(1) << "TestChromotingClient::SetCursorShape() Called"; |
| 271 } | 273 } |
| 272 | 274 |
| 273 } // namespace test | 275 } // namespace test |
| 274 } // namespace remoting | 276 } // namespace remoting |
| OLD | NEW |