| 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 bool first_frame_sent_ = false; | 93 bool first_frame_sent_ = false; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } // namespace | 96 } // namespace |
| 97 | 97 |
| 98 class ConnectionTest : public testing::Test, | 98 class ConnectionTest : public testing::Test, |
| 99 public testing::WithParamInterface<bool> { | 99 public testing::WithParamInterface<bool> { |
| 100 public: | 100 public: |
| 101 ConnectionTest() {} | 101 ConnectionTest() {} |
| 102 | 102 |
| 103 void DestroyHost() { |
| 104 host_connection_.reset(); |
| 105 run_loop_->Quit(); |
| 106 } |
| 107 |
| 103 protected: | 108 protected: |
| 104 bool is_using_webrtc() { return GetParam(); } | 109 bool is_using_webrtc() { return GetParam(); } |
| 105 | 110 |
| 106 void SetUp() override { | 111 void SetUp() override { |
| 107 // Create fake sessions. | 112 // Create fake sessions. |
| 108 host_session_ = new FakeSession(); | 113 host_session_ = new FakeSession(); |
| 109 owned_client_session_.reset(new FakeSession()); | 114 owned_client_session_.reset(new FakeSession()); |
| 110 client_session_ = owned_client_session_.get(); | 115 client_session_ = owned_client_session_.get(); |
| 111 | 116 |
| 112 // Create Connection objects. | 117 // Create Connection objects. |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 event.set_usb_keycode(3); | 309 event.set_usb_keycode(3); |
| 305 event.set_pressed(true); | 310 event.set_pressed(true); |
| 306 | 311 |
| 307 base::RunLoop run_loop; | 312 base::RunLoop run_loop; |
| 308 | 313 |
| 309 EXPECT_CALL(host_event_handler_, | 314 EXPECT_CALL(host_event_handler_, |
| 310 OnInputEventReceived(host_connection_.get(), _)); | 315 OnInputEventReceived(host_connection_.get(), _)); |
| 311 EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(event))) | 316 EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(event))) |
| 312 .WillOnce(QuitRunLoop(&run_loop)); | 317 .WillOnce(QuitRunLoop(&run_loop)); |
| 313 | 318 |
| 314 // Send capabilities from the client. | 319 // Send key event from the client. |
| 315 client_connection_->input_stub()->InjectKeyEvent(event); | 320 client_connection_->input_stub()->InjectKeyEvent(event); |
| 316 | 321 |
| 317 run_loop.Run(); | 322 run_loop.Run(); |
| 318 } | 323 } |
| 319 | 324 |
| 320 TEST_P(ConnectionTest, Video) { | 325 TEST_P(ConnectionTest, Video) { |
| 321 Connect(); | 326 Connect(); |
| 322 | 327 |
| 323 std::unique_ptr<VideoStream> video_stream = | 328 std::unique_ptr<VideoStream> video_stream = |
| 324 host_connection_->StartVideoStream( | 329 host_connection_->StartVideoStream( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 338 | 343 |
| 339 std::unique_ptr<VideoStream> video_stream = | 344 std::unique_ptr<VideoStream> video_stream = |
| 340 host_connection_->StartVideoStream( | 345 host_connection_->StartVideoStream( |
| 341 base::WrapUnique(new TestScreenCapturer())); | 346 base::WrapUnique(new TestScreenCapturer())); |
| 342 | 347 |
| 343 WaitFirstVideoFrame(); | 348 WaitFirstVideoFrame(); |
| 344 } | 349 } |
| 345 | 350 |
| 346 } // namespace protocol | 351 } // namespace protocol |
| 347 } // namespace remoting | 352 } // namespace remoting |
| OLD | NEW |