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