| 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_latency_test_fixture.h" | 5 #include "remoting/test/app_remoting_latency_test_fixture.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 9 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 10 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
| 11 #include "remoting/proto/event.pb.h" | 13 #include "remoting/proto/event.pb.h" |
| 12 #include "remoting/protocol/input_stub.h" | 14 #include "remoting/protocol/input_stub.h" |
| 13 #include "remoting/test/app_remoting_connection_helper.h" | 15 #include "remoting/test/app_remoting_connection_helper.h" |
| 14 #include "remoting/test/app_remoting_test_driver_environment.h" | 16 #include "remoting/test/app_remoting_test_driver_environment.h" |
| 15 #include "remoting/test/rgb_value.h" | 17 #include "remoting/test/rgb_value.h" |
| 16 #include "remoting/test/test_chromoting_client.h" | 18 #include "remoting/test/test_chromoting_client.h" |
| 17 #include "remoting/test/test_video_renderer.h" | 19 #include "remoting/test/test_video_renderer.h" |
| 18 | 20 |
| 19 namespace remoting { | 21 namespace remoting { |
| 20 namespace test { | 22 namespace test { |
| 21 | 23 |
| 22 AppRemotingLatencyTestFixture::AppRemotingLatencyTestFixture() | 24 AppRemotingLatencyTestFixture::AppRemotingLatencyTestFixture() |
| 23 : timer_(new base::Timer(true, false)) { | 25 : timer_(new base::Timer(true, false)) { |
| 24 // NOTE: Derived fixture must initialize application details in constructor. | 26 // NOTE: Derived fixture must initialize application details in constructor. |
| 25 } | 27 } |
| 26 | 28 |
| 27 AppRemotingLatencyTestFixture::~AppRemotingLatencyTestFixture() { | 29 AppRemotingLatencyTestFixture::~AppRemotingLatencyTestFixture() {} |
| 28 } | |
| 29 | 30 |
| 30 void AppRemotingLatencyTestFixture::SetUp() { | 31 void AppRemotingLatencyTestFixture::SetUp() { |
| 31 scoped_ptr<TestVideoRenderer> test_video_renderer(new TestVideoRenderer()); | 32 scoped_ptr<TestVideoRenderer> test_video_renderer(new TestVideoRenderer()); |
| 32 test_video_renderer_ = test_video_renderer->GetWeakPtr(); | 33 test_video_renderer_ = test_video_renderer->GetWeakPtr(); |
| 33 | 34 |
| 34 scoped_ptr<TestChromotingClient> test_chromoting_client( | 35 scoped_ptr<TestChromotingClient> test_chromoting_client( |
| 35 new TestChromotingClient(test_video_renderer.Pass())); | 36 new TestChromotingClient(std::move(test_video_renderer))); |
| 36 | 37 |
| 37 test_chromoting_client->AddRemoteConnectionObserver(this); | 38 test_chromoting_client->AddRemoteConnectionObserver(this); |
| 38 | 39 |
| 39 connection_helper_.reset( | 40 connection_helper_.reset( |
| 40 new AppRemotingConnectionHelper(GetApplicationDetails())); | 41 new AppRemotingConnectionHelper(GetApplicationDetails())); |
| 41 connection_helper_->Initialize(test_chromoting_client.Pass()); | 42 connection_helper_->Initialize(std::move(test_chromoting_client)); |
| 42 | 43 |
| 43 if (!connection_helper_->StartConnection()) { | 44 if (!connection_helper_->StartConnection()) { |
| 44 LOG(ERROR) << "Remote host connection could not be established."; | 45 LOG(ERROR) << "Remote host connection could not be established."; |
| 45 FAIL(); | 46 FAIL(); |
| 46 } | 47 } |
| 47 | 48 |
| 48 if (!PrepareApplicationForTesting()) { | 49 if (!PrepareApplicationForTesting()) { |
| 49 LOG(ERROR) << "Unable to prepare application for testing."; | 50 LOG(ERROR) << "Unable to prepare application for testing."; |
| 50 FAIL(); | 51 FAIL(); |
| 51 } | 52 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 166 |
| 166 run_loop_.reset(new base::RunLoop()); | 167 run_loop_.reset(new base::RunLoop()); |
| 167 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 168 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 168 FROM_HERE, run_loop_->QuitClosure(), base::TimeDelta::FromSeconds(2)); | 169 FROM_HERE, run_loop_->QuitClosure(), base::TimeDelta::FromSeconds(2)); |
| 169 run_loop_->Run(); | 170 run_loop_->Run(); |
| 170 run_loop_.reset(); | 171 run_loop_.reset(); |
| 171 } | 172 } |
| 172 | 173 |
| 173 } // namespace test | 174 } // namespace test |
| 174 } // namespace remoting | 175 } // namespace remoting |
| OLD | NEW |