Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: remoting/test/test_chromoting_client.cc

Issue 1521883006: Add TransportContext class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/test/protocol_perftest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
12 #include "jingle/glue/thread_wrapper.h" 12 #include "jingle/glue/thread_wrapper.h"
13 #include "net/base/request_priority.h" 13 #include "net/base/request_priority.h"
14 #include "net/socket/client_socket_factory.h" 14 #include "net/socket/client_socket_factory.h"
15 #include "remoting/base/url_request_context_getter.h" 15 #include "remoting/base/url_request_context_getter.h"
16 #include "remoting/client/audio_player.h" 16 #include "remoting/client/audio_player.h"
17 #include "remoting/client/chromoting_client.h" 17 #include "remoting/client/chromoting_client.h"
18 #include "remoting/client/client_context.h" 18 #include "remoting/client/client_context.h"
19 #include "remoting/client/token_fetcher_proxy.h" 19 #include "remoting/client/token_fetcher_proxy.h"
20 #include "remoting/protocol/chromium_port_allocator.h" 20 #include "remoting/protocol/chromium_port_allocator.h"
21 #include "remoting/protocol/host_stub.h" 21 #include "remoting/protocol/host_stub.h"
22 #include "remoting/protocol/ice_transport_factory.h"
23 #include "remoting/protocol/negotiating_client_authenticator.h" 22 #include "remoting/protocol/negotiating_client_authenticator.h"
24 #include "remoting/protocol/network_settings.h" 23 #include "remoting/protocol/network_settings.h"
25 #include "remoting/protocol/session_config.h" 24 #include "remoting/protocol/session_config.h"
26 #include "remoting/protocol/third_party_client_authenticator.h" 25 #include "remoting/protocol/third_party_client_authenticator.h"
26 #include "remoting/protocol/transport_context.h"
27 #include "remoting/signaling/xmpp_signal_strategy.h" 27 #include "remoting/signaling/xmpp_signal_strategy.h"
28 #include "remoting/test/connection_setup_info.h" 28 #include "remoting/test/connection_setup_info.h"
29 #include "remoting/test/test_video_renderer.h" 29 #include "remoting/test/test_video_renderer.h"
30 30
31 namespace { 31 namespace {
32 const char kXmppHostName[] = "talk.google.com"; 32 const char kXmppHostName[] = "talk.google.com";
33 const int kXmppPortNumber = 5222; 33 const int kXmppPortNumber = 5222;
34 34
35 // Used as the TokenFetcherCallback for App Remoting sessions. 35 // Used as the TokenFetcherCallback for App Remoting sessions.
36 void FetchThirdPartyToken( 36 void FetchThirdPartyToken(
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 xmpp_server_config.auth_token = connection_setup_info.access_token; 115 xmpp_server_config.auth_token = connection_setup_info.access_token;
116 116
117 // Set up the signal strategy. This must outlive the client object. 117 // Set up the signal strategy. This must outlive the client object.
118 signal_strategy_.reset( 118 signal_strategy_.reset(
119 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(), 119 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(),
120 request_context_getter, xmpp_server_config)); 120 request_context_getter, xmpp_server_config));
121 121
122 protocol::NetworkSettings network_settings( 122 protocol::NetworkSettings network_settings(
123 protocol::NetworkSettings::NAT_TRAVERSAL_FULL); 123 protocol::NetworkSettings::NAT_TRAVERSAL_FULL);
124 124
125 scoped_ptr<protocol::ChromiumPortAllocator> port_allocator( 125 scoped_ptr<protocol::ChromiumPortAllocatorFactory> port_allocator_factory(
126 protocol::ChromiumPortAllocator::Create(request_context_getter, 126 new protocol::ChromiumPortAllocatorFactory(request_context_getter));
127 network_settings));
128 127
129 scoped_ptr<protocol::TransportFactory> transport_factory( 128 scoped_refptr<protocol::TransportContext> transport_context(
130 new protocol::IceTransportFactory( 129 new protocol::TransportContext(
131 signal_strategy_.get(), port_allocator.Pass(), network_settings, 130 signal_strategy_.get(), port_allocator_factory.Pass(),
132 protocol::TransportRole::CLIENT)); 131 network_settings, protocol::TransportRole::CLIENT));
133 132
134 scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> 133 scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>
135 token_fetcher(new TokenFetcherProxy( 134 token_fetcher(new TokenFetcherProxy(
136 base::Bind(&FetchThirdPartyToken, 135 base::Bind(&FetchThirdPartyToken,
137 connection_setup_info.authorization_code, 136 connection_setup_info.authorization_code,
138 connection_setup_info.shared_secret), 137 connection_setup_info.shared_secret),
139 connection_setup_info.public_key)); 138 connection_setup_info.public_key));
140 139
141 protocol::FetchSecretCallback fetch_secret_callback; 140 protocol::FetchSecretCallback fetch_secret_callback;
142 if (!connection_setup_info.pin.empty()) { 141 if (!connection_setup_info.pin.empty()) {
143 fetch_secret_callback = base::Bind(&FetchSecret, connection_setup_info.pin); 142 fetch_secret_callback = base::Bind(&FetchSecret, connection_setup_info.pin);
144 } 143 }
145 144
146 scoped_ptr<protocol::Authenticator> authenticator( 145 scoped_ptr<protocol::Authenticator> authenticator(
147 new protocol::NegotiatingClientAuthenticator( 146 new protocol::NegotiatingClientAuthenticator(
148 connection_setup_info.pairing_id, 147 connection_setup_info.pairing_id,
149 connection_setup_info.shared_secret, 148 connection_setup_info.shared_secret,
150 connection_setup_info.host_id, 149 connection_setup_info.host_id,
151 fetch_secret_callback, 150 fetch_secret_callback,
152 token_fetcher.Pass(), 151 token_fetcher.Pass(),
153 connection_setup_info.auth_methods)); 152 connection_setup_info.auth_methods));
154 153
155 chromoting_client_->Start( 154 chromoting_client_->Start(
156 signal_strategy_.get(), authenticator.Pass(), transport_factory.Pass(), 155 signal_strategy_.get(), authenticator.Pass(), transport_context,
157 connection_setup_info.host_jid, connection_setup_info.capabilities); 156 connection_setup_info.host_jid, connection_setup_info.capabilities);
158 } 157 }
159 158
160 void TestChromotingClient::EndConnection() { 159 void TestChromotingClient::EndConnection() {
161 // Clearing out the client will close the connection. 160 // Clearing out the client will close the connection.
162 chromoting_client_.reset(); 161 chromoting_client_.reset();
163 162
164 // The signal strategy object must outlive the client so destroy it next. 163 // The signal strategy object must outlive the client so destroy it next.
165 signal_strategy_.reset(); 164 signal_strategy_.reset();
166 165
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 VLOG(1) << "TestChromotingClient::InjectClipboardEvent() Called"; 271 VLOG(1) << "TestChromotingClient::InjectClipboardEvent() Called";
273 } 272 }
274 273
275 void TestChromotingClient::SetCursorShape( 274 void TestChromotingClient::SetCursorShape(
276 const protocol::CursorShapeInfo& cursor_shape) { 275 const protocol::CursorShapeInfo& cursor_shape) {
277 VLOG(1) << "TestChromotingClient::SetCursorShape() Called"; 276 VLOG(1) << "TestChromotingClient::SetCursorShape() Called";
278 } 277 }
279 278
280 } // namespace test 279 } // namespace test
281 } // namespace remoting 280 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/test/protocol_perftest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698