| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 DISALLOW_COPY_AND_ASSIGN(TestPacketSender); | 57 DISALLOW_COPY_AND_ASSIGN(TestPacketSender); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 namespace { | 60 namespace { |
| 61 class PeerVideoSender : public VideoSender { | 61 class PeerVideoSender : public VideoSender { |
| 62 public: | 62 public: |
| 63 PeerVideoSender( | 63 PeerVideoSender( |
| 64 scoped_refptr<CastEnvironment> cast_environment, | 64 scoped_refptr<CastEnvironment> cast_environment, |
| 65 const VideoSenderConfig& video_config, | 65 const VideoSenderConfig& video_config, |
| 66 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories, | 66 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories, |
| 67 const CastInitializationCallback& initialization_status, | 67 const CastInitializationCallback& cast_initialization_cb, |
| 68 transport::CastTransportSender* const transport_sender) | 68 transport::CastTransportSender* const transport_sender) |
| 69 : VideoSender(cast_environment, | 69 : VideoSender(cast_environment, |
| 70 video_config, | 70 video_config, |
| 71 gpu_factories, | 71 gpu_factories, |
| 72 initialization_status, | 72 cast_initialization_cb, |
| 73 transport_sender) {} | 73 transport_sender) {} |
| 74 using VideoSender::OnReceivedCastFeedback; | 74 using VideoSender::OnReceivedCastFeedback; |
| 75 }; | 75 }; |
| 76 } // namespace | 76 } // namespace |
| 77 | 77 |
| 78 class VideoSenderTest : public ::testing::Test { | 78 class VideoSenderTest : public ::testing::Test { |
| 79 protected: | 79 protected: |
| 80 VideoSenderTest() { | 80 VideoSenderTest() { |
| 81 testing_clock_ = new base::SimpleTestTickClock(); | 81 testing_clock_ = new base::SimpleTestTickClock(); |
| 82 testing_clock_->Advance( | 82 testing_clock_->Advance( |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 void RunTasks(int during_ms) { | 160 void RunTasks(int during_ms) { |
| 161 for (int i = 0; i < during_ms; ++i) { | 161 for (int i = 0; i < during_ms; ++i) { |
| 162 // Call process the timers every 1 ms. | 162 // Call process the timers every 1 ms. |
| 163 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); | 163 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); |
| 164 task_runner_->RunTasks(); | 164 task_runner_->RunTasks(); |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 void InitializationResult(CastInitializationStatus result) { | 168 void InitializationResult(CastInitializationStatus result) { |
| 169 EXPECT_EQ(result, STATUS_INITIALIZED); | 169 EXPECT_EQ(result, STATUS_VIDEO_INITIALIZED); |
| 170 } | 170 } |
| 171 | 171 |
| 172 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment. | 172 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment. |
| 173 TestPacketSender transport_; | 173 TestPacketSender transport_; |
| 174 scoped_ptr<transport::CastTransportSenderImpl> transport_sender_; | 174 scoped_ptr<transport::CastTransportSenderImpl> transport_sender_; |
| 175 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; | 175 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; |
| 176 scoped_ptr<PeerVideoSender> video_sender_; | 176 scoped_ptr<PeerVideoSender> video_sender_; |
| 177 scoped_refptr<CastEnvironment> cast_environment_; | 177 scoped_refptr<CastEnvironment> cast_environment_; |
| 178 | 178 |
| 179 DISALLOW_COPY_AND_ASSIGN(VideoSenderTest); | 179 DISALLOW_COPY_AND_ASSIGN(VideoSenderTest); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // Make sure that we do a re-send. | 248 // Make sure that we do a re-send. |
| 249 RunTasks(max_resend_timeout.InMilliseconds()); | 249 RunTasks(max_resend_timeout.InMilliseconds()); |
| 250 // Should have sent at least 3 packets. | 250 // Should have sent at least 3 packets. |
| 251 EXPECT_GE( | 251 EXPECT_GE( |
| 252 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets(), | 252 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets(), |
| 253 3); | 253 3); |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace cast | 256 } // namespace cast |
| 257 } // namespace media | 257 } // namespace media |
| OLD | NEW |