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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 | 1031 |
1032 // Retransmit 2 crypto packets, but not the serialized packet. | 1032 // Retransmit 2 crypto packets, but not the serialized packet. |
1033 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(2); | 1033 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(2); |
1034 manager_.OnRetransmissionTimeout(); | 1034 manager_.OnRetransmissionTimeout(); |
1035 RetransmitNextPacket(6); | 1035 RetransmitNextPacket(6); |
1036 RetransmitNextPacket(7); | 1036 RetransmitNextPacket(7); |
1037 EXPECT_FALSE(manager_.HasPendingRetransmissions()); | 1037 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
1038 EXPECT_TRUE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); | 1038 EXPECT_TRUE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); |
1039 } | 1039 } |
1040 | 1040 |
| 1041 TEST_F(QuicSentPacketManagerTest, TailLossProbeTimeoutUnsentDataPacket) { |
| 1042 QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2); |
| 1043 // Serialize two data packets and send the latter. |
| 1044 SerializedPacket packet(CreateDataPacket(1)); |
| 1045 manager_.OnSerializedPacket(packet); |
| 1046 SendDataPacket(2); |
| 1047 EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); |
| 1048 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); |
| 1049 |
| 1050 // Retransmit 1 unacked packets, but not the first serialized packet. |
| 1051 manager_.OnRetransmissionTimeout(); |
| 1052 RetransmitNextPacket(3); |
| 1053 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
| 1054 EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); |
| 1055 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); |
| 1056 } |
| 1057 |
1041 TEST_F(QuicSentPacketManagerTest, RetransmissionTimeout) { | 1058 TEST_F(QuicSentPacketManagerTest, RetransmissionTimeout) { |
1042 // Send 100 packets and then ensure all are abandoned when the RTO fires. | 1059 // Send 100 packets and then ensure all are abandoned when the RTO fires. |
1043 const size_t kNumSentPackets = 100; | 1060 const size_t kNumSentPackets = 100; |
1044 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 1061 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
1045 SendDataPacket(i); | 1062 SendDataPacket(i); |
1046 } | 1063 } |
1047 | 1064 |
1048 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); | 1065 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); |
1049 manager_.OnRetransmissionTimeout(); | 1066 manager_.OnRetransmissionTimeout(); |
1050 } | 1067 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 delay = delay.Add(delay); | 1186 delay = delay.Add(delay); |
1170 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); | 1187 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); |
1171 manager_.OnRetransmissionTimeout(); | 1188 manager_.OnRetransmissionTimeout(); |
1172 RetransmitNextPacket(i + 2); | 1189 RetransmitNextPacket(i + 2); |
1173 } | 1190 } |
1174 } | 1191 } |
1175 | 1192 |
1176 } // namespace | 1193 } // namespace |
1177 } // namespace test | 1194 } // namespace test |
1178 } // namespace net | 1195 } // namespace net |
OLD | NEW |