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_config_peer.h" | 8 #include "net/quic/test_tools/quic_config_peer.h" |
9 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 9 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
10 #include "net/quic/test_tools/quic_test_utils.h" | 10 #include "net/quic/test_tools/quic_test_utils.h" |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 TEST_F(QuicSentPacketManagerTest, | 985 TEST_F(QuicSentPacketManagerTest, |
986 CryptoHandshakeRetransmissionThenNeuterAndAck) { | 986 CryptoHandshakeRetransmissionThenNeuterAndAck) { |
987 // Send 1 crypto packet. | 987 // Send 1 crypto packet. |
988 SendCryptoPacket(1); | 988 SendCryptoPacket(1); |
989 EXPECT_TRUE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); | 989 EXPECT_TRUE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); |
990 | 990 |
991 // Retransmit the crypto packet as 2. | 991 // Retransmit the crypto packet as 2. |
992 manager_.OnRetransmissionTimeout(); | 992 manager_.OnRetransmissionTimeout(); |
993 RetransmitNextPacket(2); | 993 RetransmitNextPacket(2); |
994 | 994 |
| 995 // Retransmit the crypto packet as 3. |
| 996 manager_.OnRetransmissionTimeout(); |
| 997 RetransmitNextPacket(3); |
| 998 |
995 // Now neuter all unacked unencrypted packets, which occurs when the | 999 // Now neuter all unacked unencrypted packets, which occurs when the |
996 // connection goes forward secure. | 1000 // connection goes forward secure. |
997 manager_.NeuterUnencryptedPackets(); | 1001 manager_.NeuterUnencryptedPackets(); |
998 QuicPacketSequenceNumber unacked[] = { 1, 2 }; | 1002 QuicPacketSequenceNumber unacked[] = { 1, 2, 3}; |
999 VerifyUnackedPackets(unacked, arraysize(unacked)); | 1003 VerifyUnackedPackets(unacked, arraysize(unacked)); |
1000 VerifyRetransmittablePackets(NULL, 0); | 1004 VerifyRetransmittablePackets(NULL, 0); |
1001 EXPECT_FALSE(manager_.HasPendingRetransmissions()); | 1005 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
1002 EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); | 1006 EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); |
1003 EXPECT_FALSE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); | 1007 EXPECT_FALSE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); |
1004 | 1008 |
1005 // Ensure both packets get discarded when packet 2 is acked. | 1009 // Ensure both packets get discarded when packet 2 is acked. |
1006 ReceivedPacketInfo received_info; | 1010 ReceivedPacketInfo received_info; |
1007 received_info.largest_observed = 2; | 1011 received_info.largest_observed = 3; |
1008 received_info.missing_packets.insert(1); | 1012 received_info.missing_packets.insert(1); |
1009 ExpectUpdatedRtt(2); | 1013 received_info.missing_packets.insert(2); |
| 1014 ExpectUpdatedRtt(3); |
1010 manager_.OnIncomingAck(received_info, clock_.ApproximateNow()); | 1015 manager_.OnIncomingAck(received_info, clock_.ApproximateNow()); |
1011 VerifyUnackedPackets(NULL, 0); | 1016 VerifyUnackedPackets(NULL, 0); |
1012 VerifyRetransmittablePackets(NULL, 0); | 1017 VerifyRetransmittablePackets(NULL, 0); |
1013 } | 1018 } |
1014 | 1019 |
1015 TEST_F(QuicSentPacketManagerTest, TailLossProbeTimeoutUnsentDataPacket) { | 1020 TEST_F(QuicSentPacketManagerTest, TailLossProbeTimeoutUnsentDataPacket) { |
1016 QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2); | 1021 QuicSentPacketManagerPeer::SetMaxTailLossProbes(&manager_, 2); |
1017 // Serialize two data packets and send the latter. | 1022 // Serialize two data packets and send the latter. |
1018 SerializedPacket packet(CreateDataPacket(1)); | 1023 SerializedPacket packet(CreateDataPacket(1)); |
1019 manager_.OnSerializedPacket(packet); | 1024 manager_.OnSerializedPacket(packet); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 | 1229 |
1225 EXPECT_EQ(kTime, | 1230 EXPECT_EQ(kTime, |
1226 QuicSentPacketManagerPeer::GetLossAlgorithm( | 1231 QuicSentPacketManagerPeer::GetLossAlgorithm( |
1227 &manager_)->GetLossDetectionType()); | 1232 &manager_)->GetLossDetectionType()); |
1228 } | 1233 } |
1229 | 1234 |
1230 | 1235 |
1231 } // namespace | 1236 } // namespace |
1232 } // namespace test | 1237 } // namespace test |
1233 } // namespace net | 1238 } // namespace net |
OLD | NEW |