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

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

Issue 1237093004: Support for connecting to localhost on the chromoting test driver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored App Remoting and Chromoting code to share StartConnection method. Created 5 years, 5 months 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/app_remoting_connection_helper.h" 5 #include "remoting/test/app_remoting_connection_helper.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "remoting/protocol/host_stub.h" 14 #include "remoting/protocol/host_stub.h"
15 #include "remoting/test/app_remoting_test_driver_environment.h" 15 #include "remoting/test/app_remoting_test_driver_environment.h"
16 #include "remoting/test/connection_info.h"
16 #include "remoting/test/remote_application_details.h" 17 #include "remoting/test/remote_application_details.h"
17 #include "remoting/test/test_chromoting_client.h" 18 #include "remoting/test/test_chromoting_client.h"
18 19
19 namespace { 20 namespace {
20 const int kDefaultDPI = 96; 21 const int kDefaultDPI = 96;
21 const int kDefaultWidth = 1024; 22 const int kDefaultWidth = 1024;
22 const int kDefaultHeight = 768; 23 const int kDefaultHeight = 768;
23 24
24 const char kHostProcessWindowTitle[] = "Host Process"; 25 const char kHostProcessWindowTitle[] = "Host Process";
25 } // namespace 26 } // namespace
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 71
71 DCHECK(!run_loop_ || !run_loop_->running()); 72 DCHECK(!run_loop_ || !run_loop_->running());
72 run_loop_.reset(new base::RunLoop()); 73 run_loop_.reset(new base::RunLoop());
73 74
74 // We will wait up to 30 seconds to complete the remote connection and for the 75 // We will wait up to 30 seconds to complete the remote connection and for the
75 // main application window to become visible. 76 // main application window to become visible.
76 DCHECK(!timer_->IsRunning()); 77 DCHECK(!timer_->IsRunning());
77 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(30), 78 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(30),
78 run_loop_->QuitClosure()); 79 run_loop_->QuitClosure());
79 80
80 client_->StartConnection(AppRemotingSharedData->user_name(), 81 client_->StartConnection(remote_host_info.GenerateConnectionInfo(
81 AppRemotingSharedData->access_token(), 82 AppRemotingSharedData->access_token(),
82 remote_host_info); 83 AppRemotingSharedData->user_name()));
83 84
84 run_loop_->Run(); 85 run_loop_->Run();
85 timer_->Stop(); 86 timer_->Stop();
86 87
87 if (connection_is_ready_for_tests_) { 88 if (connection_is_ready_for_tests_) {
88 return true; 89 return true;
89 } else { 90 } else {
90 client_->EndConnection(); 91 client_->EndConnection();
91 return false; 92 return false;
92 } 93 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 DCHECK(run_loop_); 217 DCHECK(run_loop_);
217 // Now that the main window is visible, give the app some time to settle 218 // Now that the main window is visible, give the app some time to settle
218 // before signaling that it is ready to run tests. 219 // before signaling that it is ready to run tests.
219 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(2), 220 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(2),
220 run_loop_->QuitClosure()); 221 run_loop_->QuitClosure());
221 } 222 }
222 } 223 }
223 224
224 } // namespace test 225 } // namespace test
225 } // namespace remoting 226 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698