| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/big_endian.h" | 10 #include "base/big_endian.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Use this function to drain the packet list in PacedSender without having | 114 // Use this function to drain the packet list in PacedSender without having |
| 115 // to test the pacing implementation details. | 115 // to test the pacing implementation details. |
| 116 bool RunUntilEmpty(int max_tries) { | 116 bool RunUntilEmpty(int max_tries) { |
| 117 for (int i = 0; i < max_tries; i++) { | 117 for (int i = 0; i < max_tries; i++) { |
| 118 testing_clock_.Advance(base::TimeDelta::FromMilliseconds(10)); | 118 testing_clock_.Advance(base::TimeDelta::FromMilliseconds(10)); |
| 119 task_runner_->RunTasks(); | 119 task_runner_->RunTasks(); |
| 120 if (mock_transport_.expected_packet_size_.empty()) | 120 if (mock_transport_.expected_packet_size_.empty()) |
| 121 return true; | 121 return true; |
| 122 i++; | |
| 123 } | 122 } |
| 124 | 123 |
| 125 return mock_transport_.expected_packet_size_.empty(); | 124 return mock_transport_.expected_packet_size_.empty(); |
| 126 } | 125 } |
| 127 | 126 |
| 128 std::vector<PacketEvent> packet_events_; | 127 std::vector<PacketEvent> packet_events_; |
| 129 base::SimpleTestTickClock testing_clock_; | 128 base::SimpleTestTickClock testing_clock_; |
| 130 TestPacketSender mock_transport_; | 129 TestPacketSender mock_transport_; |
| 131 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; | 130 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; |
| 132 scoped_ptr<PacedSender> paced_sender_; | 131 scoped_ptr<PacedSender> paced_sender_; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 EXPECT_TRUE(paced_sender_->ResendPackets(packets, dedup_info)); | 457 EXPECT_TRUE(paced_sender_->ResendPackets(packets, dedup_info)); |
| 459 EXPECT_EQ(static_cast<int64_t>(kSize1), mock_transport_.GetBytesSent()); | 458 EXPECT_EQ(static_cast<int64_t>(kSize1), mock_transport_.GetBytesSent()); |
| 460 | 459 |
| 461 dedup_info.resend_interval = base::TimeDelta::FromMilliseconds(5); | 460 dedup_info.resend_interval = base::TimeDelta::FromMilliseconds(5); |
| 462 EXPECT_TRUE(paced_sender_->ResendPackets(packets, dedup_info)); | 461 EXPECT_TRUE(paced_sender_->ResendPackets(packets, dedup_info)); |
| 463 EXPECT_EQ(static_cast<int64_t>(2 * kSize1), mock_transport_.GetBytesSent()); | 462 EXPECT_EQ(static_cast<int64_t>(2 * kSize1), mock_transport_.GetBytesSent()); |
| 464 } | 463 } |
| 465 | 464 |
| 466 } // namespace cast | 465 } // namespace cast |
| 467 } // namespace media | 466 } // namespace media |
| OLD | NEW |