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

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

Issue 2542343004: Updating the Chromoting Test Driver to target the test environment (Closed)
Patch Set: Addressing feedback Created 4 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
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 <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 17 matching lines...) Expand all
28 #include "remoting/protocol/transport_context.h" 28 #include "remoting/protocol/transport_context.h"
29 #include "remoting/signaling/xmpp_signal_strategy.h" 29 #include "remoting/signaling/xmpp_signal_strategy.h"
30 #include "remoting/test/connection_setup_info.h" 30 #include "remoting/test/connection_setup_info.h"
31 #include "remoting/test/test_video_renderer.h" 31 #include "remoting/test/test_video_renderer.h"
32 32
33 namespace remoting { 33 namespace remoting {
34 namespace test { 34 namespace test {
35 35
36 namespace { 36 namespace {
37 const char kXmppHostName[] = "talk.google.com"; 37 const char kXmppHostName[] = "talk.google.com";
38 const int kXmppPortNumber = 5222; 38 const int kProdXmppPortNumber = 5222;
39 const int kTestXmppPortNumber = 19316;
39 40
40 // Used as the TokenFetcherCallback for App Remoting sessions. 41 // Used as the TokenFetcherCallback for App Remoting sessions.
41 void FetchThirdPartyToken( 42 void FetchThirdPartyToken(
42 const std::string& authorization_token, 43 const std::string& authorization_token,
43 const std::string& shared_secret, 44 const std::string& shared_secret,
44 const std::string& token_url, 45 const std::string& token_url,
45 const std::string& scope, 46 const std::string& scope,
46 const protocol::ThirdPartyTokenFetchedCallback& token_fetched_callback) { 47 const protocol::ThirdPartyTokenFetchedCallback& token_fetched_callback) {
47 VLOG(2) << "FetchThirdPartyToken(" 48 VLOG(2) << "FetchThirdPartyToken("
48 << "token_url: " << token_url << ", " 49 << "token_url: " << token_url << ", "
(...skipping 20 matching lines...) Expand all
69 connection_error_code_(protocol::OK), 70 connection_error_code_(protocol::OK),
70 video_renderer_(std::move(video_renderer)) {} 71 video_renderer_(std::move(video_renderer)) {}
71 72
72 TestChromotingClient::~TestChromotingClient() { 73 TestChromotingClient::~TestChromotingClient() {
73 // Ensure any connections are closed and the members are destroyed in the 74 // Ensure any connections are closed and the members are destroyed in the
74 // appropriate order. 75 // appropriate order.
75 EndConnection(); 76 EndConnection();
76 } 77 }
77 78
78 void TestChromotingClient::StartConnection( 79 void TestChromotingClient::StartConnection(
80 bool use_test_api_values,
79 const ConnectionSetupInfo& connection_setup_info) { 81 const ConnectionSetupInfo& connection_setup_info) {
80 // Required to establish a connection to the host. 82 // Required to establish a connection to the host.
81 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); 83 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop();
82 84
83 scoped_refptr<URLRequestContextGetter> request_context_getter; 85 scoped_refptr<URLRequestContextGetter> request_context_getter;
84 request_context_getter = new URLRequestContextGetter( 86 request_context_getter = new URLRequestContextGetter(
85 base::ThreadTaskRunnerHandle::Get(), // network_runner 87 base::ThreadTaskRunnerHandle::Get(), // network_runner
86 base::ThreadTaskRunnerHandle::Get()); // file_runner 88 base::ThreadTaskRunnerHandle::Get()); // file_runner
87 89
88 client_context_.reset(new ClientContext(base::ThreadTaskRunnerHandle::Get())); 90 client_context_.reset(new ClientContext(base::ThreadTaskRunnerHandle::Get()));
89 91
90 // Check to see if the user passed in a customized video renderer. 92 // Check to see if the user passed in a customized video renderer.
91 if (!video_renderer_) { 93 if (!video_renderer_) {
92 video_renderer_.reset(new TestVideoRenderer()); 94 video_renderer_.reset(new TestVideoRenderer());
93 } 95 }
94 96
95 chromoting_client_.reset(new ChromotingClient(client_context_.get(), 97 chromoting_client_.reset(new ChromotingClient(client_context_.get(),
96 this, // client_user_interface. 98 this, // client_user_interface.
97 video_renderer_.get(), 99 video_renderer_.get(),
98 nullptr)); // audio_player 100 nullptr)); // audio_player
99 101
100 if (test_connection_to_host_) { 102 if (test_connection_to_host_) {
101 chromoting_client_->SetConnectionToHostForTests( 103 chromoting_client_->SetConnectionToHostForTests(
102 std::move(test_connection_to_host_)); 104 std::move(test_connection_to_host_));
103 } 105 }
104 106
105 if (!signal_strategy_) { 107 if (!signal_strategy_) {
106 XmppSignalStrategy::XmppServerConfig xmpp_server_config; 108 XmppSignalStrategy::XmppServerConfig xmpp_server_config;
107 xmpp_server_config.host = kXmppHostName; 109 xmpp_server_config.host = kXmppHostName;
108 xmpp_server_config.port = kXmppPortNumber; 110 xmpp_server_config.port =
109 xmpp_server_config.use_tls = true; 111 use_test_api_values ? kTestXmppPortNumber : kProdXmppPortNumber;
112 xmpp_server_config.use_tls = !use_test_api_values;
110 xmpp_server_config.username = connection_setup_info.user_name; 113 xmpp_server_config.username = connection_setup_info.user_name;
111 xmpp_server_config.auth_token = connection_setup_info.access_token; 114 xmpp_server_config.auth_token = connection_setup_info.access_token;
112 115
113 // Set up the signal strategy. This must outlive the client object. 116 // Set up the signal strategy. This must outlive the client object.
114 signal_strategy_.reset( 117 signal_strategy_.reset(
115 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(), 118 new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(),
116 request_context_getter, xmpp_server_config)); 119 request_context_getter, xmpp_server_config));
117 } 120 }
118 121
119 protocol::NetworkSettings network_settings( 122 protocol::NetworkSettings network_settings(
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 VLOG(1) << "TestChromotingClient::InjectClipboardEvent() Called"; 273 VLOG(1) << "TestChromotingClient::InjectClipboardEvent() Called";
271 } 274 }
272 275
273 void TestChromotingClient::SetCursorShape( 276 void TestChromotingClient::SetCursorShape(
274 const protocol::CursorShapeInfo& cursor_shape) { 277 const protocol::CursorShapeInfo& cursor_shape) {
275 VLOG(1) << "TestChromotingClient::SetCursorShape() Called"; 278 VLOG(1) << "TestChromotingClient::SetCursorShape() Called";
276 } 279 }
277 280
278 } // namespace test 281 } // namespace test
279 } // namespace remoting 282 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/test/test_chromoting_client.h ('k') | remoting/test/test_chromoting_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698