| OLD | NEW |
| 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/quic_connection.h" | 5 #include "net/quic/quic_connection.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 EXPECT_CALL(*send_algorithm_, SmoothedRtt()).WillRepeatedly(Return( | 573 EXPECT_CALL(*send_algorithm_, SmoothedRtt()).WillRepeatedly(Return( |
| 574 QuicTime::Delta::FromMilliseconds(100))); | 574 QuicTime::Delta::FromMilliseconds(100))); |
| 575 ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) | 575 ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) |
| 576 .WillByDefault(Return(true)); | 576 .WillByDefault(Return(true)); |
| 577 EXPECT_CALL(visitor_, HasPendingWrites()).Times(AnyNumber()); | 577 EXPECT_CALL(visitor_, HasPendingWrites()).Times(AnyNumber()); |
| 578 EXPECT_CALL(visitor_, HasPendingHandshake()).Times(AnyNumber()); | 578 EXPECT_CALL(visitor_, HasPendingHandshake()).Times(AnyNumber()); |
| 579 EXPECT_CALL(visitor_, OnCanWrite()).Times(AnyNumber()); | 579 EXPECT_CALL(visitor_, OnCanWrite()).Times(AnyNumber()); |
| 580 | 580 |
| 581 EXPECT_CALL(*loss_algorithm_, GetLossTimeout()) | 581 EXPECT_CALL(*loss_algorithm_, GetLossTimeout()) |
| 582 .WillRepeatedly(Return(QuicTime::Zero())); | 582 .WillRepeatedly(Return(QuicTime::Zero())); |
| 583 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 583 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 584 .WillRepeatedly(Return(SequenceNumberSet())); | 584 .WillRepeatedly(Return(SequenceNumberSet())); |
| 585 } | 585 } |
| 586 | 586 |
| 587 QuicVersion version() { | 587 QuicVersion version() { |
| 588 return GetParam(); | 588 return GetParam(); |
| 589 } | 589 } |
| 590 | 590 |
| 591 QuicAckFrame* outgoing_ack() { | 591 QuicAckFrame* outgoing_ack() { |
| 592 outgoing_ack_.reset(QuicConnectionPeer::CreateAckFrame(&connection_)); | 592 outgoing_ack_.reset(QuicConnectionPeer::CreateAckFrame(&connection_)); |
| 593 return outgoing_ack_.get(); | 593 return outgoing_ack_.get(); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 | 1053 |
| 1054 QuicAckFrame frame = InitAckFrame(num_packets, 1); | 1054 QuicAckFrame frame = InitAckFrame(num_packets, 1); |
| 1055 SequenceNumberSet lost_packets; | 1055 SequenceNumberSet lost_packets; |
| 1056 // Create an ack with 256 nacks, none adjacent to one another. | 1056 // Create an ack with 256 nacks, none adjacent to one another. |
| 1057 for (QuicPacketSequenceNumber i = 1; i <= 256; ++i) { | 1057 for (QuicPacketSequenceNumber i = 1; i <= 256; ++i) { |
| 1058 NackPacket(i * 2, &frame); | 1058 NackPacket(i * 2, &frame); |
| 1059 if (i < 256) { // Last packet is nacked, but not lost. | 1059 if (i < 256) { // Last packet is nacked, but not lost. |
| 1060 lost_packets.insert(i * 2); | 1060 lost_packets.insert(i * 2); |
| 1061 } | 1061 } |
| 1062 } | 1062 } |
| 1063 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 1063 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 1064 .WillOnce(Return(lost_packets)); | 1064 .WillOnce(Return(lost_packets)); |
| 1065 EXPECT_CALL(entropy_calculator_, | 1065 EXPECT_CALL(entropy_calculator_, |
| 1066 EntropyHash(511)).WillOnce(testing::Return(0)); | 1066 EntropyHash(511)).WillOnce(testing::Return(0)); |
| 1067 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 1067 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 1068 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _)).Times(256); | 1068 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _)).Times(256); |
| 1069 EXPECT_CALL(*send_algorithm_, OnPacketLost(_, _)).Times(255); | 1069 EXPECT_CALL(*send_algorithm_, OnPacketLost(_, _)).Times(255); |
| 1070 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(255); | 1070 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(255); |
| 1071 ProcessAckPacket(&frame); | 1071 ProcessAckPacket(&frame); |
| 1072 | 1072 |
| 1073 QuicReceivedPacketManager* received_packet_manager = | 1073 QuicReceivedPacketManager* received_packet_manager = |
| 1074 QuicConnectionPeer::GetReceivedPacketManager(&connection_); | 1074 QuicConnectionPeer::GetReceivedPacketManager(&connection_); |
| 1075 // A truncated ack will not have the true largest observed. | 1075 // A truncated ack will not have the true largest observed. |
| 1076 EXPECT_GT(num_packets, | 1076 EXPECT_GT(num_packets, |
| 1077 received_packet_manager->peer_largest_observed_packet()); | 1077 received_packet_manager->peer_largest_observed_packet()); |
| 1078 | 1078 |
| 1079 AckPacket(192, &frame); | 1079 AckPacket(192, &frame); |
| 1080 | 1080 |
| 1081 // Removing one missing packet allows us to ack 192 and one more range, but | 1081 // Removing one missing packet allows us to ack 192 and one more range, but |
| 1082 // 192 has already been declared lost, so it doesn't register as an ack. | 1082 // 192 has already been declared lost, so it doesn't register as an ack. |
| 1083 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 1083 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 1084 .WillOnce(Return(SequenceNumberSet())); | 1084 .WillOnce(Return(SequenceNumberSet())); |
| 1085 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 1085 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 1086 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _)).Times(1); | 1086 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _)).Times(1); |
| 1087 ProcessAckPacket(&frame); | 1087 ProcessAckPacket(&frame); |
| 1088 EXPECT_EQ(num_packets, | 1088 EXPECT_EQ(num_packets, |
| 1089 received_packet_manager->peer_largest_observed_packet()); | 1089 received_packet_manager->peer_largest_observed_packet()); |
| 1090 } | 1090 } |
| 1091 | 1091 |
| 1092 TEST_P(QuicConnectionTest, AckReceiptCausesAckSendBadEntropy) { | 1092 TEST_P(QuicConnectionTest, AckReceiptCausesAckSendBadEntropy) { |
| 1093 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 1093 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 QuicByteCount packet_size; | 1137 QuicByteCount packet_size; |
| 1138 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, _)) | 1138 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, _)) |
| 1139 .WillOnce(DoAll(SaveArg<1>(&original), SaveArg<2>(&packet_size), | 1139 .WillOnce(DoAll(SaveArg<1>(&original), SaveArg<2>(&packet_size), |
| 1140 Return(true))); | 1140 Return(true))); |
| 1141 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL); | 1141 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL); |
| 1142 QuicAckFrame frame = InitAckFrame(original, 1); | 1142 QuicAckFrame frame = InitAckFrame(original, 1); |
| 1143 NackPacket(original, &frame); | 1143 NackPacket(original, &frame); |
| 1144 // First nack triggers early retransmit. | 1144 // First nack triggers early retransmit. |
| 1145 SequenceNumberSet lost_packets; | 1145 SequenceNumberSet lost_packets; |
| 1146 lost_packets.insert(1); | 1146 lost_packets.insert(1); |
| 1147 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 1147 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 1148 .WillOnce(Return(lost_packets)); | 1148 .WillOnce(Return(lost_packets)); |
| 1149 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 1149 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 1150 EXPECT_CALL(*send_algorithm_, OnPacketLost(1, _)).Times(1); | 1150 EXPECT_CALL(*send_algorithm_, OnPacketLost(1, _)).Times(1); |
| 1151 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(1, _)).Times(1); | 1151 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(1, _)).Times(1); |
| 1152 QuicPacketSequenceNumber retransmission; | 1152 QuicPacketSequenceNumber retransmission; |
| 1153 EXPECT_CALL(*send_algorithm_, | 1153 EXPECT_CALL(*send_algorithm_, |
| 1154 OnPacketSent(_, _, packet_size - kQuicVersionSize, | 1154 OnPacketSent(_, _, packet_size - kQuicVersionSize, |
| 1155 NACK_RETRANSMISSION, _)) | 1155 NACK_RETRANSMISSION, _)) |
| 1156 .WillOnce(DoAll(SaveArg<1>(&retransmission), Return(true))); | 1156 .WillOnce(DoAll(SaveArg<1>(&retransmission), Return(true))); |
| 1157 | 1157 |
| 1158 ProcessAckPacket(&frame); | 1158 ProcessAckPacket(&frame); |
| 1159 | 1159 |
| 1160 QuicAckFrame frame2 = InitAckFrame(retransmission, 1); | 1160 QuicAckFrame frame2 = InitAckFrame(retransmission, 1); |
| 1161 NackPacket(original, &frame2); | 1161 NackPacket(original, &frame2); |
| 1162 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 1162 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 1163 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _)); | 1163 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _)); |
| 1164 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 1164 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 1165 .WillOnce(Return(SequenceNumberSet())); | 1165 .WillOnce(Return(SequenceNumberSet())); |
| 1166 ProcessAckPacket(&frame2); | 1166 ProcessAckPacket(&frame2); |
| 1167 | 1167 |
| 1168 // Now if the peer sends an ack which still reports the retransmitted packet | 1168 // Now if the peer sends an ack which still reports the retransmitted packet |
| 1169 // as missing, that will bundle an ack with data after two acks in a row | 1169 // as missing, that will bundle an ack with data after two acks in a row |
| 1170 // indicate the high water mark needs to be raised. | 1170 // indicate the high water mark needs to be raised. |
| 1171 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, | 1171 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, |
| 1172 HAS_RETRANSMITTABLE_DATA)); | 1172 HAS_RETRANSMITTABLE_DATA)); |
| 1173 connection_.SendStreamDataWithString(3, "foo", 3, !kFin, NULL); | 1173 connection_.SendStreamDataWithString(3, "foo", 3, !kFin, NULL); |
| 1174 // No ack sent. | 1174 // No ack sent. |
| 1175 EXPECT_EQ(1u, writer_->frame_count()); | 1175 EXPECT_EQ(1u, writer_->frame_count()); |
| 1176 EXPECT_EQ(1u, writer_->stream_frames()->size()); | 1176 EXPECT_EQ(1u, writer_->stream_frames()->size()); |
| 1177 writer_->Reset(); | 1177 writer_->Reset(); |
| 1178 | 1178 |
| 1179 // No more packet loss for the rest of the test. | 1179 // No more packet loss for the rest of the test. |
| 1180 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 1180 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 1181 .WillRepeatedly(Return(SequenceNumberSet())); | 1181 .WillRepeatedly(Return(SequenceNumberSet())); |
| 1182 ProcessAckPacket(&frame2); | 1182 ProcessAckPacket(&frame2); |
| 1183 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, | 1183 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, |
| 1184 HAS_RETRANSMITTABLE_DATA)); | 1184 HAS_RETRANSMITTABLE_DATA)); |
| 1185 connection_.SendStreamDataWithString(3, "foo", 3, !kFin, NULL); | 1185 connection_.SendStreamDataWithString(3, "foo", 3, !kFin, NULL); |
| 1186 // Ack bundled. | 1186 // Ack bundled. |
| 1187 if (version() > QUIC_VERSION_15) { | 1187 if (version() > QUIC_VERSION_15) { |
| 1188 EXPECT_EQ(3u, writer_->frame_count()); | 1188 EXPECT_EQ(3u, writer_->frame_count()); |
| 1189 } else { | 1189 } else { |
| 1190 EXPECT_EQ(2u, writer_->frame_count()); | 1190 EXPECT_EQ(2u, writer_->frame_count()); |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1550 connection_.SendStreamDataWithString(3, "foo", 6, !kFin, NULL); | 1550 connection_.SendStreamDataWithString(3, "foo", 6, !kFin, NULL); |
| 1551 | 1551 |
| 1552 QuicAckFrame ack_fec = InitAckFrame(5, 1); | 1552 QuicAckFrame ack_fec = InitAckFrame(5, 1); |
| 1553 // Ack all data packets, but no fec packets. | 1553 // Ack all data packets, but no fec packets. |
| 1554 NackPacket(2, &ack_fec); | 1554 NackPacket(2, &ack_fec); |
| 1555 NackPacket(4, &ack_fec); | 1555 NackPacket(4, &ack_fec); |
| 1556 | 1556 |
| 1557 // Lose the first FEC packet and ack the three data packets. | 1557 // Lose the first FEC packet and ack the three data packets. |
| 1558 SequenceNumberSet lost_packets; | 1558 SequenceNumberSet lost_packets; |
| 1559 lost_packets.insert(2); | 1559 lost_packets.insert(2); |
| 1560 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 1560 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 1561 .WillOnce(Return(lost_packets)); | 1561 .WillOnce(Return(lost_packets)); |
| 1562 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 1562 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 1563 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _)).Times(3); | 1563 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _)).Times(3); |
| 1564 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _)); | 1564 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _)); |
| 1565 EXPECT_CALL(*send_algorithm_, OnPacketLost(2, _)); | 1565 EXPECT_CALL(*send_algorithm_, OnPacketLost(2, _)); |
| 1566 ProcessAckPacket(&ack_fec); | 1566 ProcessAckPacket(&ack_fec); |
| 1567 | 1567 |
| 1568 clock_.AdvanceTime(DefaultRetransmissionTime().Subtract( | 1568 clock_.AdvanceTime(DefaultRetransmissionTime().Subtract( |
| 1569 QuicTime::Delta::FromMilliseconds(1))); | 1569 QuicTime::Delta::FromMilliseconds(1))); |
| 1570 | 1570 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 1837 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 1838 EXPECT_CALL(*send_algorithm_, OnPacketAcked(1, _)); | 1838 EXPECT_CALL(*send_algorithm_, OnPacketAcked(1, _)); |
| 1839 QuicAckFrame ack_one = InitAckFrame(1, 0); | 1839 QuicAckFrame ack_one = InitAckFrame(1, 0); |
| 1840 ProcessAckPacket(&ack_one); | 1840 ProcessAckPacket(&ack_one); |
| 1841 | 1841 |
| 1842 // Lose a packet and ensure it triggers retransmission. | 1842 // Lose a packet and ensure it triggers retransmission. |
| 1843 QuicAckFrame nack_two = InitAckFrame(3, 0); | 1843 QuicAckFrame nack_two = InitAckFrame(3, 0); |
| 1844 NackPacket(2, &nack_two); | 1844 NackPacket(2, &nack_two); |
| 1845 SequenceNumberSet lost_packets; | 1845 SequenceNumberSet lost_packets; |
| 1846 lost_packets.insert(2); | 1846 lost_packets.insert(2); |
| 1847 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 1847 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 1848 .WillOnce(Return(lost_packets)); | 1848 .WillOnce(Return(lost_packets)); |
| 1849 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 1849 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 1850 EXPECT_CALL(*send_algorithm_, OnPacketAcked(3, _)); | 1850 EXPECT_CALL(*send_algorithm_, OnPacketAcked(3, _)); |
| 1851 EXPECT_CALL(*send_algorithm_, OnPacketLost(2, _)).Times(1); | 1851 EXPECT_CALL(*send_algorithm_, OnPacketLost(2, _)).Times(1); |
| 1852 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _)).Times(1); | 1852 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _)).Times(1); |
| 1853 EXPECT_CALL(*send_algorithm_, | 1853 EXPECT_CALL(*send_algorithm_, |
| 1854 OnPacketSent(_, _, second_packet_size - kQuicVersionSize, | 1854 OnPacketSent(_, _, second_packet_size - kQuicVersionSize, |
| 1855 NACK_RETRANSMISSION, _)).Times(1); | 1855 NACK_RETRANSMISSION, _)).Times(1); |
| 1856 ProcessAckPacket(&nack_two); | 1856 ProcessAckPacket(&nack_two); |
| 1857 } | 1857 } |
| 1858 | 1858 |
| 1859 TEST_P(QuicConnectionTest, DiscardRetransmit) { | 1859 TEST_P(QuicConnectionTest, DiscardRetransmit) { |
| 1860 QuicPacketSequenceNumber last_packet; | 1860 QuicPacketSequenceNumber last_packet; |
| 1861 SendStreamDataToPeer(1, "foo", 0, !kFin, &last_packet); // Packet 1 | 1861 SendStreamDataToPeer(1, "foo", 0, !kFin, &last_packet); // Packet 1 |
| 1862 SendStreamDataToPeer(1, "foos", 3, !kFin, &last_packet); // Packet 2 | 1862 SendStreamDataToPeer(1, "foos", 3, !kFin, &last_packet); // Packet 2 |
| 1863 SendStreamDataToPeer(1, "fooos", 7, !kFin, &last_packet); // Packet 3 | 1863 SendStreamDataToPeer(1, "fooos", 7, !kFin, &last_packet); // Packet 3 |
| 1864 | 1864 |
| 1865 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 1865 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 1866 | 1866 |
| 1867 // Instigate a loss with an ack. | 1867 // Instigate a loss with an ack. |
| 1868 QuicAckFrame nack_two = InitAckFrame(3, 0); | 1868 QuicAckFrame nack_two = InitAckFrame(3, 0); |
| 1869 NackPacket(2, &nack_two); | 1869 NackPacket(2, &nack_two); |
| 1870 // The first nack should trigger a fast retransmission, but we'll be | 1870 // The first nack should trigger a fast retransmission, but we'll be |
| 1871 // write blocked, so the packet will be queued. | 1871 // write blocked, so the packet will be queued. |
| 1872 BlockOnNextWrite(); | 1872 BlockOnNextWrite(); |
| 1873 SequenceNumberSet lost_packets; | 1873 SequenceNumberSet lost_packets; |
| 1874 lost_packets.insert(2); | 1874 lost_packets.insert(2); |
| 1875 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 1875 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 1876 .WillOnce(Return(lost_packets)); | 1876 .WillOnce(Return(lost_packets)); |
| 1877 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 1877 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 1878 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _)).Times(2); | 1878 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _)).Times(2); |
| 1879 EXPECT_CALL(*send_algorithm_, OnPacketLost(2, _)); | 1879 EXPECT_CALL(*send_algorithm_, OnPacketLost(2, _)); |
| 1880 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _)); | 1880 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _)); |
| 1881 ProcessAckPacket(&nack_two); | 1881 ProcessAckPacket(&nack_two); |
| 1882 EXPECT_EQ(1u, connection_.NumQueuedPackets()); | 1882 EXPECT_EQ(1u, connection_.NumQueuedPackets()); |
| 1883 | 1883 |
| 1884 // Now, ack the previous transmission. | 1884 // Now, ack the previous transmission. |
| 1885 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 1885 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 1886 .WillOnce(Return(SequenceNumberSet())); | 1886 .WillOnce(Return(SequenceNumberSet())); |
| 1887 QuicAckFrame ack_all = InitAckFrame(3, 0); | 1887 QuicAckFrame ack_all = InitAckFrame(3, 0); |
| 1888 ProcessAckPacket(&ack_all); | 1888 ProcessAckPacket(&ack_all); |
| 1889 | 1889 |
| 1890 // Unblock the socket and attempt to send the queued packets. However, | 1890 // Unblock the socket and attempt to send the queued packets. However, |
| 1891 // since the previous transmission has been acked, we will not | 1891 // since the previous transmission has been acked, we will not |
| 1892 // send the retransmission. | 1892 // send the retransmission. |
| 1893 EXPECT_CALL(*send_algorithm_, | 1893 EXPECT_CALL(*send_algorithm_, |
| 1894 OnPacketSent(_, _, _, _, _)).Times(0); | 1894 OnPacketSent(_, _, _, _, _)).Times(0); |
| 1895 | 1895 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1906 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, _)) | 1906 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, _)) |
| 1907 .WillOnce(DoAll(SaveArg<1>(&largest_observed), SaveArg<2>(&packet_size), | 1907 .WillOnce(DoAll(SaveArg<1>(&largest_observed), SaveArg<2>(&packet_size), |
| 1908 Return(true))); | 1908 Return(true))); |
| 1909 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL); | 1909 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL); |
| 1910 | 1910 |
| 1911 QuicAckFrame frame = InitAckFrame(1, largest_observed); | 1911 QuicAckFrame frame = InitAckFrame(1, largest_observed); |
| 1912 NackPacket(largest_observed, &frame); | 1912 NackPacket(largest_observed, &frame); |
| 1913 // The first nack should retransmit the largest observed packet. | 1913 // The first nack should retransmit the largest observed packet. |
| 1914 SequenceNumberSet lost_packets; | 1914 SequenceNumberSet lost_packets; |
| 1915 lost_packets.insert(1); | 1915 lost_packets.insert(1); |
| 1916 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 1916 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 1917 .WillOnce(Return(lost_packets)); | 1917 .WillOnce(Return(lost_packets)); |
| 1918 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 1918 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 1919 EXPECT_CALL(*send_algorithm_, OnPacketLost(1, _)).Times(1); | 1919 EXPECT_CALL(*send_algorithm_, OnPacketLost(1, _)).Times(1); |
| 1920 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(1, _)).Times(1); | 1920 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(1, _)).Times(1); |
| 1921 EXPECT_CALL(*send_algorithm_, | 1921 EXPECT_CALL(*send_algorithm_, |
| 1922 OnPacketSent(_, _, packet_size - kQuicVersionSize, | 1922 OnPacketSent(_, _, packet_size - kQuicVersionSize, |
| 1923 NACK_RETRANSMISSION, _)); | 1923 NACK_RETRANSMISSION, _)); |
| 1924 ProcessAckPacket(&frame); | 1924 ProcessAckPacket(&frame); |
| 1925 } | 1925 } |
| 1926 | 1926 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 // Ack 15, nack 1-14. | 2030 // Ack 15, nack 1-14. |
| 2031 SequenceNumberSet lost_packets; | 2031 SequenceNumberSet lost_packets; |
| 2032 QuicAckFrame nack = InitAckFrame(15, 0); | 2032 QuicAckFrame nack = InitAckFrame(15, 0); |
| 2033 for (int i = 1; i < 15; ++i) { | 2033 for (int i = 1; i < 15; ++i) { |
| 2034 NackPacket(i, &nack); | 2034 NackPacket(i, &nack); |
| 2035 lost_packets.insert(i); | 2035 lost_packets.insert(i); |
| 2036 } | 2036 } |
| 2037 | 2037 |
| 2038 // 14 packets have been NACK'd and lost. In TCP cubic, PRR limits | 2038 // 14 packets have been NACK'd and lost. In TCP cubic, PRR limits |
| 2039 // the retransmission rate in the case of burst losses. | 2039 // the retransmission rate in the case of burst losses. |
| 2040 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 2040 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 2041 .WillOnce(Return(lost_packets)); | 2041 .WillOnce(Return(lost_packets)); |
| 2042 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 2042 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 2043 EXPECT_CALL(*send_algorithm_, OnPacketAcked(15, _)).Times(1); | 2043 EXPECT_CALL(*send_algorithm_, OnPacketAcked(15, _)).Times(1); |
| 2044 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(14); | 2044 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(_, _)).Times(14); |
| 2045 EXPECT_CALL(*send_algorithm_, OnPacketLost(_, _)).Times(14); | 2045 EXPECT_CALL(*send_algorithm_, OnPacketLost(_, _)).Times(14); |
| 2046 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(14); | 2046 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(14); |
| 2047 ProcessAckPacket(&nack); | 2047 ProcessAckPacket(&nack); |
| 2048 } | 2048 } |
| 2049 | 2049 |
| 2050 // Test sending multiple acks from the connection to the session. | 2050 // Test sending multiple acks from the connection to the session. |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2394 connection_.GetRetransmissionAlarm()->Fire(); | 2394 connection_.GetRetransmissionAlarm()->Fire(); |
| 2395 EXPECT_FALSE(QuicConnectionPeer::IsSavedForRetransmission( | 2395 EXPECT_FALSE(QuicConnectionPeer::IsSavedForRetransmission( |
| 2396 &connection_, original_sequence_number)); | 2396 &connection_, original_sequence_number)); |
| 2397 ASSERT_TRUE(QuicConnectionPeer::IsSavedForRetransmission( | 2397 ASSERT_TRUE(QuicConnectionPeer::IsSavedForRetransmission( |
| 2398 &connection_, rto_sequence_number)); | 2398 &connection_, rto_sequence_number)); |
| 2399 EXPECT_TRUE(QuicConnectionPeer::IsRetransmission( | 2399 EXPECT_TRUE(QuicConnectionPeer::IsRetransmission( |
| 2400 &connection_, rto_sequence_number)); | 2400 &connection_, rto_sequence_number)); |
| 2401 // Once by explicit nack. | 2401 // Once by explicit nack. |
| 2402 SequenceNumberSet lost_packets; | 2402 SequenceNumberSet lost_packets; |
| 2403 lost_packets.insert(rto_sequence_number); | 2403 lost_packets.insert(rto_sequence_number); |
| 2404 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 2404 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 2405 .WillOnce(Return(lost_packets)); | 2405 .WillOnce(Return(lost_packets)); |
| 2406 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)).Times(1); | 2406 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)).Times(1); |
| 2407 EXPECT_CALL(*send_algorithm_, OnPacketLost(rto_sequence_number, _)).Times(1); | 2407 EXPECT_CALL(*send_algorithm_, OnPacketLost(rto_sequence_number, _)).Times(1); |
| 2408 EXPECT_CALL(*send_algorithm_, | 2408 EXPECT_CALL(*send_algorithm_, |
| 2409 OnPacketAbandoned(rto_sequence_number, _)).Times(1); | 2409 OnPacketAbandoned(rto_sequence_number, _)).Times(1); |
| 2410 QuicPacketSequenceNumber nack_sequence_number = 0; | 2410 QuicPacketSequenceNumber nack_sequence_number = 0; |
| 2411 // Ack packets might generate some other packets, which are not | 2411 // Ack packets might generate some other packets, which are not |
| 2412 // retransmissions. (More ack packets). | 2412 // retransmissions. (More ack packets). |
| 2413 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, _)) | 2413 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, NOT_RETRANSMISSION, _)) |
| 2414 .Times(AnyNumber()); | 2414 .Times(AnyNumber()); |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2911 | 2911 |
| 2912 TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) { | 2912 TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) { |
| 2913 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 2913 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 2914 connection_.SendStreamDataWithString(kStreamId3, "foo", 0, !kFin, NULL); | 2914 connection_.SendStreamDataWithString(kStreamId3, "foo", 0, !kFin, NULL); |
| 2915 connection_.SendStreamDataWithString(kStreamId3, "foo", 3, !kFin, NULL); | 2915 connection_.SendStreamDataWithString(kStreamId3, "foo", 3, !kFin, NULL); |
| 2916 // Ack the second packet, which will retransmit the first packet. | 2916 // Ack the second packet, which will retransmit the first packet. |
| 2917 QuicAckFrame ack = InitAckFrame(2, 0); | 2917 QuicAckFrame ack = InitAckFrame(2, 0); |
| 2918 NackPacket(1, &ack); | 2918 NackPacket(1, &ack); |
| 2919 SequenceNumberSet lost_packets; | 2919 SequenceNumberSet lost_packets; |
| 2920 lost_packets.insert(1); | 2920 lost_packets.insert(1); |
| 2921 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 2921 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 2922 .WillOnce(Return(lost_packets)); | 2922 .WillOnce(Return(lost_packets)); |
| 2923 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 2923 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 2924 EXPECT_CALL(*send_algorithm_, OnPacketAcked(2, _)).Times(1); | 2924 EXPECT_CALL(*send_algorithm_, OnPacketAcked(2, _)).Times(1); |
| 2925 EXPECT_CALL(*send_algorithm_, OnPacketLost(1, _)).Times(1); | 2925 EXPECT_CALL(*send_algorithm_, OnPacketLost(1, _)).Times(1); |
| 2926 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(1, _)).Times(1); | 2926 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(1, _)).Times(1); |
| 2927 ProcessAckPacket(&ack); | 2927 ProcessAckPacket(&ack); |
| 2928 EXPECT_EQ(1u, writer_->frame_count()); | 2928 EXPECT_EQ(1u, writer_->frame_count()); |
| 2929 EXPECT_EQ(1u, writer_->stream_frames()->size()); | 2929 EXPECT_EQ(1u, writer_->stream_frames()->size()); |
| 2930 writer_->Reset(); | 2930 writer_->Reset(); |
| 2931 | 2931 |
| 2932 // Now ack the retransmission, which will both raise the high water mark | 2932 // Now ack the retransmission, which will both raise the high water mark |
| 2933 // and see if there is more data to send. | 2933 // and see if there is more data to send. |
| 2934 ack = InitAckFrame(3, 0); | 2934 ack = InitAckFrame(3, 0); |
| 2935 NackPacket(1, &ack); | 2935 NackPacket(1, &ack); |
| 2936 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 2936 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 2937 .WillOnce(Return(SequenceNumberSet())); | 2937 .WillOnce(Return(SequenceNumberSet())); |
| 2938 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 2938 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 2939 EXPECT_CALL(*send_algorithm_, OnPacketAcked(3, _)).Times(1); | 2939 EXPECT_CALL(*send_algorithm_, OnPacketAcked(3, _)).Times(1); |
| 2940 ProcessAckPacket(&ack); | 2940 ProcessAckPacket(&ack); |
| 2941 | 2941 |
| 2942 // Check that no packet is sent and the ack alarm isn't set. | 2942 // Check that no packet is sent and the ack alarm isn't set. |
| 2943 EXPECT_EQ(0u, writer_->frame_count()); | 2943 EXPECT_EQ(0u, writer_->frame_count()); |
| 2944 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); | 2944 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); |
| 2945 writer_->Reset(); | 2945 writer_->Reset(); |
| 2946 | 2946 |
| 2947 // Send the same ack, but send both data and an ack together. | 2947 // Send the same ack, but send both data and an ack together. |
| 2948 ack = InitAckFrame(3, 0); | 2948 ack = InitAckFrame(3, 0); |
| 2949 NackPacket(1, &ack); | 2949 NackPacket(1, &ack); |
| 2950 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 2950 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 2951 .WillOnce(Return(SequenceNumberSet())); | 2951 .WillOnce(Return(SequenceNumberSet())); |
| 2952 EXPECT_CALL(visitor_, OnCanWrite()).WillOnce( | 2952 EXPECT_CALL(visitor_, OnCanWrite()).WillOnce( |
| 2953 IgnoreResult(InvokeWithoutArgs( | 2953 IgnoreResult(InvokeWithoutArgs( |
| 2954 &connection_, | 2954 &connection_, |
| 2955 &TestConnection::EnsureWritableAndSendStreamData5))); | 2955 &TestConnection::EnsureWritableAndSendStreamData5))); |
| 2956 ProcessAckPacket(&ack); | 2956 ProcessAckPacket(&ack); |
| 2957 | 2957 |
| 2958 // Check that ack is bundled with outgoing data and the delayed ack | 2958 // Check that ack is bundled with outgoing data and the delayed ack |
| 2959 // alarm is reset. | 2959 // alarm is reset. |
| 2960 if (version() > QUIC_VERSION_15) { | 2960 if (version() > QUIC_VERSION_15) { |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3399 clock_.AdvanceTime(QuicTime::Delta::FromSeconds(10)); | 3399 clock_.AdvanceTime(QuicTime::Delta::FromSeconds(10)); |
| 3400 connection_.GetRetransmissionAlarm()->Fire(); | 3400 connection_.GetRetransmissionAlarm()->Fire(); |
| 3401 | 3401 |
| 3402 // Retransmit due to explicit nacks. | 3402 // Retransmit due to explicit nacks. |
| 3403 QuicAckFrame nack_three = InitAckFrame(4, 0); | 3403 QuicAckFrame nack_three = InitAckFrame(4, 0); |
| 3404 NackPacket(3, &nack_three); | 3404 NackPacket(3, &nack_three); |
| 3405 NackPacket(1, &nack_three); | 3405 NackPacket(1, &nack_three); |
| 3406 SequenceNumberSet lost_packets; | 3406 SequenceNumberSet lost_packets; |
| 3407 lost_packets.insert(1); | 3407 lost_packets.insert(1); |
| 3408 lost_packets.insert(3); | 3408 lost_packets.insert(3); |
| 3409 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 3409 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 3410 .WillOnce(Return(lost_packets)); | 3410 .WillOnce(Return(lost_packets)); |
| 3411 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 3411 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 3412 EXPECT_CALL(*send_algorithm_, OnPacketAcked(4, _)).Times(1); | 3412 EXPECT_CALL(*send_algorithm_, OnPacketAcked(4, _)).Times(1); |
| 3413 EXPECT_CALL(*send_algorithm_, OnPacketLost(_, _)).Times(2); | 3413 EXPECT_CALL(*send_algorithm_, OnPacketLost(_, _)).Times(2); |
| 3414 EXPECT_CALL(visitor_, OnCanWrite()).Times(2); | 3414 EXPECT_CALL(visitor_, OnCanWrite()).Times(2); |
| 3415 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 3415 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 3416 ProcessAckPacket(&nack_three); | 3416 ProcessAckPacket(&nack_three); |
| 3417 | 3417 |
| 3418 EXPECT_CALL(*send_algorithm_, SmoothedRtt()).WillOnce( | 3418 EXPECT_CALL(*send_algorithm_, SmoothedRtt()).WillOnce( |
| 3419 Return(QuicTime::Delta::Zero())); | 3419 Return(QuicTime::Delta::Zero())); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3633 // Send some other data which we will ACK. | 3633 // Send some other data which we will ACK. |
| 3634 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL); | 3634 connection_.SendStreamDataWithString(1, "foo", 0, !kFin, NULL); |
| 3635 connection_.SendStreamDataWithString(1, "bar", 0, !kFin, NULL); | 3635 connection_.SendStreamDataWithString(1, "bar", 0, !kFin, NULL); |
| 3636 | 3636 |
| 3637 // Now we receive ACK for packets 2 and 3, but importantly missing packet 1 | 3637 // Now we receive ACK for packets 2 and 3, but importantly missing packet 1 |
| 3638 // which we registered to be notified about. | 3638 // which we registered to be notified about. |
| 3639 QuicAckFrame frame = InitAckFrame(3, 0); | 3639 QuicAckFrame frame = InitAckFrame(3, 0); |
| 3640 NackPacket(1, &frame); | 3640 NackPacket(1, &frame); |
| 3641 SequenceNumberSet lost_packets; | 3641 SequenceNumberSet lost_packets; |
| 3642 lost_packets.insert(1); | 3642 lost_packets.insert(1); |
| 3643 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 3643 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 3644 .WillOnce(Return(lost_packets)); | 3644 .WillOnce(Return(lost_packets)); |
| 3645 EXPECT_CALL(*send_algorithm_, OnPacketLost(1, _)); | 3645 EXPECT_CALL(*send_algorithm_, OnPacketLost(1, _)); |
| 3646 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(1, _)); | 3646 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(1, _)); |
| 3647 ProcessAckPacket(&frame); | 3647 ProcessAckPacket(&frame); |
| 3648 } | 3648 } |
| 3649 | 3649 |
| 3650 TEST_P(QuicConnectionTest, AckNotifierCallbackAfterRetransmission) { | 3650 TEST_P(QuicConnectionTest, AckNotifierCallbackAfterRetransmission) { |
| 3651 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 3651 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 3652 | 3652 |
| 3653 // Create a delegate which we expect to be called. | 3653 // Create a delegate which we expect to be called. |
| 3654 scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate); | 3654 scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate); |
| 3655 EXPECT_CALL(*delegate, OnAckNotification()).Times(1); | 3655 EXPECT_CALL(*delegate, OnAckNotification()).Times(1); |
| 3656 | 3656 |
| 3657 // Send four packets, and register to be notified on ACK of packet 2. | 3657 // Send four packets, and register to be notified on ACK of packet 2. |
| 3658 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL); | 3658 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL); |
| 3659 connection_.SendStreamDataWithString(3, "bar", 0, !kFin, delegate.get()); | 3659 connection_.SendStreamDataWithString(3, "bar", 0, !kFin, delegate.get()); |
| 3660 connection_.SendStreamDataWithString(3, "baz", 0, !kFin, NULL); | 3660 connection_.SendStreamDataWithString(3, "baz", 0, !kFin, NULL); |
| 3661 connection_.SendStreamDataWithString(3, "qux", 0, !kFin, NULL); | 3661 connection_.SendStreamDataWithString(3, "qux", 0, !kFin, NULL); |
| 3662 | 3662 |
| 3663 // Now we receive ACK for packets 1, 3, and 4 and lose 2. | 3663 // Now we receive ACK for packets 1, 3, and 4 and lose 2. |
| 3664 QuicAckFrame frame = InitAckFrame(4, 0); | 3664 QuicAckFrame frame = InitAckFrame(4, 0); |
| 3665 NackPacket(2, &frame); | 3665 NackPacket(2, &frame); |
| 3666 SequenceNumberSet lost_packets; | 3666 SequenceNumberSet lost_packets; |
| 3667 lost_packets.insert(2); | 3667 lost_packets.insert(2); |
| 3668 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 3668 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 3669 .WillOnce(Return(lost_packets)); | 3669 .WillOnce(Return(lost_packets)); |
| 3670 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 3670 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 3671 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _)).Times(3); | 3671 EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _)).Times(3); |
| 3672 EXPECT_CALL(*send_algorithm_, OnPacketLost(2, _)); | 3672 EXPECT_CALL(*send_algorithm_, OnPacketLost(2, _)); |
| 3673 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _)); | 3673 EXPECT_CALL(*send_algorithm_, OnPacketAbandoned(2, _)); |
| 3674 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); | 3674 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
| 3675 ProcessAckPacket(&frame); | 3675 ProcessAckPacket(&frame); |
| 3676 | 3676 |
| 3677 // Now we get an ACK for packet 5 (retransmitted packet 2), which should | 3677 // Now we get an ACK for packet 5 (retransmitted packet 2), which should |
| 3678 // trigger the callback. | 3678 // trigger the callback. |
| 3679 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) | 3679 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _, _)) |
| 3680 .WillRepeatedly(Return(SequenceNumberSet())); | 3680 .WillRepeatedly(Return(SequenceNumberSet())); |
| 3681 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 3681 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
| 3682 EXPECT_CALL(*send_algorithm_, OnPacketAcked(5, _)); | 3682 EXPECT_CALL(*send_algorithm_, OnPacketAcked(5, _)); |
| 3683 QuicAckFrame second_ack_frame = InitAckFrame(5, 0); | 3683 QuicAckFrame second_ack_frame = InitAckFrame(5, 0); |
| 3684 ProcessAckPacket(&second_ack_frame); | 3684 ProcessAckPacket(&second_ack_frame); |
| 3685 } | 3685 } |
| 3686 | 3686 |
| 3687 // TODO(rjshade): Add a similar test that FEC recovery on peer (and resulting | 3687 // TODO(rjshade): Add a similar test that FEC recovery on peer (and resulting |
| 3688 // ACK) triggers notification on our end. | 3688 // ACK) triggers notification on our end. |
| 3689 TEST_P(QuicConnectionTest, AckNotifierCallbackAfterFECRecovery) { | 3689 TEST_P(QuicConnectionTest, AckNotifierCallbackAfterFECRecovery) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3830 QuicBlockedFrame blocked; | 3830 QuicBlockedFrame blocked; |
| 3831 blocked.stream_id = 3; | 3831 blocked.stream_id = 3; |
| 3832 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 3832 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
| 3833 ProcessFramePacket(QuicFrame(&blocked)); | 3833 ProcessFramePacket(QuicFrame(&blocked)); |
| 3834 EXPECT_TRUE(ack_alarm->IsSet()); | 3834 EXPECT_TRUE(ack_alarm->IsSet()); |
| 3835 } | 3835 } |
| 3836 | 3836 |
| 3837 } // namespace | 3837 } // namespace |
| 3838 } // namespace test | 3838 } // namespace test |
| 3839 } // namespace net | 3839 } // namespace net |
| OLD | NEW |