| 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/test/scoped_task_scheduler.h" |
| 14 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 15 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 16 #include "remoting/base/constants.h" | 17 #include "remoting/base/constants.h" |
| 17 #include "remoting/proto/audio.pb.h" | 18 #include "remoting/proto/audio.pb.h" |
| 18 #include "remoting/protocol/audio_source.h" | 19 #include "remoting/protocol/audio_source.h" |
| 19 #include "remoting/protocol/audio_stream.h" | 20 #include "remoting/protocol/audio_stream.h" |
| 20 #include "remoting/protocol/audio_stub.h" | 21 #include "remoting/protocol/audio_stub.h" |
| 21 #include "remoting/protocol/fake_session.h" | 22 #include "remoting/protocol/fake_session.h" |
| 22 #include "remoting/protocol/fake_video_renderer.h" | 23 #include "remoting/protocol/fake_video_renderer.h" |
| 23 #include "remoting/protocol/ice_connection_to_client.h" | 24 #include "remoting/protocol/ice_connection_to_client.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 252 |
| 252 base::WeakPtrFactory<FakeAudioPlayer> weak_factory_; | 253 base::WeakPtrFactory<FakeAudioPlayer> weak_factory_; |
| 253 }; | 254 }; |
| 254 | 255 |
| 255 } // namespace | 256 } // namespace |
| 256 | 257 |
| 257 class ConnectionTest : public testing::Test, | 258 class ConnectionTest : public testing::Test, |
| 258 public testing::WithParamInterface<bool> { | 259 public testing::WithParamInterface<bool> { |
| 259 public: | 260 public: |
| 260 ConnectionTest() | 261 ConnectionTest() |
| 261 : video_encode_thread_("VideoEncode"), | 262 : scoped_task_scheduler_(&message_loop_), |
| 263 video_encode_thread_("VideoEncode"), |
| 262 audio_encode_thread_("AudioEncode"), | 264 audio_encode_thread_("AudioEncode"), |
| 263 audio_decode_thread_("AudioDecode") { | 265 audio_decode_thread_("AudioDecode") { |
| 264 video_encode_thread_.Start(); | 266 video_encode_thread_.Start(); |
| 265 audio_encode_thread_.Start(); | 267 audio_encode_thread_.Start(); |
| 266 audio_decode_thread_.Start(); | 268 audio_decode_thread_.Start(); |
| 267 } | 269 } |
| 268 | 270 |
| 269 void DestroyHost() { | 271 void DestroyHost() { |
| 270 host_connection_.reset(); | 272 host_connection_.reset(); |
| 271 run_loop_->Quit(); | 273 run_loop_->Quit(); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 run_loop.Run(); | 424 run_loop.Run(); |
| 423 client_video_renderer_.GetFrameStatsConsumer()->set_on_stats_callback( | 425 client_video_renderer_.GetFrameStatsConsumer()->set_on_stats_callback( |
| 424 base::Closure()); | 426 base::Closure()); |
| 425 | 427 |
| 426 EXPECT_FALSE(client_video_renderer_.GetFrameStatsConsumer() | 428 EXPECT_FALSE(client_video_renderer_.GetFrameStatsConsumer() |
| 427 ->received_stats() | 429 ->received_stats() |
| 428 .empty()); | 430 .empty()); |
| 429 } | 431 } |
| 430 | 432 |
| 431 base::MessageLoopForIO message_loop_; | 433 base::MessageLoopForIO message_loop_; |
| 434 base::test::ScopedTaskScheduler scoped_task_scheduler_; |
| 432 std::unique_ptr<base::RunLoop> run_loop_; | 435 std::unique_ptr<base::RunLoop> run_loop_; |
| 433 | 436 |
| 434 MockConnectionToClientEventHandler host_event_handler_; | 437 MockConnectionToClientEventHandler host_event_handler_; |
| 435 MockClipboardStub host_clipboard_stub_; | 438 MockClipboardStub host_clipboard_stub_; |
| 436 MockHostStub host_stub_; | 439 MockHostStub host_stub_; |
| 437 MockInputStub host_input_stub_; | 440 MockInputStub host_input_stub_; |
| 438 std::unique_ptr<ConnectionToClient> host_connection_; | 441 std::unique_ptr<ConnectionToClient> host_connection_; |
| 439 FakeSession* host_session_; // Owned by |host_connection_|. | 442 FakeSession* host_session_; // Owned by |host_connection_|. |
| 440 bool host_connected_ = false; | 443 bool host_connected_ = false; |
| 441 | 444 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 auto capturer = base::MakeUnique<TestScreenCapturer>(); | 673 auto capturer = base::MakeUnique<TestScreenCapturer>(); |
| 671 capturer->FailNthFrame(1); | 674 capturer->FailNthFrame(1); |
| 672 auto video_stream = host_connection_->StartVideoStream(std::move(capturer)); | 675 auto video_stream = host_connection_->StartVideoStream(std::move(capturer)); |
| 673 | 676 |
| 674 WaitNextVideoFrame(); | 677 WaitNextVideoFrame(); |
| 675 WaitNextVideoFrame(); | 678 WaitNextVideoFrame(); |
| 676 } | 679 } |
| 677 | 680 |
| 678 } // namespace protocol | 681 } // namespace protocol |
| 679 } // namespace remoting | 682 } // namespace remoting |
| OLD | NEW |