Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: media/cast/rtcp/rtcp_unittest.cc

Issue 178073004: Cast: IPC from browser to renderer to send packet events from transport to cast library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed hubbe's comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/test/simple_test_tick_clock.h" 5 #include "base/test/simple_test_tick_clock.h"
6 #include "media/cast/cast_defines.h" 6 #include "media/cast/cast_defines.h"
7 #include "media/cast/cast_environment.h" 7 #include "media/cast/cast_environment.h"
8 #include "media/cast/rtcp/mock_rtcp_receiver_feedback.h" 8 #include "media/cast/rtcp/mock_rtcp_receiver_feedback.h"
9 #include "media/cast/rtcp/mock_rtcp_sender_feedback.h" 9 #include "media/cast/rtcp/mock_rtcp_sender_feedback.h"
10 #include "media/cast/rtcp/rtcp.h" 10 #include "media/cast/rtcp/rtcp.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 GetDefaultCastSenderLoggingConfig())), 156 GetDefaultCastSenderLoggingConfig())),
157 sender_to_receiver_(testing_clock_), 157 sender_to_receiver_(testing_clock_),
158 receiver_to_sender_(cast_environment_, testing_clock_) { 158 receiver_to_sender_(cast_environment_, testing_clock_) {
159 testing_clock_->Advance( 159 testing_clock_->Advance(
160 base::TimeDelta::FromMilliseconds(kStartMillisecond)); 160 base::TimeDelta::FromMilliseconds(kStartMillisecond));
161 transport::CastTransportConfig transport_config; 161 transport::CastTransportConfig transport_config;
162 transport_sender_.reset(new transport::CastTransportSenderImpl( 162 transport_sender_.reset(new transport::CastTransportSenderImpl(
163 testing_clock_, 163 testing_clock_,
164 transport_config, 164 transport_config,
165 base::Bind(&UpdateCastTransportStatus), 165 base::Bind(&UpdateCastTransportStatus),
166 base::Bind(&IgnoreRawEvents),
166 task_runner_, 167 task_runner_,
167 &sender_to_receiver_)); 168 &sender_to_receiver_));
168 EXPECT_CALL(mock_sender_feedback_, OnReceivedCastFeedback(_)).Times(0); 169 EXPECT_CALL(mock_sender_feedback_, OnReceivedCastFeedback(_)).Times(0);
169 } 170 }
170 171
171 virtual ~RtcpTest() {} 172 virtual ~RtcpTest() {}
172 173
173 static void UpdateCastTransportStatus(transport::CastTransportStatus status) { 174 static void UpdateCastTransportStatus(transport::CastTransportStatus status) {
174 EXPECT_EQ(status, transport::TRANSPORT_INITIALIZED); 175 EXPECT_EQ(status, transport::TRANSPORT_INITIALIZED);
175 } 176 }
176 177
178 static void IgnoreRawEvents(const std::vector<PacketEvent>& packet_events) {
179 // Do nothing, we don't care about logging in this test.
hubbe 2014/02/26 01:01:07 Can we care?
imcheng 2014/02/26 10:08:26 See other reply.
180 }
181
177 void RunTasks(int during_ms) { 182 void RunTasks(int during_ms) {
178 for (int i = 0; i < during_ms; ++i) { 183 for (int i = 0; i < during_ms; ++i) {
179 // Call process the timers every 1 ms. 184 // Call process the timers every 1 ms.
180 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1)); 185 testing_clock_->Advance(base::TimeDelta::FromMilliseconds(1));
181 task_runner_->RunTasks(); 186 task_runner_->RunTasks();
182 } 187 }
183 } 188 }
184 189
185 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment. 190 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment.
186 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; 191 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_;
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 rtcp_peer.OnReceivedLipSyncInfo(rtp_timestamp, ntp_seconds, ntp_fractions); 627 rtcp_peer.OnReceivedLipSyncInfo(rtp_timestamp, ntp_seconds, ntp_fractions);
623 rtp_timestamp = 64000; 628 rtp_timestamp = 64000;
624 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime( 629 EXPECT_TRUE(rtcp_peer.RtpTimestampInSenderTime(
625 frequency, rtp_timestamp, &rtp_timestamp_in_ticks)); 630 frequency, rtp_timestamp, &rtp_timestamp_in_ticks));
626 EXPECT_EQ(input_time + base::TimeDelta::FromMilliseconds(4000), 631 EXPECT_EQ(input_time + base::TimeDelta::FromMilliseconds(4000),
627 rtp_timestamp_in_ticks); 632 rtp_timestamp_in_ticks);
628 } 633 }
629 634
630 } // namespace cast 635 } // namespace cast
631 } // namespace media 636 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698