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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
9 #include "media/cast/cast_defines.h" | 9 #include "media/cast/cast_defines.h" |
10 #include "media/cast/cast_environment.h" | 10 #include "media/cast/cast_environment.h" |
11 #include "media/cast/net/pacing/mock_paced_packet_sender.h" | |
12 #include "media/cast/test/fake_task_runner.h" | 11 #include "media/cast/test/fake_task_runner.h" |
| 12 #include "media/cast/transport/pacing/mock_paced_packet_sender.h" |
13 #include "media/cast/video_receiver/video_receiver.h" | 13 #include "media/cast/video_receiver/video_receiver.h" |
14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
15 | 15 |
16 static const int kPacketSize = 1500; | 16 static const int kPacketSize = 1500; |
17 static const int64 kStartMillisecond = GG_INT64_C(12345678900000); | 17 static const int64 kStartMillisecond = GG_INT64_C(12345678900000); |
18 | 18 |
19 namespace media { | 19 namespace media { |
20 namespace cast { | 20 namespace cast { |
21 | 21 |
22 using testing::_; | 22 using testing::_; |
(...skipping 28 matching lines...) Expand all Loading... |
51 friend class base::RefCountedThreadSafe<TestVideoReceiverCallback>; | 51 friend class base::RefCountedThreadSafe<TestVideoReceiverCallback>; |
52 | 52 |
53 int num_called_; | 53 int num_called_; |
54 }; | 54 }; |
55 } // namespace | 55 } // namespace |
56 | 56 |
57 class PeerVideoReceiver : public VideoReceiver { | 57 class PeerVideoReceiver : public VideoReceiver { |
58 public: | 58 public: |
59 PeerVideoReceiver(scoped_refptr<CastEnvironment> cast_environment, | 59 PeerVideoReceiver(scoped_refptr<CastEnvironment> cast_environment, |
60 const VideoReceiverConfig& video_config, | 60 const VideoReceiverConfig& video_config, |
61 PacedPacketSender* const packet_sender) | 61 transport::PacedPacketSender* const packet_sender) |
62 : VideoReceiver(cast_environment, video_config, packet_sender) { | 62 : VideoReceiver(cast_environment, video_config, packet_sender) { |
63 } | 63 } |
64 using VideoReceiver::IncomingParsedRtpPacket; | 64 using VideoReceiver::IncomingParsedRtpPacket; |
65 }; | 65 }; |
66 | 66 |
67 | 67 |
68 class VideoReceiverTest : public ::testing::Test { | 68 class VideoReceiverTest : public ::testing::Test { |
69 protected: | 69 protected: |
70 VideoReceiverTest() { | 70 VideoReceiverTest() { |
71 // Configure to use vp8 software implementation. | 71 // Configure to use vp8 software implementation. |
(...skipping 17 matching lines...) Expand all Loading... |
89 | 89 |
90 // Always start with a key frame. | 90 // Always start with a key frame. |
91 rtp_header_.is_key_frame = true; | 91 rtp_header_.is_key_frame = true; |
92 rtp_header_.frame_id = 0; | 92 rtp_header_.frame_id = 0; |
93 rtp_header_.packet_id = 0; | 93 rtp_header_.packet_id = 0; |
94 rtp_header_.max_packet_id = 0; | 94 rtp_header_.max_packet_id = 0; |
95 rtp_header_.is_reference = false; | 95 rtp_header_.is_reference = false; |
96 rtp_header_.reference_frame_id = 0; | 96 rtp_header_.reference_frame_id = 0; |
97 } | 97 } |
98 | 98 |
99 MockPacedPacketSender mock_transport_; | 99 transport::MockPacedPacketSender mock_transport_; |
100 VideoReceiverConfig config_; | 100 VideoReceiverConfig config_; |
101 scoped_ptr<PeerVideoReceiver> receiver_; | 101 scoped_ptr<PeerVideoReceiver> receiver_; |
102 std::vector<uint8> payload_; | 102 std::vector<uint8> payload_; |
103 RtpCastHeader rtp_header_; | 103 RtpCastHeader rtp_header_; |
104 base::SimpleTestTickClock testing_clock_; | 104 base::SimpleTestTickClock testing_clock_; |
105 | 105 |
106 scoped_refptr<test::FakeTaskRunner> task_runner_; | 106 scoped_refptr<test::FakeTaskRunner> task_runner_; |
107 scoped_refptr<CastEnvironment> cast_environment_; | 107 scoped_refptr<CastEnvironment> cast_environment_; |
108 scoped_refptr<TestVideoReceiverCallback> video_receiver_callback_; | 108 scoped_refptr<TestVideoReceiverCallback> video_receiver_callback_; |
109 }; | 109 }; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 task_runner_->RunTasks(); | 160 task_runner_->RunTasks(); |
161 EXPECT_EQ(video_receiver_callback_->number_times_called(), 0); | 161 EXPECT_EQ(video_receiver_callback_->number_times_called(), 0); |
162 } | 162 } |
163 | 163 |
164 // TODO(pwestin): add encoded frames. | 164 // TODO(pwestin): add encoded frames. |
165 | 165 |
166 } // namespace cast | 166 } // namespace cast |
167 } // namespace media | 167 } // namespace media |
168 | 168 |
169 | 169 |
OLD | NEW |