| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/test/simple_test_tick_clock.h" | 9 #include "base/test/simple_test_tick_clock.h" |
| 10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(TestPacketSender); | 57 DISALLOW_COPY_AND_ASSIGN(TestPacketSender); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 class PeerVideoSender : public VideoSender { | 60 class PeerVideoSender : public VideoSender { |
| 61 public: | 61 public: |
| 62 PeerVideoSender( | 62 PeerVideoSender( |
| 63 scoped_refptr<CastEnvironment> cast_environment, | 63 scoped_refptr<CastEnvironment> cast_environment, |
| 64 const VideoSenderConfig& video_config, | 64 const VideoSenderConfig& video_config, |
| 65 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories, | 65 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories, |
| 66 const CastInitializationCallback& initialization_status, | 66 const CastInitializationCallback& cast_initialization_cb, |
| 67 transport::CastTransportSender* const transport_sender) | 67 transport::CastTransportSender* const transport_sender) |
| 68 : VideoSender(cast_environment, | 68 : VideoSender(cast_environment, |
| 69 video_config, | 69 video_config, |
| 70 gpu_factories, | 70 gpu_factories, |
| 71 initialization_status, | 71 cast_initialization_cb, |
| 72 transport_sender) {} | 72 transport_sender) {} |
| 73 using VideoSender::OnReceivedCastFeedback; | 73 using VideoSender::OnReceivedCastFeedback; |
| 74 }; | 74 }; |
| 75 } // namespace | 75 } // namespace |
| 76 | 76 |
| 77 class VideoSenderTest : public ::testing::Test { | 77 class VideoSenderTest : public ::testing::Test { |
| 78 protected: | 78 protected: |
| 79 VideoSenderTest() { | 79 VideoSenderTest() { |
| 80 testing_clock_ = new base::SimpleTestTickClock(); | 80 testing_clock_ = new base::SimpleTestTickClock(); |
| 81 testing_clock_->Advance( | 81 testing_clock_->Advance( |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 void RunTasks(int during_ms) { | 168 void RunTasks(int during_ms) { |
| 169 for (int i = 0; i < during_ms; ++i) { | 169 for (int i = 0; i < during_ms; ++i) { |
| 170 // Call process the timers every 1 ms. | 170 // Call process the timers every 1 ms. |
| 171 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); | 171 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); |
| 172 task_runner_->RunTasks(); | 172 task_runner_->RunTasks(); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 void InitializationResult(CastInitializationStatus result) { | 176 void InitializationResult(CastInitializationStatus result) { |
| 177 EXPECT_EQ(result, STATUS_INITIALIZED); | 177 EXPECT_EQ(result, STATUS_VIDEO_INITIALIZED); |
| 178 } | 178 } |
| 179 | 179 |
| 180 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment. | 180 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment. |
| 181 TestPacketSender transport_; | 181 TestPacketSender transport_; |
| 182 scoped_ptr<transport::CastTransportSenderImpl> transport_sender_; | 182 scoped_ptr<transport::CastTransportSenderImpl> transport_sender_; |
| 183 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; | 183 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; |
| 184 scoped_ptr<PeerVideoSender> video_sender_; | 184 scoped_ptr<PeerVideoSender> video_sender_; |
| 185 scoped_refptr<CastEnvironment> cast_environment_; | 185 scoped_refptr<CastEnvironment> cast_environment_; |
| 186 | 186 |
| 187 DISALLOW_COPY_AND_ASSIGN(VideoSenderTest); | 187 DISALLOW_COPY_AND_ASSIGN(VideoSenderTest); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 // Empty the pipeline. | 335 // Empty the pipeline. |
| 336 RunTasks(100); | 336 RunTasks(100); |
| 337 // Should have sent at least 7 packets. | 337 // Should have sent at least 7 packets. |
| 338 EXPECT_GE( | 338 EXPECT_GE( |
| 339 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets(), | 339 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets(), |
| 340 7); | 340 7); |
| 341 } | 341 } |
| 342 | 342 |
| 343 } // namespace cast | 343 } // namespace cast |
| 344 } // namespace media | 344 } // namespace media |
| OLD | NEW |