| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "net/quic/congestion_control/pacing_sender.h" | 5 #include "net/quic/congestion_control/pacing_sender.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "net/quic/quic_protocol.h" | 9 #include "net/quic/quic_protocol.h" |
| 10 #include "net/quic/test_tools/mock_clock.h" | 10 #include "net/quic/test_tools/mock_clock.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 infinite_time_(QuicTime::Delta::Infinite()), | 28 infinite_time_(QuicTime::Delta::Infinite()), |
| 29 sequence_number_(1), | 29 sequence_number_(1), |
| 30 mock_sender_(new StrictMock<MockSendAlgorithm>()), | 30 mock_sender_(new StrictMock<MockSendAlgorithm>()), |
| 31 pacing_sender_(new PacingSender(mock_sender_, | 31 pacing_sender_(new PacingSender(mock_sender_, |
| 32 QuicTime::Delta::FromMilliseconds(1), | 32 QuicTime::Delta::FromMilliseconds(1), |
| 33 0)) { | 33 0)) { |
| 34 // Pick arbitrary time. | 34 // Pick arbitrary time. |
| 35 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(9)); | 35 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(9)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 virtual ~PacingSenderTest() {} | 38 ~PacingSenderTest() override {} |
| 39 | 39 |
| 40 void CheckPacketIsSentImmediately() { | 40 void CheckPacketIsSentImmediately() { |
| 41 // In order for the packet to be sendable, the underlying sender must | 41 // In order for the packet to be sendable, the underlying sender must |
| 42 // permit it to be sent immediately. | 42 // permit it to be sent immediately. |
| 43 for (int i = 0; i < 2; ++i) { | 43 for (int i = 0; i < 2; ++i) { |
| 44 EXPECT_CALL(*mock_sender_, TimeUntilSend(clock_.Now(), | 44 EXPECT_CALL(*mock_sender_, TimeUntilSend(clock_.Now(), |
| 45 kBytesInFlight, | 45 kBytesInFlight, |
| 46 HAS_RETRANSMITTABLE_DATA)) | 46 HAS_RETRANSMITTABLE_DATA)) |
| 47 .WillOnce(Return(zero_time_)); | 47 .WillOnce(Return(zero_time_)); |
| 48 // Verify that the packet can be sent immediately. | 48 // Verify that the packet can be sent immediately. |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 // The first packet was a "make up", then we sent two packets "into the | 360 // The first packet was a "make up", then we sent two packets "into the |
| 361 // future", so the delay should be 2ms. | 361 // future", so the delay should be 2ms. |
| 362 CheckPacketIsSentImmediately(); | 362 CheckPacketIsSentImmediately(); |
| 363 CheckPacketIsSentImmediately(); | 363 CheckPacketIsSentImmediately(); |
| 364 CheckPacketIsSentImmediately(); | 364 CheckPacketIsSentImmediately(); |
| 365 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2)); | 365 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2)); |
| 366 } | 366 } |
| 367 | 367 |
| 368 } // namespace test | 368 } // namespace test |
| 369 } // namespace net | 369 } // namespace net |
| OLD | NEW |