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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 task_runner_, | 89 task_runner_, |
90 task_runner_, | 90 task_runner_, |
91 task_runner_, | 91 task_runner_, |
92 task_runner_, | 92 task_runner_, |
93 GetDefaultCastSenderLoggingConfig()); | 93 GetDefaultCastSenderLoggingConfig()); |
94 transport::CastTransportConfig transport_config; | 94 transport::CastTransportConfig transport_config; |
95 transport_sender_.reset(new transport::CastTransportSenderImpl( | 95 transport_sender_.reset(new transport::CastTransportSenderImpl( |
96 testing_clock_, | 96 testing_clock_, |
97 transport_config, | 97 transport_config, |
98 base::Bind(&UpdateCastTransportStatus), | 98 base::Bind(&UpdateCastTransportStatus), |
99 base::Bind(&IgnoreRawEvents), | |
99 task_runner_, | 100 task_runner_, |
100 &transport_)); | 101 &transport_)); |
101 } | 102 } |
102 | 103 |
103 virtual ~VideoSenderTest() {} | 104 virtual ~VideoSenderTest() {} |
104 | 105 |
105 virtual void TearDown() OVERRIDE { | 106 virtual void TearDown() OVERRIDE { |
106 video_sender_.reset(); | 107 video_sender_.reset(); |
107 task_runner_->RunTasks(); | 108 task_runner_->RunTasks(); |
108 } | 109 } |
109 | 110 |
110 static void UpdateCastTransportStatus(transport::CastTransportStatus status) { | 111 static void UpdateCastTransportStatus(transport::CastTransportStatus status) { |
111 EXPECT_EQ(status, transport::TRANSPORT_INITIALIZED); | 112 EXPECT_EQ(status, transport::TRANSPORT_INITIALIZED); |
112 } | 113 } |
113 | 114 |
115 static void IgnoreRawEvents(const std::vector<PacketEvent>& packet_events) { | |
116 // Do nothing, we don't care about logging in this test. | |
hubbe
2014/02/26 01:01:07
Maybe we should care?
Or perhaps write a separate
imcheng
2014/02/26 10:08:26
See other reply.
I wrote a test for CastTransport
| |
117 } | |
118 | |
114 void InitEncoder(bool external) { | 119 void InitEncoder(bool external) { |
115 VideoSenderConfig video_config; | 120 VideoSenderConfig video_config; |
116 video_config.sender_ssrc = 1; | 121 video_config.sender_ssrc = 1; |
117 video_config.incoming_feedback_ssrc = 2; | 122 video_config.incoming_feedback_ssrc = 2; |
118 video_config.rtcp_c_name = "video_test@10.1.1.1"; | 123 video_config.rtcp_c_name = "video_test@10.1.1.1"; |
119 video_config.rtp_config.payload_type = 127; | 124 video_config.rtp_config.payload_type = 127; |
120 video_config.use_external_encoder = external; | 125 video_config.use_external_encoder = external; |
121 video_config.width = kWidth; | 126 video_config.width = kWidth; |
122 video_config.height = kHeight; | 127 video_config.height = kHeight; |
123 video_config.max_bitrate = 5000000; | 128 video_config.max_bitrate = 5000000; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 // Make sure that we do a re-send. | 253 // Make sure that we do a re-send. |
249 RunTasks(max_resend_timeout.InMilliseconds()); | 254 RunTasks(max_resend_timeout.InMilliseconds()); |
250 // Should have sent at least 3 packets. | 255 // Should have sent at least 3 packets. |
251 EXPECT_GE( | 256 EXPECT_GE( |
252 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets(), | 257 transport_.number_of_rtp_packets() + transport_.number_of_rtcp_packets(), |
253 3); | 258 3); |
254 } | 259 } |
255 | 260 |
256 } // namespace cast | 261 } // namespace cast |
257 } // namespace media | 262 } // namespace media |
OLD | NEW |