| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/test/simple_test_tick_clock.h" | 11 #include "base/test/simple_test_tick_clock.h" |
| 12 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
| 13 #include "media/cast/cast_environment.h" | 13 #include "media/cast/cast_environment.h" |
| 14 #include "media/cast/logging/simple_event_subscriber.h" | 14 #include "media/cast/logging/simple_event_subscriber.h" |
| 15 #include "media/cast/test/fake_single_thread_task_runner.h" | 15 #include "media/cast/test/fake_single_thread_task_runner.h" |
| 16 #include "media/cast/test/fake_video_encode_accelerator.h" | 16 #include "media/cast/test/fake_video_encode_accelerator.h" |
| 17 #include "media/cast/test/utility/default_config.h" | 17 #include "media/cast/test/utility/default_config.h" |
| 18 #include "media/cast/test/utility/video_utility.h" | 18 #include "media/cast/test/utility/video_utility.h" |
| 19 #include "media/cast/transport/cast_transport_config.h" | 19 #include "media/cast/transport/cast_transport_config.h" |
| 20 #include "media/cast/transport/cast_transport_sender_impl.h" | 20 #include "media/cast/transport/cast_transport_sender_impl.h" |
| 21 #include "media/cast/transport/pacing/paced_sender.h" | 21 #include "media/cast/transport/pacing/paced_sender.h" |
| 22 #include "media/cast/video_sender/video_sender.h" | 22 #include "media/cast/video_sender/video_sender.h" |
| 23 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 25 |
| 26 namespace media { | 26 namespace media { |
| 27 namespace cast { | 27 namespace cast { |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 static const int64 kStartMillisecond = INT64_C(12345678900000); | |
| 31 static const uint8 kPixelValue = 123; | 30 static const uint8 kPixelValue = 123; |
| 32 static const int kWidth = 320; | 31 static const int kWidth = 320; |
| 33 static const int kHeight = 240; | 32 static const int kHeight = 240; |
| 34 | 33 |
| 35 using testing::_; | 34 using testing::_; |
| 36 using testing::AtLeast; | 35 using testing::AtLeast; |
| 37 | 36 |
| 38 void CreateVideoEncodeAccelerator( | 37 void CreateVideoEncodeAccelerator( |
| 39 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 38 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 40 scoped_ptr<VideoEncodeAccelerator> fake_vea, | 39 scoped_ptr<VideoEncodeAccelerator> fake_vea, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 cast_initialization_cb, | 99 cast_initialization_cb, |
| 101 transport_sender) {} | 100 transport_sender) {} |
| 102 using VideoSender::OnReceivedCastFeedback; | 101 using VideoSender::OnReceivedCastFeedback; |
| 103 }; | 102 }; |
| 104 } // namespace | 103 } // namespace |
| 105 | 104 |
| 106 class VideoSenderTest : public ::testing::Test { | 105 class VideoSenderTest : public ::testing::Test { |
| 107 protected: | 106 protected: |
| 108 VideoSenderTest() { | 107 VideoSenderTest() { |
| 109 testing_clock_ = new base::SimpleTestTickClock(); | 108 testing_clock_ = new base::SimpleTestTickClock(); |
| 110 testing_clock_->Advance( | 109 testing_clock_->Advance(base::TimeTicks::Now() - base::TimeTicks()); |
| 111 base::TimeDelta::FromMilliseconds(kStartMillisecond)); | |
| 112 task_runner_ = new test::FakeSingleThreadTaskRunner(testing_clock_); | 110 task_runner_ = new test::FakeSingleThreadTaskRunner(testing_clock_); |
| 113 cast_environment_ = | 111 cast_environment_ = |
| 114 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_).Pass(), | 112 new CastEnvironment(scoped_ptr<base::TickClock>(testing_clock_).Pass(), |
| 115 task_runner_, | 113 task_runner_, |
| 116 task_runner_, | 114 task_runner_, |
| 117 task_runner_); | 115 task_runner_); |
| 118 net::IPEndPoint dummy_endpoint; | 116 net::IPEndPoint dummy_endpoint; |
| 119 transport_sender_.reset(new transport::CastTransportSenderImpl( | 117 transport_sender_.reset(new transport::CastTransportSenderImpl( |
| 120 NULL, | 118 NULL, |
| 121 testing_clock_, | 119 testing_clock_, |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // Empty the pipeline. | 362 // Empty the pipeline. |
| 365 RunTasks(100); | 363 RunTasks(100); |
| 366 // Should have sent at least 7 packets. | 364 // Should have sent at least 7 packets. |
| 367 EXPECT_LE( | 365 EXPECT_LE( |
| 368 7, | 366 7, |
| 369 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets()); | 367 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets()); |
| 370 } | 368 } |
| 371 | 369 |
| 372 } // namespace cast | 370 } // namespace cast |
| 373 } // namespace media | 371 } // namespace media |
| OLD | NEW |