| 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 <utility> |
| 8 |
| 7 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 8 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| 9 #include "base/logging.h" | 11 #include "base/logging.h" |
| 10 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 11 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 12 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 13 #include "base/values.h" | 15 #include "base/values.h" |
| 14 #include "remoting/protocol/host_stub.h" | 16 #include "remoting/protocol/host_stub.h" |
| 15 #include "remoting/test/app_remoting_connection_helper.h" | 17 #include "remoting/test/app_remoting_connection_helper.h" |
| 16 #include "remoting/test/app_remoting_test_driver_environment.h" | 18 #include "remoting/test/app_remoting_test_driver_environment.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 32 } | 34 } |
| 33 } | 35 } |
| 34 } // namespace | 36 } // namespace |
| 35 | 37 |
| 36 namespace remoting { | 38 namespace remoting { |
| 37 namespace test { | 39 namespace test { |
| 38 | 40 |
| 39 AppRemotingConnectedClientFixture::AppRemotingConnectedClientFixture() | 41 AppRemotingConnectedClientFixture::AppRemotingConnectedClientFixture() |
| 40 : application_details_( | 42 : application_details_( |
| 41 AppRemotingSharedData->GetDetailsFromAppName(GetParam())), | 43 AppRemotingSharedData->GetDetailsFromAppName(GetParam())), |
| 42 timer_(new base::Timer(true, false)) { | 44 timer_(new base::Timer(true, false)) {} |
| 43 } | |
| 44 | 45 |
| 45 AppRemotingConnectedClientFixture::~AppRemotingConnectedClientFixture() { | 46 AppRemotingConnectedClientFixture::~AppRemotingConnectedClientFixture() {} |
| 46 } | |
| 47 | 47 |
| 48 void AppRemotingConnectedClientFixture::SetUp() { | 48 void AppRemotingConnectedClientFixture::SetUp() { |
| 49 connection_helper_.reset( | 49 connection_helper_.reset( |
| 50 new AppRemotingConnectionHelper(application_details_)); | 50 new AppRemotingConnectionHelper(application_details_)); |
| 51 scoped_ptr<TestChromotingClient> test_chromoting_client( | 51 scoped_ptr<TestChromotingClient> test_chromoting_client( |
| 52 new TestChromotingClient()); | 52 new TestChromotingClient()); |
| 53 | 53 |
| 54 test_chromoting_client->AddRemoteConnectionObserver(this); | 54 test_chromoting_client->AddRemoteConnectionObserver(this); |
| 55 | 55 |
| 56 connection_helper_->Initialize(test_chromoting_client.Pass()); | 56 connection_helper_->Initialize(std::move(test_chromoting_client)); |
| 57 if (!connection_helper_->StartConnection()) { | 57 if (!connection_helper_->StartConnection()) { |
| 58 LOG(ERROR) << "Remote host connection could not be established."; | 58 LOG(ERROR) << "Remote host connection could not be established."; |
| 59 FAIL(); | 59 FAIL(); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 void AppRemotingConnectedClientFixture::TearDown() { | 63 void AppRemotingConnectedClientFixture::TearDown() { |
| 64 connection_helper_->test_chromoting_client()->RemoveRemoteConnectionObserver( | 64 connection_helper_->test_chromoting_client()->RemoveRemoteConnectionObserver( |
| 65 this); | 65 this); |
| 66 connection_helper_.reset(); | 66 connection_helper_.reset(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 run_loop_->Run(); | 102 run_loop_->Run(); |
| 103 timer_->Stop(); | 103 timer_->Stop(); |
| 104 host_message_received_callback_.Reset(); | 104 host_message_received_callback_.Reset(); |
| 105 | 105 |
| 106 return message_received; | 106 return message_received; |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace test | 109 } // namespace test |
| 110 } // namespace remoting | 110 } // namespace remoting |
| OLD | NEW |