| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <gtest/gtest.h> | 5 #include <gtest/gtest.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 TEST_F(CastTransportSenderImplTest, NacksCancelRetransmits) { | 179 TEST_F(CastTransportSenderImplTest, NacksCancelRetransmits) { |
| 180 InitWithLogging(); | 180 InitWithLogging(); |
| 181 InitializeVideo(); | 181 InitializeVideo(); |
| 182 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(50)); | 182 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(50)); |
| 183 EXPECT_EQ(0, num_times_logging_callback_called_); | 183 EXPECT_EQ(0, num_times_logging_callback_called_); |
| 184 | 184 |
| 185 // A fake frame that will be decomposed into 4 packets. | 185 // A fake frame that will be decomposed into 4 packets. |
| 186 EncodedFrame fake_frame; | 186 EncodedFrame fake_frame; |
| 187 fake_frame.frame_id = 1; | 187 fake_frame.frame_id = 1; |
| 188 fake_frame.rtp_timestamp = 1; | 188 fake_frame.rtp_timestamp = RtpTimeTicks().Expand(UINT32_C(1)); |
| 189 fake_frame.dependency = EncodedFrame::KEY; | 189 fake_frame.dependency = EncodedFrame::KEY; |
| 190 fake_frame.data.resize(5000, ' '); | 190 fake_frame.data.resize(5000, ' '); |
| 191 | 191 |
| 192 transport_sender_->InsertFrame(kVideoSsrc, fake_frame); | 192 transport_sender_->InsertFrame(kVideoSsrc, fake_frame); |
| 193 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(10)); | 193 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(10)); |
| 194 EXPECT_EQ(4, transport_.packets_sent()); | 194 EXPECT_EQ(4, transport_.packets_sent()); |
| 195 EXPECT_EQ(1, num_times_logging_callback_called_); | 195 EXPECT_EQ(1, num_times_logging_callback_called_); |
| 196 | 196 |
| 197 // Resend packet 0. | 197 // Resend packet 0. |
| 198 MissingFramesAndPacketsMap missing_packets; | 198 MissingFramesAndPacketsMap missing_packets; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 227 | 227 |
| 228 TEST_F(CastTransportSenderImplTest, CancelRetransmits) { | 228 TEST_F(CastTransportSenderImplTest, CancelRetransmits) { |
| 229 InitWithLogging(); | 229 InitWithLogging(); |
| 230 InitializeVideo(); | 230 InitializeVideo(); |
| 231 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(50)); | 231 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(50)); |
| 232 EXPECT_EQ(0, num_times_logging_callback_called_); | 232 EXPECT_EQ(0, num_times_logging_callback_called_); |
| 233 | 233 |
| 234 // A fake frame that will be decomposed into 4 packets. | 234 // A fake frame that will be decomposed into 4 packets. |
| 235 EncodedFrame fake_frame; | 235 EncodedFrame fake_frame; |
| 236 fake_frame.frame_id = 1; | 236 fake_frame.frame_id = 1; |
| 237 fake_frame.rtp_timestamp = 1; | 237 fake_frame.rtp_timestamp = RtpTimeTicks().Expand(UINT32_C(1)); |
| 238 fake_frame.dependency = EncodedFrame::KEY; | 238 fake_frame.dependency = EncodedFrame::KEY; |
| 239 fake_frame.data.resize(5000, ' '); | 239 fake_frame.data.resize(5000, ' '); |
| 240 | 240 |
| 241 transport_sender_->InsertFrame(kVideoSsrc, fake_frame); | 241 transport_sender_->InsertFrame(kVideoSsrc, fake_frame); |
| 242 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(10)); | 242 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(10)); |
| 243 EXPECT_EQ(4, transport_.packets_sent()); | 243 EXPECT_EQ(4, transport_.packets_sent()); |
| 244 EXPECT_EQ(1, num_times_logging_callback_called_); | 244 EXPECT_EQ(1, num_times_logging_callback_called_); |
| 245 | 245 |
| 246 // Resend all packets for frame 1. | 246 // Resend all packets for frame 1. |
| 247 MissingFramesAndPacketsMap missing_packets; | 247 MissingFramesAndPacketsMap missing_packets; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 270 | 270 |
| 271 TEST_F(CastTransportSenderImplTest, Kickstart) { | 271 TEST_F(CastTransportSenderImplTest, Kickstart) { |
| 272 InitWithLogging(); | 272 InitWithLogging(); |
| 273 InitializeVideo(); | 273 InitializeVideo(); |
| 274 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(50)); | 274 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(50)); |
| 275 EXPECT_EQ(0, num_times_logging_callback_called_); | 275 EXPECT_EQ(0, num_times_logging_callback_called_); |
| 276 | 276 |
| 277 // A fake frame that will be decomposed into 4 packets. | 277 // A fake frame that will be decomposed into 4 packets. |
| 278 EncodedFrame fake_frame; | 278 EncodedFrame fake_frame; |
| 279 fake_frame.frame_id = 1; | 279 fake_frame.frame_id = 1; |
| 280 fake_frame.rtp_timestamp = 1; | 280 fake_frame.rtp_timestamp = RtpTimeTicks().Expand(UINT32_C(1)); |
| 281 fake_frame.dependency = EncodedFrame::KEY; | 281 fake_frame.dependency = EncodedFrame::KEY; |
| 282 fake_frame.data.resize(5000, ' '); | 282 fake_frame.data.resize(5000, ' '); |
| 283 | 283 |
| 284 transport_.SetPaused(true); | 284 transport_.SetPaused(true); |
| 285 transport_sender_->InsertFrame(kVideoSsrc, fake_frame); | 285 transport_sender_->InsertFrame(kVideoSsrc, fake_frame); |
| 286 transport_sender_->ResendFrameForKickstart(kVideoSsrc, 1); | 286 transport_sender_->ResendFrameForKickstart(kVideoSsrc, 1); |
| 287 transport_.SetPaused(false); | 287 transport_.SetPaused(false); |
| 288 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(10)); | 288 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(10)); |
| 289 EXPECT_EQ(4, transport_.packets_sent()); | 289 EXPECT_EQ(4, transport_.packets_sent()); |
| 290 EXPECT_EQ(1, num_times_logging_callback_called_); | 290 EXPECT_EQ(1, num_times_logging_callback_called_); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 task_runner_->RunTasks(); | 386 task_runner_->RunTasks(); |
| 387 EXPECT_EQ(7, transport_.packets_sent()); | 387 EXPECT_EQ(7, transport_.packets_sent()); |
| 388 EXPECT_EQ(1, num_times_logging_callback_called_); // Only 8 ms since last. | 388 EXPECT_EQ(1, num_times_logging_callback_called_); // Only 8 ms since last. |
| 389 | 389 |
| 390 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2)); | 390 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2)); |
| 391 EXPECT_EQ(2, num_times_logging_callback_called_); | 391 EXPECT_EQ(2, num_times_logging_callback_called_); |
| 392 } | 392 } |
| 393 | 393 |
| 394 } // namespace cast | 394 } // namespace cast |
| 395 } // namespace media | 395 } // namespace media |
| OLD | NEW |