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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 void CheckPacketIsDelayed(QuicTime::Delta delay) { | 85 void CheckPacketIsDelayed(QuicTime::Delta delay) { |
86 // In order for the packet to be sendable, the underlying sender must | 86 // In order for the packet to be sendable, the underlying sender must |
87 // permit it to be sent immediately. | 87 // permit it to be sent immediately. |
88 for (int i = 0; i < 2; ++i) { | 88 for (int i = 0; i < 2; ++i) { |
89 EXPECT_CALL(*mock_sender_, TimeUntilSend(clock_.Now(), kBytesInFlight, | 89 EXPECT_CALL(*mock_sender_, TimeUntilSend(clock_.Now(), kBytesInFlight, |
90 HAS_RETRANSMITTABLE_DATA)) | 90 HAS_RETRANSMITTABLE_DATA)) |
91 .WillOnce(Return(zero_time_)); | 91 .WillOnce(Return(zero_time_)); |
92 // Verify that the packet is delayed. | 92 // Verify that the packet is delayed. |
93 EXPECT_EQ(delay.ToMicroseconds(), | 93 EXPECT_EQ(delay.ToMicroseconds(), |
94 pacing_sender_->TimeUntilSend(clock_.Now(), kBytesInFlight, | 94 pacing_sender_ |
95 HAS_RETRANSMITTABLE_DATA) | 95 ->TimeUntilSend(clock_.Now(), kBytesInFlight, |
| 96 HAS_RETRANSMITTABLE_DATA) |
96 .ToMicroseconds()); | 97 .ToMicroseconds()); |
97 } | 98 } |
98 } | 99 } |
99 | 100 |
100 void UpdateRtt() { | 101 void UpdateRtt() { |
101 EXPECT_CALL(*mock_sender_, OnCongestionEvent(true, kBytesInFlight, _, _)); | 102 EXPECT_CALL(*mock_sender_, OnCongestionEvent(true, kBytesInFlight, _, _)); |
102 SendAlgorithmInterface::CongestionVector empty_map; | 103 SendAlgorithmInterface::CongestionVector empty_map; |
103 pacing_sender_->OnCongestionEvent(true, kBytesInFlight, empty_map, | 104 pacing_sender_->OnCongestionEvent(true, kBytesInFlight, empty_map, |
104 empty_map); | 105 empty_map); |
105 } | 106 } |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 EXPECT_CALL(*mock_sender_, GetSlowStartThreshold()).WillOnce(Return(kBytes)); | 388 EXPECT_CALL(*mock_sender_, GetSlowStartThreshold()).WillOnce(Return(kBytes)); |
388 EXPECT_EQ(kBytes, pacing_sender_->GetSlowStartThreshold()); | 389 EXPECT_EQ(kBytes, pacing_sender_->GetSlowStartThreshold()); |
389 | 390 |
390 EXPECT_CALL(*mock_sender_, GetCongestionControlType()) | 391 EXPECT_CALL(*mock_sender_, GetCongestionControlType()) |
391 .WillOnce(Return(kReno)); | 392 .WillOnce(Return(kReno)); |
392 EXPECT_EQ(kReno, pacing_sender_->GetCongestionControlType()); | 393 EXPECT_EQ(kReno, pacing_sender_->GetCongestionControlType()); |
393 } | 394 } |
394 | 395 |
395 } // namespace test | 396 } // namespace test |
396 } // namespace net | 397 } // namespace net |
OLD | NEW |