Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: net/quic/core/quic_connection_test.cc

Issue 2846033002: Part of QUIC v39 change: 1) do not ack acks. 2) Send a WINDOW_UPDATE frame every 20 packets which d… (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_connection.cc ('k') | net/quic/core/quic_flow_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/core/quic_connection.h" 5 #include "net/quic/core/quic_connection.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <memory> 8 #include <memory>
9 #include <ostream> 9 #include <ostream>
10 #include <utility> 10 #include <utility>
(...skipping 18 matching lines...) Expand all
29 #include "net/quic/test_tools/quic_config_peer.h" 29 #include "net/quic/test_tools/quic_config_peer.h"
30 #include "net/quic/test_tools/quic_connection_peer.h" 30 #include "net/quic/test_tools/quic_connection_peer.h"
31 #include "net/quic/test_tools/quic_framer_peer.h" 31 #include "net/quic/test_tools/quic_framer_peer.h"
32 #include "net/quic/test_tools/quic_packet_creator_peer.h" 32 #include "net/quic/test_tools/quic_packet_creator_peer.h"
33 #include "net/quic/test_tools/quic_packet_generator_peer.h" 33 #include "net/quic/test_tools/quic_packet_generator_peer.h"
34 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" 34 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h"
35 #include "net/quic/test_tools/quic_test_utils.h" 35 #include "net/quic/test_tools/quic_test_utils.h"
36 #include "net/quic/test_tools/simple_quic_framer.h" 36 #include "net/quic/test_tools/simple_quic_framer.h"
37 #include "net/test/gtest_util.h" 37 #include "net/test/gtest_util.h"
38 #include "testing/gmock/include/gmock/gmock.h" 38 #include "testing/gmock/include/gmock/gmock.h"
39 #include "testing/gmock_mutant.h"
39 #include "testing/gtest/include/gtest/gtest.h" 40 #include "testing/gtest/include/gtest/gtest.h"
40 41
41 using std::string; 42 using std::string;
42 using testing::AnyNumber; 43 using testing::AnyNumber;
43 using testing::AtLeast; 44 using testing::AtLeast;
44 using testing::DoAll; 45 using testing::DoAll;
45 using testing::InSequence; 46 using testing::InSequence;
47 using testing::Invoke;
46 using testing::InvokeWithoutArgs; 48 using testing::InvokeWithoutArgs;
47 using testing::NiceMock; 49 using testing::NiceMock;
48 using testing::Ref; 50 using testing::Ref;
49 using testing::Return; 51 using testing::Return;
50 using testing::SaveArg; 52 using testing::SaveArg;
51 using testing::SetArgPointee; 53 using testing::SetArgPointee;
52 using testing::StrictMock; 54 using testing::StrictMock;
53 using testing::_; 55 using testing::_;
54 56
55 namespace net { 57 namespace net {
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } 384 }
383 385
384 const std::vector<std::unique_ptr<QuicStreamFrame>>& stream_frames() const { 386 const std::vector<std::unique_ptr<QuicStreamFrame>>& stream_frames() const {
385 return framer_.stream_frames(); 387 return framer_.stream_frames();
386 } 388 }
387 389
388 const std::vector<QuicPingFrame>& ping_frames() const { 390 const std::vector<QuicPingFrame>& ping_frames() const {
389 return framer_.ping_frames(); 391 return framer_.ping_frames();
390 } 392 }
391 393
394 const std::vector<QuicWindowUpdateFrame>& window_update_frames() const {
395 return framer_.window_update_frames();
396 }
397
392 const std::vector<QuicPaddingFrame>& padding_frames() const { 398 const std::vector<QuicPaddingFrame>& padding_frames() const {
393 return framer_.padding_frames(); 399 return framer_.padding_frames();
394 } 400 }
395 401
396 size_t last_packet_size() { return last_packet_size_; } 402 size_t last_packet_size() { return last_packet_size_; }
397 403
398 const QuicVersionNegotiationPacket* version_negotiation_packet() { 404 const QuicVersionNegotiationPacket* version_negotiation_packet() {
399 return framer_.version_negotiation_packet(); 405 return framer_.version_negotiation_packet();
400 } 406 }
401 407
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 EXPECT_EQ(1u, writer_->stream_frames().size()); 1498 EXPECT_EQ(1u, writer_->stream_frames().size());
1493 EXPECT_FALSE(writer_->ack_frames().empty()); 1499 EXPECT_FALSE(writer_->ack_frames().empty());
1494 1500
1495 // But an ack with no missing packets will not send an ack. 1501 // But an ack with no missing packets will not send an ack.
1496 AckPacket(original, &frame2); 1502 AckPacket(original, &frame2);
1497 ProcessAckPacket(&frame2); 1503 ProcessAckPacket(&frame2);
1498 ProcessAckPacket(&frame2); 1504 ProcessAckPacket(&frame2);
1499 } 1505 }
1500 1506
1501 TEST_P(QuicConnectionTest, 20AcksCausesAckSend) { 1507 TEST_P(QuicConnectionTest, 20AcksCausesAckSend) {
1508 if (connection_.version() > QUIC_VERSION_38) {
1509 return;
1510 }
1502 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 1511 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1503 1512
1504 SendStreamDataToPeer(1, "foo", 0, NO_FIN, nullptr); 1513 SendStreamDataToPeer(1, "foo", 0, NO_FIN, nullptr);
1505 1514
1506 QuicAlarm* ack_alarm = QuicConnectionPeer::GetAckAlarm(&connection_); 1515 QuicAlarm* ack_alarm = QuicConnectionPeer::GetAckAlarm(&connection_);
1507 // But an ack with no missing packets will not send an ack. 1516 // But an ack with no missing packets will not send an ack.
1508 QuicAckFrame frame = InitAckFrame(1); 1517 QuicAckFrame frame = InitAckFrame(1);
1509 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); 1518 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _));
1510 for (int i = 0; i < 19; ++i) { 1519 for (int i = 0; i < 19; ++i) {
1511 ProcessAckPacket(&frame); 1520 ProcessAckPacket(&frame);
1512 EXPECT_FALSE(ack_alarm->IsSet()); 1521 EXPECT_FALSE(ack_alarm->IsSet());
1513 } 1522 }
1514 EXPECT_EQ(1u, writer_->packets_write_attempts()); 1523 EXPECT_EQ(1u, writer_->packets_write_attempts());
1515 // The 20th ack packet will cause an ack to be sent. 1524 // The 20th ack packet will cause an ack to be sent.
1516 ProcessAckPacket(&frame); 1525 ProcessAckPacket(&frame);
1517 EXPECT_EQ(2u, writer_->packets_write_attempts()); 1526 EXPECT_EQ(2u, writer_->packets_write_attempts());
1518 } 1527 }
1519 1528
1529 TEST_P(QuicConnectionTest, AckNeedsRetransmittableFrames) {
1530 if (connection_.version() <= QUIC_VERSION_38) {
1531 return;
1532 }
1533
1534 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1535 EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(99);
1536
1537 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(19);
1538 // Receives packets 1 - 39.
1539 for (size_t i = 1; i <= 39; ++i) {
1540 ProcessDataPacket(i);
1541 }
1542 // Receiving Packet 40 causes 20th ack to send. Session is informed and adds
1543 // WINDOW_UPDATE.
1544 EXPECT_CALL(visitor_, OnAckNeedsRetransmittableFrame())
1545 .WillOnce(
1546 Invoke(testing::CreateFunctor(&QuicConnection::SendWindowUpdate,
1547 base::Unretained(&connection_), 0, 0)));
1548 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
1549 EXPECT_EQ(0u, writer_->window_update_frames().size());
1550 ProcessDataPacket(40);
1551 EXPECT_EQ(1u, writer_->window_update_frames().size());
1552
1553 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(9);
1554 // Receives packets 41 - 59.
1555 for (size_t i = 41; i <= 59; ++i) {
1556 ProcessDataPacket(i);
1557 }
1558 // Send a packet containing stream frame.
1559 SendStreamDataToPeer(1, "bar", 3, NO_FIN, nullptr);
1560
1561 // Session will not be informed until receiving another 20 packets.
1562 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(19);
1563 for (size_t i = 60; i <= 98; ++i) {
1564 ProcessDataPacket(i);
1565 EXPECT_EQ(0u, writer_->window_update_frames().size());
1566 }
1567 // Session does not add a retransmittable frame.
1568 EXPECT_CALL(visitor_, OnAckNeedsRetransmittableFrame()).Times(1);
1569 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
1570 EXPECT_EQ(0u, writer_->ping_frames().size());
1571 ProcessDataPacket(99);
1572 EXPECT_EQ(0u, writer_->window_update_frames().size());
1573 // A ping frame will be added.
1574 EXPECT_EQ(1u, writer_->ping_frames().size());
1575 }
1576
1520 TEST_P(QuicConnectionTest, LeastUnackedLower) { 1577 TEST_P(QuicConnectionTest, LeastUnackedLower) {
1521 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 1578 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1522 1579
1523 SendStreamDataToPeer(1, "foo", 0, NO_FIN, nullptr); 1580 SendStreamDataToPeer(1, "foo", 0, NO_FIN, nullptr);
1524 SendStreamDataToPeer(1, "bar", 3, NO_FIN, nullptr); 1581 SendStreamDataToPeer(1, "bar", 3, NO_FIN, nullptr);
1525 SendStreamDataToPeer(1, "eep", 6, NO_FIN, nullptr); 1582 SendStreamDataToPeer(1, "eep", 6, NO_FIN, nullptr);
1526 1583
1527 // Start out saying the least unacked is 2. 1584 // Start out saying the least unacked is 2.
1528 QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 5); 1585 QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 5);
1529 QuicStopWaitingFrame frame = InitStopWaitingFrame(2); 1586 QuicStopWaitingFrame frame = InitStopWaitingFrame(2);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _)); 1621 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _));
1565 1622
1566 // Nack the first packet and ack the rest, leaving a huge gap. 1623 // Nack the first packet and ack the rest, leaving a huge gap.
1567 QuicAckFrame frame1 = InitAckFrame(num_packets); 1624 QuicAckFrame frame1 = InitAckFrame(num_packets);
1568 NackPacket(1, &frame1); 1625 NackPacket(1, &frame1);
1569 ProcessAckPacket(&frame1); 1626 ProcessAckPacket(&frame1);
1570 } 1627 }
1571 1628
1572 TEST_P(QuicConnectionTest, TooManyReceivedPackets) { 1629 TEST_P(QuicConnectionTest, TooManyReceivedPackets) {
1573 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 1630 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1631 EXPECT_CALL(visitor_, OnAckNeedsRetransmittableFrame()).Times(AnyNumber());
1574 // Miss 99 of every 100 packets for 5500 packets. 1632 // Miss 99 of every 100 packets for 5500 packets.
1575 for (QuicPacketNumber i = 1; i < kMaxTrackedPackets + 500; i += 100) { 1633 for (QuicPacketNumber i = 1; i < kMaxTrackedPackets + 500; i += 100) {
1576 ProcessPacket(i); 1634 ProcessPacket(i);
1577 if (!connection_.connected()) { 1635 if (!connection_.connected()) {
1578 break; 1636 break;
1579 } 1637 }
1580 } 1638 }
1581 } 1639 }
1582 1640
1583 TEST_P(QuicConnectionTest, LargestObservedLower) { 1641 TEST_P(QuicConnectionTest, LargestObservedLower) {
(...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after
3680 EXPECT_TRUE(writer_->stop_waiting_frames().empty()); 3738 EXPECT_TRUE(writer_->stop_waiting_frames().empty());
3681 } else { 3739 } else {
3682 EXPECT_EQ(2u, writer_->frame_count()); 3740 EXPECT_EQ(2u, writer_->frame_count());
3683 EXPECT_FALSE(writer_->stop_waiting_frames().empty()); 3741 EXPECT_FALSE(writer_->stop_waiting_frames().empty());
3684 } 3742 }
3685 EXPECT_FALSE(writer_->ack_frames().empty()); 3743 EXPECT_FALSE(writer_->ack_frames().empty());
3686 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); 3744 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
3687 } 3745 }
3688 3746
3689 TEST_P(QuicConnectionTest, SendDelayedAckDecimation) { 3747 TEST_P(QuicConnectionTest, SendDelayedAckDecimation) {
3748 EXPECT_CALL(visitor_, OnAckNeedsRetransmittableFrame()).Times(AnyNumber());
3690 QuicConnectionPeer::SetAckMode(&connection_, QuicConnection::ACK_DECIMATION); 3749 QuicConnectionPeer::SetAckMode(&connection_, QuicConnection::ACK_DECIMATION);
3691 3750
3692 const size_t kMinRttMs = 40; 3751 const size_t kMinRttMs = 40;
3693 RttStats* rtt_stats = const_cast<RttStats*>(manager_->GetRttStats()); 3752 RttStats* rtt_stats = const_cast<RttStats*>(manager_->GetRttStats());
3694 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(kMinRttMs), 3753 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(kMinRttMs),
3695 QuicTime::Delta::Zero(), QuicTime::Zero()); 3754 QuicTime::Delta::Zero(), QuicTime::Zero());
3696 // The ack time should be based on min_rtt/4, since it's less than the 3755 // The ack time should be based on min_rtt/4, since it's less than the
3697 // default delayed ack time. 3756 // default delayed ack time.
3698 QuicTime ack_time = clock_.ApproximateNow() + 3757 QuicTime ack_time = clock_.ApproximateNow() +
3699 QuicTime::Delta::FromMilliseconds(kMinRttMs / 4); 3758 QuicTime::Delta::FromMilliseconds(kMinRttMs / 4);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3735 EXPECT_TRUE(writer_->stop_waiting_frames().empty()); 3794 EXPECT_TRUE(writer_->stop_waiting_frames().empty());
3736 } else { 3795 } else {
3737 EXPECT_EQ(2u, writer_->frame_count()); 3796 EXPECT_EQ(2u, writer_->frame_count());
3738 EXPECT_FALSE(writer_->stop_waiting_frames().empty()); 3797 EXPECT_FALSE(writer_->stop_waiting_frames().empty());
3739 } 3798 }
3740 EXPECT_FALSE(writer_->ack_frames().empty()); 3799 EXPECT_FALSE(writer_->ack_frames().empty());
3741 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); 3800 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
3742 } 3801 }
3743 3802
3744 TEST_P(QuicConnectionTest, SendDelayedAckDecimationEighthRtt) { 3803 TEST_P(QuicConnectionTest, SendDelayedAckDecimationEighthRtt) {
3804 EXPECT_CALL(visitor_, OnAckNeedsRetransmittableFrame()).Times(AnyNumber());
3745 QuicConnectionPeer::SetAckMode(&connection_, QuicConnection::ACK_DECIMATION); 3805 QuicConnectionPeer::SetAckMode(&connection_, QuicConnection::ACK_DECIMATION);
3746 QuicConnectionPeer::SetAckDecimationDelay(&connection_, 0.125); 3806 QuicConnectionPeer::SetAckDecimationDelay(&connection_, 0.125);
3747 3807
3748 const size_t kMinRttMs = 40; 3808 const size_t kMinRttMs = 40;
3749 RttStats* rtt_stats = const_cast<RttStats*>(manager_->GetRttStats()); 3809 RttStats* rtt_stats = const_cast<RttStats*>(manager_->GetRttStats());
3750 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(kMinRttMs), 3810 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(kMinRttMs),
3751 QuicTime::Delta::Zero(), QuicTime::Zero()); 3811 QuicTime::Delta::Zero(), QuicTime::Zero());
3752 // The ack time should be based on min_rtt/8, since it's less than the 3812 // The ack time should be based on min_rtt/8, since it's less than the
3753 // default delayed ack time. 3813 // default delayed ack time.
3754 QuicTime ack_time = clock_.ApproximateNow() + 3814 QuicTime ack_time = clock_.ApproximateNow() +
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3791 EXPECT_TRUE(writer_->stop_waiting_frames().empty()); 3851 EXPECT_TRUE(writer_->stop_waiting_frames().empty());
3792 } else { 3852 } else {
3793 EXPECT_EQ(2u, writer_->frame_count()); 3853 EXPECT_EQ(2u, writer_->frame_count());
3794 EXPECT_FALSE(writer_->stop_waiting_frames().empty()); 3854 EXPECT_FALSE(writer_->stop_waiting_frames().empty());
3795 } 3855 }
3796 EXPECT_FALSE(writer_->ack_frames().empty()); 3856 EXPECT_FALSE(writer_->ack_frames().empty());
3797 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); 3857 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
3798 } 3858 }
3799 3859
3800 TEST_P(QuicConnectionTest, SendDelayedAckDecimationWithReordering) { 3860 TEST_P(QuicConnectionTest, SendDelayedAckDecimationWithReordering) {
3861 EXPECT_CALL(visitor_, OnAckNeedsRetransmittableFrame()).Times(AnyNumber());
3801 QuicConnectionPeer::SetAckMode( 3862 QuicConnectionPeer::SetAckMode(
3802 &connection_, QuicConnection::ACK_DECIMATION_WITH_REORDERING); 3863 &connection_, QuicConnection::ACK_DECIMATION_WITH_REORDERING);
3803 3864
3804 const size_t kMinRttMs = 40; 3865 const size_t kMinRttMs = 40;
3805 RttStats* rtt_stats = const_cast<RttStats*>(manager_->GetRttStats()); 3866 RttStats* rtt_stats = const_cast<RttStats*>(manager_->GetRttStats());
3806 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(kMinRttMs), 3867 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(kMinRttMs),
3807 QuicTime::Delta::Zero(), QuicTime::Zero()); 3868 QuicTime::Delta::Zero(), QuicTime::Zero());
3808 // The ack time should be based on min_rtt/4, since it's less than the 3869 // The ack time should be based on min_rtt/4, since it's less than the
3809 // default delayed ack time. 3870 // default delayed ack time.
3810 QuicTime ack_time = clock_.ApproximateNow() + 3871 QuicTime ack_time = clock_.ApproximateNow() +
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3855 EXPECT_TRUE(writer_->stop_waiting_frames().empty()); 3916 EXPECT_TRUE(writer_->stop_waiting_frames().empty());
3856 } else { 3917 } else {
3857 EXPECT_EQ(2u, writer_->frame_count()); 3918 EXPECT_EQ(2u, writer_->frame_count());
3858 EXPECT_FALSE(writer_->stop_waiting_frames().empty()); 3919 EXPECT_FALSE(writer_->stop_waiting_frames().empty());
3859 } 3920 }
3860 EXPECT_FALSE(writer_->ack_frames().empty()); 3921 EXPECT_FALSE(writer_->ack_frames().empty());
3861 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); 3922 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
3862 } 3923 }
3863 3924
3864 TEST_P(QuicConnectionTest, SendDelayedAckDecimationWithLargeReordering) { 3925 TEST_P(QuicConnectionTest, SendDelayedAckDecimationWithLargeReordering) {
3926 EXPECT_CALL(visitor_, OnAckNeedsRetransmittableFrame()).Times(AnyNumber());
3865 QuicConnectionPeer::SetAckMode( 3927 QuicConnectionPeer::SetAckMode(
3866 &connection_, QuicConnection::ACK_DECIMATION_WITH_REORDERING); 3928 &connection_, QuicConnection::ACK_DECIMATION_WITH_REORDERING);
3867 3929
3868 const size_t kMinRttMs = 40; 3930 const size_t kMinRttMs = 40;
3869 RttStats* rtt_stats = const_cast<RttStats*>(manager_->GetRttStats()); 3931 RttStats* rtt_stats = const_cast<RttStats*>(manager_->GetRttStats());
3870 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(kMinRttMs), 3932 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(kMinRttMs),
3871 QuicTime::Delta::Zero(), QuicTime::Zero()); 3933 QuicTime::Delta::Zero(), QuicTime::Zero());
3872 // The ack time should be based on min_rtt/4, since it's less than the 3934 // The ack time should be based on min_rtt/4, since it's less than the
3873 // default delayed ack time. 3935 // default delayed ack time.
3874 QuicTime ack_time = clock_.ApproximateNow() + 3936 QuicTime ack_time = clock_.ApproximateNow() +
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
3936 EXPECT_TRUE(writer_->stop_waiting_frames().empty()); 3998 EXPECT_TRUE(writer_->stop_waiting_frames().empty());
3937 } else { 3999 } else {
3938 EXPECT_EQ(2u, writer_->frame_count()); 4000 EXPECT_EQ(2u, writer_->frame_count());
3939 EXPECT_FALSE(writer_->stop_waiting_frames().empty()); 4001 EXPECT_FALSE(writer_->stop_waiting_frames().empty());
3940 } 4002 }
3941 EXPECT_FALSE(writer_->ack_frames().empty()); 4003 EXPECT_FALSE(writer_->ack_frames().empty());
3942 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); 4004 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
3943 } 4005 }
3944 4006
3945 TEST_P(QuicConnectionTest, SendDelayedAckDecimationWithReorderingEighthRtt) { 4007 TEST_P(QuicConnectionTest, SendDelayedAckDecimationWithReorderingEighthRtt) {
4008 EXPECT_CALL(visitor_, OnAckNeedsRetransmittableFrame()).Times(AnyNumber());
3946 QuicConnectionPeer::SetAckMode( 4009 QuicConnectionPeer::SetAckMode(
3947 &connection_, QuicConnection::ACK_DECIMATION_WITH_REORDERING); 4010 &connection_, QuicConnection::ACK_DECIMATION_WITH_REORDERING);
3948 QuicConnectionPeer::SetAckDecimationDelay(&connection_, 0.125); 4011 QuicConnectionPeer::SetAckDecimationDelay(&connection_, 0.125);
3949 4012
3950 const size_t kMinRttMs = 40; 4013 const size_t kMinRttMs = 40;
3951 RttStats* rtt_stats = const_cast<RttStats*>(manager_->GetRttStats()); 4014 RttStats* rtt_stats = const_cast<RttStats*>(manager_->GetRttStats());
3952 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(kMinRttMs), 4015 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(kMinRttMs),
3953 QuicTime::Delta::Zero(), QuicTime::Zero()); 4016 QuicTime::Delta::Zero(), QuicTime::Zero());
3954 // The ack time should be based on min_rtt/8, since it's less than the 4017 // The ack time should be based on min_rtt/8, since it's less than the
3955 // default delayed ack time. 4018 // default delayed ack time.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
4002 } else { 4065 } else {
4003 EXPECT_EQ(2u, writer_->frame_count()); 4066 EXPECT_EQ(2u, writer_->frame_count());
4004 EXPECT_FALSE(writer_->stop_waiting_frames().empty()); 4067 EXPECT_FALSE(writer_->stop_waiting_frames().empty());
4005 } 4068 }
4006 EXPECT_FALSE(writer_->ack_frames().empty()); 4069 EXPECT_FALSE(writer_->ack_frames().empty());
4007 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); 4070 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
4008 } 4071 }
4009 4072
4010 TEST_P(QuicConnectionTest, 4073 TEST_P(QuicConnectionTest,
4011 SendDelayedAckDecimationWithLargeReorderingEighthRtt) { 4074 SendDelayedAckDecimationWithLargeReorderingEighthRtt) {
4075 EXPECT_CALL(visitor_, OnAckNeedsRetransmittableFrame()).Times(AnyNumber());
4012 QuicConnectionPeer::SetAckMode( 4076 QuicConnectionPeer::SetAckMode(
4013 &connection_, QuicConnection::ACK_DECIMATION_WITH_REORDERING); 4077 &connection_, QuicConnection::ACK_DECIMATION_WITH_REORDERING);
4014 QuicConnectionPeer::SetAckDecimationDelay(&connection_, 0.125); 4078 QuicConnectionPeer::SetAckDecimationDelay(&connection_, 0.125);
4015 4079
4016 const size_t kMinRttMs = 40; 4080 const size_t kMinRttMs = 40;
4017 RttStats* rtt_stats = const_cast<RttStats*>(manager_->GetRttStats()); 4081 RttStats* rtt_stats = const_cast<RttStats*>(manager_->GetRttStats());
4018 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(kMinRttMs), 4082 rtt_stats->UpdateRtt(QuicTime::Delta::FromMilliseconds(kMinRttMs),
4019 QuicTime::Delta::Zero(), QuicTime::Zero()); 4083 QuicTime::Delta::Zero(), QuicTime::Zero());
4020 // The ack time should be based on min_rtt/8, since it's less than the 4084 // The ack time should be based on min_rtt/8, since it's less than the
4021 // default delayed ack time. 4085 // default delayed ack time.
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
5152 error_details, ConnectionCloseSource::FROM_PEER)); 5216 error_details, ConnectionCloseSource::FROM_PEER));
5153 connection_.set_perspective(Perspective::IS_CLIENT); 5217 connection_.set_perspective(Perspective::IS_CLIENT);
5154 connection_.CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, 5218 connection_.CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT,
5155 error_details, 5219 error_details,
5156 ConnectionCloseBehavior::SILENT_CLOSE); 5220 ConnectionCloseBehavior::SILENT_CLOSE);
5157 } 5221 }
5158 5222
5159 } // namespace 5223 } // namespace
5160 } // namespace test 5224 } // namespace test
5161 } // namespace net 5225 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_connection.cc ('k') | net/quic/core/quic_flow_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698