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/quic_flags.h" | 8 #include "net/quic/quic_flags.h" |
9 #include "net/quic/test_tools/quic_config_peer.h" | 9 #include "net/quic/test_tools/quic_config_peer.h" |
10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 TEST_F(QuicSentPacketManagerTest, LoseButDontRetransmitRevivedPacket) { | 494 TEST_F(QuicSentPacketManagerTest, LoseButDontRetransmitRevivedPacket) { |
495 SendDataPacket(1); | 495 SendDataPacket(1); |
496 SendDataPacket(2); | 496 SendDataPacket(2); |
497 SendFecPacket(3); | 497 SendFecPacket(3); |
498 SendDataPacket(4); | 498 SendDataPacket(4); |
499 | 499 |
500 // Ack 2 and 3, and mark 1 as revived. | 500 // Ack 2 and 3, and mark 1 as revived. |
501 QuicAckFrame ack_frame; | 501 QuicAckFrame ack_frame; |
502 ack_frame.largest_observed = 3; | 502 ack_frame.largest_observed = 3; |
503 ack_frame.missing_packets.Add(1); | 503 ack_frame.missing_packets.Add(1); |
504 ack_frame.revived_packets.insert(1); | 504 ack_frame.latest_revived_packet = 1; |
505 QuicPacketNumber acked[] = {2, 3}; | 505 QuicPacketNumber acked[] = {2, 3}; |
506 ExpectAcksAndLosses(true, acked, arraysize(acked), nullptr, 0); | 506 ExpectAcksAndLosses(true, acked, arraysize(acked), nullptr, 0); |
507 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 507 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
508 | 508 |
509 EXPECT_FALSE(manager_.HasPendingRetransmissions()); | 509 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
510 QuicPacketNumber unacked[] = {1, 4}; | 510 QuicPacketNumber unacked[] = {1, 4}; |
511 VerifyUnackedPackets(unacked, arraysize(unacked)); | 511 VerifyUnackedPackets(unacked, arraysize(unacked)); |
512 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); | 512 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); |
513 QuicPacketNumber retransmittable[] = {4}; | 513 QuicPacketNumber retransmittable[] = {4}; |
514 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); | 514 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); |
(...skipping 25 matching lines...) Expand all Loading... |
540 | 540 |
541 EXPECT_TRUE(manager_.HasPendingRetransmissions()); | 541 EXPECT_TRUE(manager_.HasPendingRetransmissions()); |
542 QuicPacketNumber unacked[] = {1, 5}; | 542 QuicPacketNumber unacked[] = {1, 5}; |
543 VerifyUnackedPackets(unacked, arraysize(unacked)); | 543 VerifyUnackedPackets(unacked, arraysize(unacked)); |
544 QuicPacketNumber retransmittable[] = {1}; | 544 QuicPacketNumber retransmittable[] = {1}; |
545 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); | 545 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); |
546 | 546 |
547 // Ack 5th packet (FEC) and revive 1st packet. 1st packet should now be | 547 // Ack 5th packet (FEC) and revive 1st packet. 1st packet should now be |
548 // removed from pending retransmissions map. | 548 // removed from pending retransmissions map. |
549 ack_frame.largest_observed = 5; | 549 ack_frame.largest_observed = 5; |
550 ack_frame.revived_packets.insert(1); | 550 ack_frame.latest_revived_packet = 1; |
551 ExpectAck(5); | 551 ExpectAck(5); |
552 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 552 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
553 | 553 |
554 EXPECT_FALSE(manager_.HasPendingRetransmissions()); | 554 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
555 VerifyRetransmittablePackets(nullptr, 0); | 555 VerifyRetransmittablePackets(nullptr, 0); |
556 } | 556 } |
557 | 557 |
558 TEST_F(QuicSentPacketManagerTest, AckPreviousTransmissionThenTruncatedAck) { | 558 TEST_F(QuicSentPacketManagerTest, AckPreviousTransmissionThenTruncatedAck) { |
559 SendDataPacket(1); | 559 SendDataPacket(1); |
560 RetransmitAndSendPacket(1, 2); | 560 RetransmitAndSendPacket(1, 2); |
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 | 1662 |
1663 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false)); | 1663 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false)); |
1664 manager_.ResumeConnectionState(cached_network_params, false); | 1664 manager_.ResumeConnectionState(cached_network_params, false); |
1665 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, | 1665 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, |
1666 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); | 1666 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); |
1667 } | 1667 } |
1668 | 1668 |
1669 } // namespace | 1669 } // namespace |
1670 } // namespace test | 1670 } // namespace test |
1671 } // namespace net | 1671 } // namespace net |
OLD | NEW |