| 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/app_remoting_connected_client_fixture.h" | 5 #include "remoting/test/app_remoting_connected_client_fixture.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return; | 118 return; |
| 119 } | 119 } |
| 120 | 120 |
| 121 DCHECK(!run_loop_ || !run_loop_->running()); | 121 DCHECK(!run_loop_ || !run_loop_->running()); |
| 122 run_loop_.reset(new base::RunLoop()); | 122 run_loop_.reset(new base::RunLoop()); |
| 123 | 123 |
| 124 // We will wait up to 30 seconds to complete the remote connection and for the | 124 // We will wait up to 30 seconds to complete the remote connection and for the |
| 125 // main application window to become visible. | 125 // main application window to become visible. |
| 126 DCHECK(!timer_->IsRunning()); | 126 DCHECK(!timer_->IsRunning()); |
| 127 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(30), | 127 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(30), |
| 128 run_loop_->QuitClosure()); | 128 run_loop_->QuitClosure()); |
| 129 | 129 |
| 130 client_->StartConnection(AppRemotingSharedData->user_name(), | 130 client_->StartConnection(AppRemotingSharedData->user_name(), |
| 131 AppRemotingSharedData->access_token(), | 131 AppRemotingSharedData->access_token(), |
| 132 remote_host_info); | 132 remote_host_info); |
| 133 | 133 |
| 134 run_loop_->Run(); | 134 run_loop_->Run(); |
| 135 timer_->Stop(); | 135 timer_->Stop(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void AppRemotingConnectedClientFixture::ConnectionStateChanged( | 138 void AppRemotingConnectedClientFixture::ConnectionStateChanged( |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 connection_is_ready_for_tests_ = true; | 241 connection_is_ready_for_tests_ = true; |
| 242 | 242 |
| 243 if (timer_->IsRunning()) { | 243 if (timer_->IsRunning()) { |
| 244 timer_->Stop(); | 244 timer_->Stop(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 DCHECK(run_loop_); | 247 DCHECK(run_loop_); |
| 248 // Now that the main window is visible, give the app some time to settle | 248 // Now that the main window is visible, give the app some time to settle |
| 249 // before signaling that it is ready to run tests. | 249 // before signaling that it is ready to run tests. |
| 250 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(2), | 250 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(2), |
| 251 run_loop_->QuitClosure()); | 251 run_loop_->QuitClosure()); |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace test | 255 } // namespace test |
| 256 } // namespace remoting | 256 } // namespace remoting |
| OLD | NEW |