| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); | 288 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); |
| 289 } | 289 } |
| 290 | 290 |
| 291 TEST_F(QuicSentPacketManagerTest, RetransmitThenAck) { | 291 TEST_F(QuicSentPacketManagerTest, RetransmitThenAck) { |
| 292 SendDataPacket(1); | 292 SendDataPacket(1); |
| 293 RetransmitAndSendPacket(1, 2); | 293 RetransmitAndSendPacket(1, 2); |
| 294 | 294 |
| 295 // Ack 2 but not 1. | 295 // Ack 2 but not 1. |
| 296 QuicAckFrame ack_frame; | 296 QuicAckFrame ack_frame; |
| 297 ack_frame.largest_observed = 2; | 297 ack_frame.largest_observed = 2; |
| 298 ack_frame.missing_packets.insert(1); | 298 ack_frame.missing_packets.Add(1); |
| 299 ExpectAck(2); | 299 ExpectAck(2); |
| 300 manager_.OnIncomingAck(ack_frame, clock_.Now()); | 300 manager_.OnIncomingAck(ack_frame, clock_.Now()); |
| 301 | 301 |
| 302 // Packet 1 is unacked, pending, but not retransmittable. | 302 // Packet 1 is unacked, pending, but not retransmittable. |
| 303 QuicPacketNumber unacked[] = {1}; | 303 QuicPacketNumber unacked[] = {1}; |
| 304 VerifyUnackedPackets(unacked, arraysize(unacked)); | 304 VerifyUnackedPackets(unacked, arraysize(unacked)); |
| 305 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); | 305 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); |
| 306 VerifyRetransmittablePackets(nullptr, 0); | 306 VerifyRetransmittablePackets(nullptr, 0); |
| 307 } | 307 } |
| 308 | 308 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 ack_frame.largest_observed = 1; | 377 ack_frame.largest_observed = 1; |
| 378 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 378 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 379 | 379 |
| 380 SendDataPacket(3); | 380 SendDataPacket(3); |
| 381 SendDataPacket(4); | 381 SendDataPacket(4); |
| 382 SendDataPacket(5); | 382 SendDataPacket(5); |
| 383 clock_.AdvanceTime(rtt); | 383 clock_.AdvanceTime(rtt); |
| 384 | 384 |
| 385 // Next, NACK packet 2 three times. | 385 // Next, NACK packet 2 three times. |
| 386 ack_frame.largest_observed = 3; | 386 ack_frame.largest_observed = 3; |
| 387 ack_frame.missing_packets.insert(2); | 387 ack_frame.missing_packets.Add(2); |
| 388 ExpectAck(3); | 388 ExpectAck(3); |
| 389 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 389 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 390 | 390 |
| 391 ack_frame.largest_observed = 4; | 391 ack_frame.largest_observed = 4; |
| 392 ExpectAck(4); | 392 ExpectAck(4); |
| 393 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 393 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 394 | 394 |
| 395 ack_frame.largest_observed = 5; | 395 ack_frame.largest_observed = 5; |
| 396 ExpectAckAndLoss(true, 5, 2); | 396 ExpectAckAndLoss(true, 5, 2); |
| 397 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 397 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 | 457 |
| 458 // 2 and 3 remain unacked, but no packets have retransmittable data. | 458 // 2 and 3 remain unacked, but no packets have retransmittable data. |
| 459 QuicPacketNumber unacked[] = {2, 3}; | 459 QuicPacketNumber unacked[] = {2, 3}; |
| 460 VerifyUnackedPackets(unacked, arraysize(unacked)); | 460 VerifyUnackedPackets(unacked, arraysize(unacked)); |
| 461 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); | 461 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); |
| 462 VerifyRetransmittablePackets(nullptr, 0); | 462 VerifyRetransmittablePackets(nullptr, 0); |
| 463 | 463 |
| 464 // Ensure packet 2 is lost when 4 is sent and 3 and 4 are acked. | 464 // Ensure packet 2 is lost when 4 is sent and 3 and 4 are acked. |
| 465 SendDataPacket(4); | 465 SendDataPacket(4); |
| 466 ack_frame.largest_observed = 4; | 466 ack_frame.largest_observed = 4; |
| 467 ack_frame.missing_packets.insert(2); | 467 ack_frame.missing_packets.Add(2); |
| 468 QuicPacketNumber acked[] = {3, 4}; | 468 QuicPacketNumber acked[] = {3, 4}; |
| 469 ExpectAcksAndLosses(true, acked, arraysize(acked), nullptr, 0); | 469 ExpectAcksAndLosses(true, acked, arraysize(acked), nullptr, 0); |
| 470 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 470 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 471 | 471 |
| 472 QuicPacketNumber unacked2[] = {2}; | 472 QuicPacketNumber unacked2[] = {2}; |
| 473 VerifyUnackedPackets(unacked2, arraysize(unacked2)); | 473 VerifyUnackedPackets(unacked2, arraysize(unacked2)); |
| 474 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); | 474 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); |
| 475 | 475 |
| 476 SendDataPacket(5); | 476 SendDataPacket(5); |
| 477 ack_frame.largest_observed = 5; | 477 ack_frame.largest_observed = 5; |
| 478 ExpectAckAndLoss(true, 5, 2); | 478 ExpectAckAndLoss(true, 5, 2); |
| 479 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 479 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 480 | 480 |
| 481 VerifyUnackedPackets(nullptr, 0); | 481 VerifyUnackedPackets(nullptr, 0); |
| 482 EXPECT_FALSE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); | 482 EXPECT_FALSE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); |
| 483 EXPECT_EQ(2u, stats_.packets_spuriously_retransmitted); | 483 EXPECT_EQ(2u, stats_.packets_spuriously_retransmitted); |
| 484 } | 484 } |
| 485 | 485 |
| 486 TEST_F(QuicSentPacketManagerTest, LoseButDontRetransmitRevivedPacket) { | 486 TEST_F(QuicSentPacketManagerTest, LoseButDontRetransmitRevivedPacket) { |
| 487 SendDataPacket(1); | 487 SendDataPacket(1); |
| 488 SendDataPacket(2); | 488 SendDataPacket(2); |
| 489 SendFecPacket(3); | 489 SendFecPacket(3); |
| 490 SendDataPacket(4); | 490 SendDataPacket(4); |
| 491 | 491 |
| 492 // Ack 2 and 3, and mark 1 as revived. | 492 // Ack 2 and 3, and mark 1 as revived. |
| 493 QuicAckFrame ack_frame; | 493 QuicAckFrame ack_frame; |
| 494 ack_frame.largest_observed = 3; | 494 ack_frame.largest_observed = 3; |
| 495 ack_frame.missing_packets.insert(1); | 495 ack_frame.missing_packets.Add(1); |
| 496 ack_frame.revived_packets.insert(1); | 496 ack_frame.revived_packets.insert(1); |
| 497 QuicPacketNumber acked[] = {2, 3}; | 497 QuicPacketNumber acked[] = {2, 3}; |
| 498 ExpectAcksAndLosses(true, acked, arraysize(acked), nullptr, 0); | 498 ExpectAcksAndLosses(true, acked, arraysize(acked), nullptr, 0); |
| 499 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 499 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 500 | 500 |
| 501 EXPECT_FALSE(manager_.HasPendingRetransmissions()); | 501 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
| 502 QuicPacketNumber unacked[] = {1, 4}; | 502 QuicPacketNumber unacked[] = {1, 4}; |
| 503 VerifyUnackedPackets(unacked, arraysize(unacked)); | 503 VerifyUnackedPackets(unacked, arraysize(unacked)); |
| 504 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); | 504 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); |
| 505 QuicPacketNumber retransmittable[] = {4}; | 505 QuicPacketNumber retransmittable[] = {4}; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 517 TEST_F(QuicSentPacketManagerTest, MarkLostThenReviveAndDontRetransmitPacket) { | 517 TEST_F(QuicSentPacketManagerTest, MarkLostThenReviveAndDontRetransmitPacket) { |
| 518 SendDataPacket(1); | 518 SendDataPacket(1); |
| 519 SendDataPacket(2); | 519 SendDataPacket(2); |
| 520 SendDataPacket(3); | 520 SendDataPacket(3); |
| 521 SendDataPacket(4); | 521 SendDataPacket(4); |
| 522 SendFecPacket(5); | 522 SendFecPacket(5); |
| 523 | 523 |
| 524 // Ack 2, 3, and 4, and expect the 1st to be considered lost. | 524 // Ack 2, 3, and 4, and expect the 1st to be considered lost. |
| 525 QuicAckFrame ack_frame; | 525 QuicAckFrame ack_frame; |
| 526 ack_frame.largest_observed = 4; | 526 ack_frame.largest_observed = 4; |
| 527 ack_frame.missing_packets.insert(1); | 527 ack_frame.missing_packets.Add(1); |
| 528 QuicPacketNumber acked[] = {2, 3, 4}; | 528 QuicPacketNumber acked[] = {2, 3, 4}; |
| 529 QuicPacketNumber lost[] = {1}; | 529 QuicPacketNumber lost[] = {1}; |
| 530 ExpectAcksAndLosses(true, acked, arraysize(acked), lost, arraysize(lost)); | 530 ExpectAcksAndLosses(true, acked, arraysize(acked), lost, arraysize(lost)); |
| 531 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 531 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 532 | 532 |
| 533 EXPECT_TRUE(manager_.HasPendingRetransmissions()); | 533 EXPECT_TRUE(manager_.HasPendingRetransmissions()); |
| 534 QuicPacketNumber unacked[] = {1, 5}; | 534 QuicPacketNumber unacked[] = {1, 5}; |
| 535 VerifyUnackedPackets(unacked, arraysize(unacked)); | 535 VerifyUnackedPackets(unacked, arraysize(unacked)); |
| 536 QuicPacketNumber retransmittable[] = {1}; | 536 QuicPacketNumber retransmittable[] = {1}; |
| 537 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); | 537 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 552 false); | 552 false); |
| 553 SendDataPacket(1); | 553 SendDataPacket(1); |
| 554 RetransmitAndSendPacket(1, 2); | 554 RetransmitAndSendPacket(1, 2); |
| 555 RetransmitAndSendPacket(2, 3); | 555 RetransmitAndSendPacket(2, 3); |
| 556 RetransmitAndSendPacket(3, 4); | 556 RetransmitAndSendPacket(3, 4); |
| 557 RetransmitAndSendPacket(4, 5); | 557 RetransmitAndSendPacket(4, 5); |
| 558 | 558 |
| 559 // Truncated ack with 4 NACKs, so the first packet is lost. | 559 // Truncated ack with 4 NACKs, so the first packet is lost. |
| 560 QuicAckFrame ack_frame; | 560 QuicAckFrame ack_frame; |
| 561 ack_frame.largest_observed = 4; | 561 ack_frame.largest_observed = 4; |
| 562 ack_frame.missing_packets.insert(1); | 562 ack_frame.missing_packets.Add(1, 5); |
| 563 ack_frame.missing_packets.insert(2); | |
| 564 ack_frame.missing_packets.insert(3); | |
| 565 ack_frame.missing_packets.insert(4); | |
| 566 ack_frame.is_truncated = true; | 563 ack_frame.is_truncated = true; |
| 567 | 564 |
| 568 QuicPacketNumber lost[] = {1}; | 565 QuicPacketNumber lost[] = {1}; |
| 569 ExpectAcksAndLosses(true, nullptr, 0, lost, arraysize(lost)); | 566 ExpectAcksAndLosses(true, nullptr, 0, lost, arraysize(lost)); |
| 570 manager_.OnIncomingAck(ack_frame, clock_.Now()); | 567 manager_.OnIncomingAck(ack_frame, clock_.Now()); |
| 571 | 568 |
| 572 // High water mark will be raised. | 569 // High water mark will be raised. |
| 573 QuicPacketNumber unacked[] = {2, 3, 4, 5}; | 570 QuicPacketNumber unacked[] = {2, 3, 4, 5}; |
| 574 VerifyUnackedPackets(unacked, arraysize(unacked)); | 571 VerifyUnackedPackets(unacked, arraysize(unacked)); |
| 575 QuicPacketNumber retransmittable[] = {5}; | 572 QuicPacketNumber retransmittable[] = {5}; |
| 576 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); | 573 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); |
| 577 } | 574 } |
| 578 | 575 |
| 579 TEST_F(QuicSentPacketManagerTest, AckPreviousTransmissionThenTruncatedAck) { | 576 TEST_F(QuicSentPacketManagerTest, AckPreviousTransmissionThenTruncatedAck) { |
| 580 SendDataPacket(1); | 577 SendDataPacket(1); |
| 581 RetransmitAndSendPacket(1, 2); | 578 RetransmitAndSendPacket(1, 2); |
| 582 RetransmitAndSendPacket(2, 3); | 579 RetransmitAndSendPacket(2, 3); |
| 583 RetransmitAndSendPacket(3, 4); | 580 RetransmitAndSendPacket(3, 4); |
| 584 SendDataPacket(5); | 581 SendDataPacket(5); |
| 585 SendDataPacket(6); | 582 SendDataPacket(6); |
| 586 SendDataPacket(7); | 583 SendDataPacket(7); |
| 587 SendDataPacket(8); | 584 SendDataPacket(8); |
| 588 SendDataPacket(9); | 585 SendDataPacket(9); |
| 589 | 586 |
| 590 // Ack previous transmission | 587 // Ack previous transmission |
| 591 { | 588 { |
| 592 QuicAckFrame ack_frame; | 589 QuicAckFrame ack_frame; |
| 593 ack_frame.largest_observed = 2; | 590 ack_frame.largest_observed = 2; |
| 594 ack_frame.missing_packets.insert(1); | 591 ack_frame.missing_packets.Add(1); |
| 595 ExpectAck(2); | 592 ExpectAck(2); |
| 596 manager_.OnIncomingAck(ack_frame, clock_.Now()); | 593 manager_.OnIncomingAck(ack_frame, clock_.Now()); |
| 597 EXPECT_TRUE(manager_.IsUnacked(4)); | 594 EXPECT_TRUE(manager_.IsUnacked(4)); |
| 598 } | 595 } |
| 599 | 596 |
| 600 // Truncated ack with 4 NACKs | 597 // Truncated ack with 4 NACKs |
| 601 { | 598 { |
| 602 QuicAckFrame ack_frame; | 599 QuicAckFrame ack_frame; |
| 603 ack_frame.largest_observed = 6; | 600 ack_frame.largest_observed = 6; |
| 604 ack_frame.missing_packets.insert(3); | 601 ack_frame.missing_packets.Add(3, 7); |
| 605 ack_frame.missing_packets.insert(4); | |
| 606 ack_frame.missing_packets.insert(5); | |
| 607 ack_frame.missing_packets.insert(6); | |
| 608 ack_frame.is_truncated = true; | 602 ack_frame.is_truncated = true; |
| 609 ExpectAckAndLoss(true, 1, 3); | 603 ExpectAckAndLoss(true, 1, 3); |
| 610 manager_.OnIncomingAck(ack_frame, clock_.Now()); | 604 manager_.OnIncomingAck(ack_frame, clock_.Now()); |
| 611 } | 605 } |
| 612 | 606 |
| 613 // High water mark will be raised. | 607 // High water mark will be raised. |
| 614 QuicPacketNumber unacked[] = {4, 5, 6, 7, 8, 9}; | 608 QuicPacketNumber unacked[] = {4, 5, 6, 7, 8, 9}; |
| 615 VerifyUnackedPackets(unacked, arraysize(unacked)); | 609 VerifyUnackedPackets(unacked, arraysize(unacked)); |
| 616 QuicPacketNumber retransmittable[] = {5, 6, 7, 8, 9}; | 610 QuicPacketNumber retransmittable[] = {5, 6, 7, 8, 9}; |
| 617 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); | 611 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 644 EXPECT_EQ(1u, manager_.GetLeastUnacked()); | 638 EXPECT_EQ(1u, manager_.GetLeastUnacked()); |
| 645 | 639 |
| 646 QuicPacketNumber unacked[] = {1, 2, 3}; | 640 QuicPacketNumber unacked[] = {1, 2, 3}; |
| 647 VerifyUnackedPackets(unacked, arraysize(unacked)); | 641 VerifyUnackedPackets(unacked, arraysize(unacked)); |
| 648 VerifyRetransmittablePackets(nullptr, 0); | 642 VerifyRetransmittablePackets(nullptr, 0); |
| 649 | 643 |
| 650 // Ack 2, so there's an rtt update. | 644 // Ack 2, so there's an rtt update. |
| 651 ExpectAck(2); | 645 ExpectAck(2); |
| 652 QuicAckFrame ack_frame; | 646 QuicAckFrame ack_frame; |
| 653 ack_frame.largest_observed = 2; | 647 ack_frame.largest_observed = 2; |
| 654 ack_frame.missing_packets.insert(1); | 648 ack_frame.missing_packets.Add(1); |
| 655 manager_.OnIncomingAck(ack_frame, clock_.Now()); | 649 manager_.OnIncomingAck(ack_frame, clock_.Now()); |
| 656 | 650 |
| 657 EXPECT_EQ(1u, manager_.GetLeastUnacked()); | 651 EXPECT_EQ(1u, manager_.GetLeastUnacked()); |
| 658 } | 652 } |
| 659 | 653 |
| 660 TEST_F(QuicSentPacketManagerTest, GetSentTime) { | 654 TEST_F(QuicSentPacketManagerTest, GetSentTime) { |
| 661 VerifyUnackedPackets(nullptr, 0); | 655 VerifyUnackedPackets(nullptr, 0); |
| 662 | 656 |
| 663 QuicTime sent_time = clock_.Now(); | 657 QuicTime sent_time = clock_.Now(); |
| 664 SendFecPacket(1); | 658 SendFecPacket(1); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return( | 785 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return( |
| 792 QuicTime::Delta::Infinite())); | 786 QuicTime::Delta::Infinite())); |
| 793 EXPECT_EQ(QuicTime::Delta::Infinite(), | 787 EXPECT_EQ(QuicTime::Delta::Infinite(), |
| 794 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA)); | 788 manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA)); |
| 795 EXPECT_FALSE(manager_.HasPendingRetransmissions()); | 789 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
| 796 | 790 |
| 797 // Ack the third and ensure the first two are still pending. | 791 // Ack the third and ensure the first two are still pending. |
| 798 ExpectAck(3); | 792 ExpectAck(3); |
| 799 QuicAckFrame ack_frame; | 793 QuicAckFrame ack_frame; |
| 800 ack_frame.largest_observed = 3; | 794 ack_frame.largest_observed = 3; |
| 801 ack_frame.missing_packets.insert(1); | 795 ack_frame.missing_packets.Add(1, 3); |
| 802 ack_frame.missing_packets.insert(2); | |
| 803 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 796 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 804 | 797 |
| 805 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); | 798 EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); |
| 806 | 799 |
| 807 // Acking two more packets will lose both of them due to nacks. | 800 // Acking two more packets will lose both of them due to nacks. |
| 808 ack_frame.largest_observed = 5; | 801 ack_frame.largest_observed = 5; |
| 809 QuicPacketNumber lost[] = {1, 2}; | 802 QuicPacketNumber lost[] = {1, 2}; |
| 810 ExpectAcksAndLosses(false, nullptr, 0, lost, arraysize(lost)); | 803 ExpectAcksAndLosses(false, nullptr, 0, lost, arraysize(lost)); |
| 811 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 804 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 812 | 805 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 EXPECT_EQ(2u, stats_.tlp_count); | 864 EXPECT_EQ(2u, stats_.tlp_count); |
| 872 EXPECT_EQ(1u, stats_.rto_count); | 865 EXPECT_EQ(1u, stats_.rto_count); |
| 873 | 866 |
| 874 // Send and Ack the RTO and ensure OnRetransmissionTimeout is called. | 867 // Send and Ack the RTO and ensure OnRetransmissionTimeout is called. |
| 875 EXPECT_EQ(102 * kDefaultLength, | 868 EXPECT_EQ(102 * kDefaultLength, |
| 876 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); | 869 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); |
| 877 | 870 |
| 878 RetransmitNextPacket(103); | 871 RetransmitNextPacket(103); |
| 879 QuicAckFrame ack_frame; | 872 QuicAckFrame ack_frame; |
| 880 ack_frame.largest_observed = 103; | 873 ack_frame.largest_observed = 103; |
| 881 for (int i = 0; i < 103; ++i) { | 874 ack_frame.missing_packets.Add(0, 103); |
| 882 ack_frame.missing_packets.insert(i); | |
| 883 } | |
| 884 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); | 875 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); |
| 885 EXPECT_CALL(*send_algorithm_, | 876 EXPECT_CALL(*send_algorithm_, |
| 886 OnCongestionEvent(true, _, ElementsAre(Pair(103, _)), _)); | 877 OnCongestionEvent(true, _, ElementsAre(Pair(103, _)), _)); |
| 887 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | 878 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
| 888 EXPECT_CALL(*network_change_visitor_, OnRttChange()); | 879 EXPECT_CALL(*network_change_visitor_, OnRttChange()); |
| 889 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 880 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 890 // All packets before 103 should be lost. | 881 // All packets before 103 should be lost. |
| 891 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); | 882 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); |
| 892 } | 883 } |
| 893 | 884 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 920 RetransmitNextPacket(9); | 911 RetransmitNextPacket(9); |
| 921 EXPECT_FALSE(manager_.HasPendingRetransmissions()); | 912 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
| 922 EXPECT_TRUE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); | 913 EXPECT_TRUE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); |
| 923 | 914 |
| 924 // Now ack the two crypto packets and the speculatively encrypted request, | 915 // Now ack the two crypto packets and the speculatively encrypted request, |
| 925 // and ensure the first four crypto packets get abandoned, but not lost. | 916 // and ensure the first four crypto packets get abandoned, but not lost. |
| 926 QuicPacketNumber acked[] = {3, 4, 5, 8, 9}; | 917 QuicPacketNumber acked[] = {3, 4, 5, 8, 9}; |
| 927 ExpectAcksAndLosses(true, acked, arraysize(acked), nullptr, 0); | 918 ExpectAcksAndLosses(true, acked, arraysize(acked), nullptr, 0); |
| 928 QuicAckFrame ack_frame; | 919 QuicAckFrame ack_frame; |
| 929 ack_frame.largest_observed = 9; | 920 ack_frame.largest_observed = 9; |
| 930 ack_frame.missing_packets.insert(1); | 921 ack_frame.missing_packets.Add(1, 3); |
| 931 ack_frame.missing_packets.insert(2); | 922 ack_frame.missing_packets.Add(6, 8); |
| 932 ack_frame.missing_packets.insert(6); | |
| 933 ack_frame.missing_packets.insert(7); | |
| 934 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 923 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 935 | 924 |
| 936 EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); | 925 EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); |
| 937 } | 926 } |
| 938 | 927 |
| 939 TEST_F(QuicSentPacketManagerTest, CryptoHandshakeTimeoutVersionNegotiation) { | 928 TEST_F(QuicSentPacketManagerTest, CryptoHandshakeTimeoutVersionNegotiation) { |
| 940 // Send 2 crypto packets and 3 data packets. | 929 // Send 2 crypto packets and 3 data packets. |
| 941 const size_t kNumSentCryptoPackets = 2; | 930 const size_t kNumSentCryptoPackets = 2; |
| 942 for (size_t i = 1; i <= kNumSentCryptoPackets; ++i) { | 931 for (size_t i = 1; i <= kNumSentCryptoPackets; ++i) { |
| 943 SendCryptoPacket(i); | 932 SendCryptoPacket(i); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 | 976 |
| 988 // Retransmit the crypto packet as 3. | 977 // Retransmit the crypto packet as 3. |
| 989 manager_.OnRetransmissionTimeout(); | 978 manager_.OnRetransmissionTimeout(); |
| 990 RetransmitNextPacket(3); | 979 RetransmitNextPacket(3); |
| 991 | 980 |
| 992 // Now ack the second crypto packet, and ensure the first gets removed, but | 981 // Now ack the second crypto packet, and ensure the first gets removed, but |
| 993 // the third does not. | 982 // the third does not. |
| 994 ExpectUpdatedRtt(2); | 983 ExpectUpdatedRtt(2); |
| 995 QuicAckFrame ack_frame; | 984 QuicAckFrame ack_frame; |
| 996 ack_frame.largest_observed = 2; | 985 ack_frame.largest_observed = 2; |
| 997 ack_frame.missing_packets.insert(1); | 986 ack_frame.missing_packets.Add(1); |
| 998 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 987 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 999 | 988 |
| 1000 EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); | 989 EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); |
| 1001 QuicPacketNumber unacked[] = {3}; | 990 QuicPacketNumber unacked[] = {3}; |
| 1002 VerifyUnackedPackets(unacked, arraysize(unacked)); | 991 VerifyUnackedPackets(unacked, arraysize(unacked)); |
| 1003 } | 992 } |
| 1004 | 993 |
| 1005 TEST_F(QuicSentPacketManagerTest, CryptoHandshakeTimeoutUnsentDataPacket) { | 994 TEST_F(QuicSentPacketManagerTest, CryptoHandshakeTimeoutUnsentDataPacket) { |
| 1006 // Send 2 crypto packets and 1 data packet. | 995 // Send 2 crypto packets and 1 data packet. |
| 1007 const size_t kNumSentCryptoPackets = 2; | 996 const size_t kNumSentCryptoPackets = 2; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 QuicPacketNumber unacked[] = {1, 2, 3}; | 1048 QuicPacketNumber unacked[] = {1, 2, 3}; |
| 1060 VerifyUnackedPackets(unacked, arraysize(unacked)); | 1049 VerifyUnackedPackets(unacked, arraysize(unacked)); |
| 1061 VerifyRetransmittablePackets(nullptr, 0); | 1050 VerifyRetransmittablePackets(nullptr, 0); |
| 1062 EXPECT_FALSE(manager_.HasPendingRetransmissions()); | 1051 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
| 1063 EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); | 1052 EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); |
| 1064 EXPECT_FALSE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); | 1053 EXPECT_FALSE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); |
| 1065 | 1054 |
| 1066 // Ensure both packets get discarded when packet 2 is acked. | 1055 // Ensure both packets get discarded when packet 2 is acked. |
| 1067 QuicAckFrame ack_frame; | 1056 QuicAckFrame ack_frame; |
| 1068 ack_frame.largest_observed = 3; | 1057 ack_frame.largest_observed = 3; |
| 1069 ack_frame.missing_packets.insert(1); | 1058 ack_frame.missing_packets.Add(1, 3); |
| 1070 ack_frame.missing_packets.insert(2); | |
| 1071 ExpectUpdatedRtt(3); | 1059 ExpectUpdatedRtt(3); |
| 1072 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 1060 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 1073 VerifyUnackedPackets(nullptr, 0); | 1061 VerifyUnackedPackets(nullptr, 0); |
| 1074 VerifyRetransmittablePackets(nullptr, 0); | 1062 VerifyRetransmittablePackets(nullptr, 0); |
| 1075 } | 1063 } |
| 1076 | 1064 |
| 1077 TEST_F(QuicSentPacketManagerTest, RetransmissionTimeout) { | 1065 TEST_F(QuicSentPacketManagerTest, RetransmissionTimeout) { |
| 1078 // Send 100 packets. | 1066 // Send 100 packets. |
| 1079 const size_t kNumSentPackets = 100; | 1067 const size_t kNumSentPackets = 100; |
| 1080 for (size_t i = 1; i <= kNumSentPackets; ++i) { | 1068 for (size_t i = 1; i <= kNumSentPackets; ++i) { |
| 1081 SendDataPacket(i); | 1069 SendDataPacket(i); |
| 1082 } | 1070 } |
| 1083 | 1071 |
| 1084 EXPECT_FALSE(manager_.MaybeRetransmitTailLossProbe()); | 1072 EXPECT_FALSE(manager_.MaybeRetransmitTailLossProbe()); |
| 1085 manager_.OnRetransmissionTimeout(); | 1073 manager_.OnRetransmissionTimeout(); |
| 1086 EXPECT_TRUE(manager_.HasPendingRetransmissions()); | 1074 EXPECT_TRUE(manager_.HasPendingRetransmissions()); |
| 1087 EXPECT_EQ(100 * kDefaultLength, | 1075 EXPECT_EQ(100 * kDefaultLength, |
| 1088 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); | 1076 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); |
| 1089 RetransmitNextPacket(101); | 1077 RetransmitNextPacket(101); |
| 1090 RetransmitNextPacket(102); | 1078 RetransmitNextPacket(102); |
| 1091 EXPECT_FALSE(manager_.HasPendingRetransmissions()); | 1079 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
| 1092 | 1080 |
| 1093 // Ack a retransmission. | 1081 // Ack a retransmission. |
| 1094 QuicAckFrame ack_frame; | 1082 QuicAckFrame ack_frame; |
| 1095 ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero(); | 1083 ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero(); |
| 1096 ack_frame.largest_observed = 102; | 1084 ack_frame.largest_observed = 102; |
| 1097 for (int i = 0; i < 102; ++i) { | 1085 ack_frame.missing_packets.Add(0, 102); |
| 1098 ack_frame.missing_packets.insert(i); | |
| 1099 } | |
| 1100 // Ensure no packets are lost. | 1086 // Ensure no packets are lost. |
| 1101 EXPECT_CALL(*send_algorithm_, | 1087 EXPECT_CALL(*send_algorithm_, |
| 1102 OnCongestionEvent(true, _, ElementsAre(Pair(102, _)), | 1088 OnCongestionEvent(true, _, ElementsAre(Pair(102, _)), |
| 1103 /*lost_packets=*/IsEmpty())); | 1089 /*lost_packets=*/IsEmpty())); |
| 1104 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | 1090 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
| 1105 EXPECT_CALL(*network_change_visitor_, OnRttChange()); | 1091 EXPECT_CALL(*network_change_visitor_, OnRttChange()); |
| 1106 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); | 1092 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); |
| 1107 manager_.OnIncomingAck(ack_frame, clock_.Now()); | 1093 manager_.OnIncomingAck(ack_frame, clock_.Now()); |
| 1108 } | 1094 } |
| 1109 | 1095 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1135 EXPECT_EQ(100 * kDefaultLength, | 1121 EXPECT_EQ(100 * kDefaultLength, |
| 1136 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); | 1122 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); |
| 1137 RetransmitNextPacket(101); | 1123 RetransmitNextPacket(101); |
| 1138 RetransmitNextPacket(102); | 1124 RetransmitNextPacket(102); |
| 1139 EXPECT_FALSE(manager_.HasPendingRetransmissions()); | 1125 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
| 1140 | 1126 |
| 1141 // Ack a retransmission and expect no call to OnRetransmissionTimeout. | 1127 // Ack a retransmission and expect no call to OnRetransmissionTimeout. |
| 1142 QuicAckFrame ack_frame; | 1128 QuicAckFrame ack_frame; |
| 1143 ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero(); | 1129 ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero(); |
| 1144 ack_frame.largest_observed = 102; | 1130 ack_frame.largest_observed = 102; |
| 1145 for (int i = 0; i < 102; ++i) { | 1131 ack_frame.missing_packets.Add(0, 102); |
| 1146 ack_frame.missing_packets.insert(i); | |
| 1147 } | |
| 1148 // This will include packets in the lost packet map. | 1132 // This will include packets in the lost packet map. |
| 1149 EXPECT_CALL(*send_algorithm_, | 1133 EXPECT_CALL(*send_algorithm_, |
| 1150 OnCongestionEvent(true, _, ElementsAre(Pair(102, _)), | 1134 OnCongestionEvent(true, _, ElementsAre(Pair(102, _)), |
| 1151 /*lost_packets=*/Not(IsEmpty()))); | 1135 /*lost_packets=*/Not(IsEmpty()))); |
| 1152 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | 1136 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
| 1153 EXPECT_CALL(*network_change_visitor_, OnRttChange()); | 1137 EXPECT_CALL(*network_change_visitor_, OnRttChange()); |
| 1154 manager_.OnIncomingAck(ack_frame, clock_.Now()); | 1138 manager_.OnIncomingAck(ack_frame, clock_.Now()); |
| 1155 } | 1139 } |
| 1156 | 1140 |
| 1157 TEST_F(QuicSentPacketManagerTest, TwoRetransmissionTimeoutsAckSecond) { | 1141 TEST_F(QuicSentPacketManagerTest, TwoRetransmissionTimeoutsAckSecond) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1171 EXPECT_EQ(2 * kDefaultLength, | 1155 EXPECT_EQ(2 * kDefaultLength, |
| 1172 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); | 1156 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); |
| 1173 RetransmitNextPacket(3); | 1157 RetransmitNextPacket(3); |
| 1174 EXPECT_FALSE(manager_.HasPendingRetransmissions()); | 1158 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
| 1175 | 1159 |
| 1176 // Ack a retransmission and ensure OnRetransmissionTimeout is called. | 1160 // Ack a retransmission and ensure OnRetransmissionTimeout is called. |
| 1177 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); | 1161 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); |
| 1178 QuicAckFrame ack_frame; | 1162 QuicAckFrame ack_frame; |
| 1179 ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero(); | 1163 ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero(); |
| 1180 ack_frame.largest_observed = 2; | 1164 ack_frame.largest_observed = 2; |
| 1181 ack_frame.missing_packets.insert(1); | 1165 ack_frame.missing_packets.Add(1); |
| 1182 ExpectAck(2); | 1166 ExpectAck(2); |
| 1183 manager_.OnIncomingAck(ack_frame, clock_.Now()); | 1167 manager_.OnIncomingAck(ack_frame, clock_.Now()); |
| 1184 | 1168 |
| 1185 // The original packet and newest should be outstanding. | 1169 // The original packet and newest should be outstanding. |
| 1186 EXPECT_EQ(2 * kDefaultLength, | 1170 EXPECT_EQ(2 * kDefaultLength, |
| 1187 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); | 1171 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); |
| 1188 } | 1172 } |
| 1189 | 1173 |
| 1190 TEST_F(QuicSentPacketManagerTest, TwoRetransmissionTimeoutsAckFirst) { | 1174 TEST_F(QuicSentPacketManagerTest, TwoRetransmissionTimeoutsAckFirst) { |
| 1191 // Send 1 packet. | 1175 // Send 1 packet. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1204 EXPECT_EQ(2 * kDefaultLength, | 1188 EXPECT_EQ(2 * kDefaultLength, |
| 1205 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); | 1189 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); |
| 1206 RetransmitNextPacket(3); | 1190 RetransmitNextPacket(3); |
| 1207 EXPECT_FALSE(manager_.HasPendingRetransmissions()); | 1191 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
| 1208 | 1192 |
| 1209 // Ack a retransmission and ensure OnRetransmissionTimeout is called. | 1193 // Ack a retransmission and ensure OnRetransmissionTimeout is called. |
| 1210 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); | 1194 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); |
| 1211 QuicAckFrame ack_frame; | 1195 QuicAckFrame ack_frame; |
| 1212 ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero(); | 1196 ack_frame.delta_time_largest_observed = QuicTime::Delta::Zero(); |
| 1213 ack_frame.largest_observed = 3; | 1197 ack_frame.largest_observed = 3; |
| 1214 ack_frame.missing_packets.insert(1); | 1198 ack_frame.missing_packets.Add(1, 3); |
| 1215 ack_frame.missing_packets.insert(2); | |
| 1216 ExpectAck(3); | 1199 ExpectAck(3); |
| 1217 manager_.OnIncomingAck(ack_frame, clock_.Now()); | 1200 manager_.OnIncomingAck(ack_frame, clock_.Now()); |
| 1218 | 1201 |
| 1219 // The first two packets should still be outstanding. | 1202 // The first two packets should still be outstanding. |
| 1220 EXPECT_EQ(2 * kDefaultLength, | 1203 EXPECT_EQ(2 * kDefaultLength, |
| 1221 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); | 1204 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); |
| 1222 } | 1205 } |
| 1223 | 1206 |
| 1224 TEST_F(QuicSentPacketManagerTest, GetTransmissionTime) { | 1207 TEST_F(QuicSentPacketManagerTest, GetTransmissionTime) { |
| 1225 EXPECT_EQ(QuicTime::Zero(), manager_.GetRetransmissionTime()); | 1208 EXPECT_EQ(QuicTime::Zero(), manager_.GetRetransmissionTime()); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 // The delay should double the second time. | 1306 // The delay should double the second time. |
| 1324 expected_time = clock_.Now().Add(expected_rto_delay).Add(expected_rto_delay); | 1307 expected_time = clock_.Now().Add(expected_rto_delay).Add(expected_rto_delay); |
| 1325 // Once we always base the timer on the right edge, leaving the older packets | 1308 // Once we always base the timer on the right edge, leaving the older packets |
| 1326 // in flight doesn't change the timeout. | 1309 // in flight doesn't change the timeout. |
| 1327 EXPECT_EQ(expected_time, manager_.GetRetransmissionTime()); | 1310 EXPECT_EQ(expected_time, manager_.GetRetransmissionTime()); |
| 1328 | 1311 |
| 1329 // Ack a packet before the first RTO and ensure the RTO timeout returns to the | 1312 // Ack a packet before the first RTO and ensure the RTO timeout returns to the |
| 1330 // original value and OnRetransmissionTimeout is not called or reverted. | 1313 // original value and OnRetransmissionTimeout is not called or reverted. |
| 1331 QuicAckFrame ack_frame; | 1314 QuicAckFrame ack_frame; |
| 1332 ack_frame.largest_observed = 2; | 1315 ack_frame.largest_observed = 2; |
| 1333 ack_frame.missing_packets.insert(1); | 1316 ack_frame.missing_packets.Add(1); |
| 1334 ExpectAck(2); | 1317 ExpectAck(2); |
| 1335 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); | 1318 manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); |
| 1336 EXPECT_FALSE(manager_.HasPendingRetransmissions()); | 1319 EXPECT_FALSE(manager_.HasPendingRetransmissions()); |
| 1337 EXPECT_EQ(5 * kDefaultLength, | 1320 EXPECT_EQ(5 * kDefaultLength, |
| 1338 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); | 1321 QuicSentPacketManagerPeer::GetBytesInFlight(&manager_)); |
| 1339 | 1322 |
| 1340 // Wait 2RTTs from now for the RTO, since it's the max of the RTO time | 1323 // Wait 2RTTs from now for the RTO, since it's the max of the RTO time |
| 1341 // and the TLP time. In production, there would always be two TLP's first. | 1324 // and the TLP time. In production, there would always be two TLP's first. |
| 1342 // Since retransmission was spurious, smoothed_rtt_ is expired, and replaced | 1325 // Since retransmission was spurious, smoothed_rtt_ is expired, and replaced |
| 1343 // by the latest RTT sample of 500ms. | 1326 // by the latest RTT sample of 500ms. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 SendDataPacket(1); | 1380 SendDataPacket(1); |
| 1398 SendDataPacket(2); | 1381 SendDataPacket(2); |
| 1399 | 1382 |
| 1400 // Handle an ack which causes the loss algorithm to be evaluated and | 1383 // Handle an ack which causes the loss algorithm to be evaluated and |
| 1401 // set the loss timeout. | 1384 // set the loss timeout. |
| 1402 ExpectAck(2); | 1385 ExpectAck(2); |
| 1403 EXPECT_CALL(*loss_algorithm, DetectLostPackets(_, _, _, _)) | 1386 EXPECT_CALL(*loss_algorithm, DetectLostPackets(_, _, _, _)) |
| 1404 .WillOnce(Return(PacketNumberSet())); | 1387 .WillOnce(Return(PacketNumberSet())); |
| 1405 QuicAckFrame ack_frame; | 1388 QuicAckFrame ack_frame; |
| 1406 ack_frame.largest_observed = 2; | 1389 ack_frame.largest_observed = 2; |
| 1407 ack_frame.missing_packets.insert(1); | 1390 ack_frame.missing_packets.Add(1); |
| 1408 manager_.OnIncomingAck(ack_frame, clock_.Now()); | 1391 manager_.OnIncomingAck(ack_frame, clock_.Now()); |
| 1409 | 1392 |
| 1410 QuicTime timeout(clock_.Now().Add(QuicTime::Delta::FromMilliseconds(10))); | 1393 QuicTime timeout(clock_.Now().Add(QuicTime::Delta::FromMilliseconds(10))); |
| 1411 EXPECT_CALL(*loss_algorithm, GetLossTimeout()) | 1394 EXPECT_CALL(*loss_algorithm, GetLossTimeout()) |
| 1412 .WillRepeatedly(Return(timeout)); | 1395 .WillRepeatedly(Return(timeout)); |
| 1413 EXPECT_EQ(timeout, manager_.GetRetransmissionTime()); | 1396 EXPECT_EQ(timeout, manager_.GetRetransmissionTime()); |
| 1414 | 1397 |
| 1415 // Fire the retransmission timeout and ensure the loss detection algorithm | 1398 // Fire the retransmission timeout and ensure the loss detection algorithm |
| 1416 // is invoked. | 1399 // is invoked. |
| 1417 EXPECT_CALL(*loss_algorithm, DetectLostPackets(_, _, _, _)) | 1400 EXPECT_CALL(*loss_algorithm, DetectLostPackets(_, _, _, _)) |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1741 | 1724 |
| 1742 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false)); | 1725 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false)); |
| 1743 manager_.ResumeConnectionState(cached_network_params, false); | 1726 manager_.ResumeConnectionState(cached_network_params, false); |
| 1744 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, | 1727 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, |
| 1745 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); | 1728 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); |
| 1746 } | 1729 } |
| 1747 | 1730 |
| 1748 } // namespace | 1731 } // namespace |
| 1749 } // namespace test | 1732 } // namespace test |
| 1750 } // namespace net | 1733 } // namespace net |
| OLD | NEW |