OLD | NEW |
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 "net/quic/quic_sent_packet_manager.h" | 5 #include "net/quic/quic_sent_packet_manager.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 8 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
9 #include "net/quic/test_tools/quic_test_utils.h" | 9 #include "net/quic/test_tools/quic_test_utils.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 EXPECT_EQ(delay, | 1053 EXPECT_EQ(delay, |
1054 QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_)); | 1054 QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_)); |
1055 delay = delay.Add(delay); | 1055 delay = delay.Add(delay); |
1056 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(i + 1, _)); | 1056 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(i + 1, _)); |
1057 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout()); | 1057 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout()); |
1058 manager_.OnRetransmissionTimeout(); | 1058 manager_.OnRetransmissionTimeout(); |
1059 RetransmitNextPacket(i + 2); | 1059 RetransmitNextPacket(i + 2); |
1060 } | 1060 } |
1061 } | 1061 } |
1062 | 1062 |
1063 TEST_F(QuicSentPacketManagerTest, GetTestTransmissionDelayTailDrop) { | |
1064 FLAGS_limit_rto_increase_for_tests = true; | |
1065 | |
1066 SendDataPacket(1); | |
1067 QuicTime::Delta delay = QuicTime::Delta::FromMilliseconds(500); | |
1068 EXPECT_CALL(*send_algorithm_, RetransmissionDelay()) | |
1069 .WillRepeatedly(Return(delay)); | |
1070 | |
1071 // No backoff for the first 5 retransmissions. | |
1072 for (int i = 0; i < 5; ++i) { | |
1073 EXPECT_EQ(delay, | |
1074 QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_)); | |
1075 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(i + 1, _)); | |
1076 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout()); | |
1077 manager_.OnRetransmissionTimeout(); | |
1078 RetransmitNextPacket(i + 2); | |
1079 } | |
1080 | |
1081 // Then backoff starts | |
1082 EXPECT_EQ(delay.Add(delay), | |
1083 QuicSentPacketManagerPeer::GetRetransmissionDelay(&manager_)); | |
1084 } | |
1085 | |
1086 } // namespace | 1063 } // namespace |
1087 } // namespace test | 1064 } // namespace test |
1088 } // namespace net | 1065 } // namespace net |
OLD | NEW |