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

Unified Diff: net/quic/quic_connection_test.cc

Issue 413403008: Remove QUIC_VERSION_15 now that Chrome Stable supports QUIC_VERSION_16. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0723
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_framer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection_test.cc
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index b868c98136118d6882ae0b624ae2157bb5896525..fb4cf89789f14ede2ff1c218f454a1ede50db76e 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -657,13 +657,13 @@ class QuicConnectionTest : public ::testing::TestWithParam<QuicVersion> {
return outgoing_ack_.get();
}
+ QuicStopWaitingFrame* stop_waiting() {
+ stop_waiting_.reset(
+ QuicConnectionPeer::CreateStopWaitingFrame(&connection_));
+ return stop_waiting_.get();
+ }
+
QuicPacketSequenceNumber least_unacked() {
- if (version() <= QUIC_VERSION_15) {
- if (writer_->ack_frames().empty()) {
- return 0;
- }
- return writer_->ack_frames()[0].sent_info.least_unacked;
- }
if (writer_->stop_waiting_frames().empty()) {
return 0;
}
@@ -889,9 +889,8 @@ class QuicConnectionTest : public ::testing::TestWithParam<QuicVersion> {
}
// Initialize a frame acknowledging all packets up to largest_observed.
- const QuicAckFrame InitAckFrame(QuicPacketSequenceNumber largest_observed,
- QuicPacketSequenceNumber least_unacked) {
- QuicAckFrame frame(MakeAckFrame(largest_observed, least_unacked));
+ const QuicAckFrame InitAckFrame(QuicPacketSequenceNumber largest_observed) {
+ QuicAckFrame frame(MakeAckFrame(largest_observed));
if (largest_observed > 0) {
frame.received_info.entropy_hash =
QuicConnectionPeer::GetSentEntropyHash(&connection_, largest_observed);
@@ -975,6 +974,7 @@ class QuicConnectionTest : public ::testing::TestWithParam<QuicVersion> {
QuicStreamFrame frame1_;
QuicStreamFrame frame2_;
scoped_ptr<QuicAckFrame> outgoing_ack_;
+ scoped_ptr<QuicStopWaitingFrame> stop_waiting_;
QuicSequenceNumberLength sequence_number_length_;
QuicConnectionIdLength connection_id_length_;
@@ -1060,7 +1060,7 @@ TEST_P(QuicConnectionTest, PacketsOutOfOrderWithAdditionsAndLeastAwaiting) {
// awaiting' is 4. The connection should then realize 1 will not be
// retransmitted, and will remove it from the missing list.
peer_creator_.set_sequence_number(5);
- QuicAckFrame frame = InitAckFrame(1, 4);
+ QuicAckFrame frame = InitAckFrame(1);
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(_, _, _, _));
ProcessAckPacket(&frame);
@@ -1102,7 +1102,7 @@ TEST_P(QuicConnectionTest, TruncatedAck) {
SendStreamDataToPeer(3, "foo", i * 3, !kFin, NULL);
}
- QuicAckFrame frame = InitAckFrame(num_packets, 1);
+ QuicAckFrame frame = InitAckFrame(num_packets);
SequenceNumberSet lost_packets;
// Create an ack with 256 nacks, none adjacent to one another.
for (QuicPacketSequenceNumber i = 1; i <= 256; ++i) {
@@ -1153,7 +1153,7 @@ TEST_P(QuicConnectionTest, AckReceiptCausesAckSendBadEntropy) {
testing::Return(QuicTime::Delta::Zero()));
// Skip a packet and then record an ack.
peer_creator_.set_sequence_number(2);
- QuicAckFrame frame = InitAckFrame(0, 3);
+ QuicAckFrame frame = InitAckFrame(0);
ProcessAckPacket(&frame);
}
@@ -1186,7 +1186,7 @@ TEST_P(QuicConnectionTest, AckReceiptCausesAckSend) {
.WillOnce(DoAll(SaveArg<2>(&original), SaveArg<3>(&packet_size),
Return(true)));
connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL);
- QuicAckFrame frame = InitAckFrame(original, 1);
+ QuicAckFrame frame = InitAckFrame(original);
NackPacket(original, &frame);
// First nack triggers early retransmit.
SequenceNumberSet lost_packets;
@@ -1201,7 +1201,7 @@ TEST_P(QuicConnectionTest, AckReceiptCausesAckSend) {
ProcessAckPacket(&frame);
- QuicAckFrame frame2 = InitAckFrame(retransmission, 1);
+ QuicAckFrame frame2 = InitAckFrame(retransmission);
NackPacket(original, &frame2);
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
@@ -1226,11 +1226,7 @@ TEST_P(QuicConnectionTest, AckReceiptCausesAckSend) {
HAS_RETRANSMITTABLE_DATA));
connection_.SendStreamDataWithString(3, "foo", 3, !kFin, NULL);
// Ack bundled.
- if (version() > QUIC_VERSION_15) {
- EXPECT_EQ(3u, writer_->frame_count());
- } else {
- EXPECT_EQ(2u, writer_->frame_count());
- }
+ EXPECT_EQ(3u, writer_->frame_count());
EXPECT_EQ(1u, writer_->stream_frames().size());
EXPECT_FALSE(writer_->ack_frames().empty());
@@ -1249,13 +1245,8 @@ TEST_P(QuicConnectionTest, LeastUnackedLower) {
// Start out saying the least unacked is 2.
peer_creator_.set_sequence_number(5);
- if (version() > QUIC_VERSION_15) {
- QuicStopWaitingFrame frame = InitStopWaitingFrame(2);
- ProcessStopWaitingPacket(&frame);
- } else {
- QuicAckFrame frame = InitAckFrame(0, 2);
- ProcessAckPacket(&frame);
- }
+ QuicStopWaitingFrame frame = InitStopWaitingFrame(2);
+ ProcessStopWaitingPacket(&frame);
// Change it to 1, but lower the sequence number to fake out-of-order packets.
// This should be fine.
@@ -1263,28 +1254,17 @@ TEST_P(QuicConnectionTest, LeastUnackedLower) {
// The scheduler will not process out of order acks, but all packet processing
// causes the connection to try to write.
EXPECT_CALL(visitor_, OnCanWrite());
- if (version() > QUIC_VERSION_15) {
- QuicStopWaitingFrame frame2 = InitStopWaitingFrame(1);
- ProcessStopWaitingPacket(&frame2);
- } else {
- QuicAckFrame frame2 = InitAckFrame(0, 1);
- ProcessAckPacket(&frame2);
- }
+ QuicStopWaitingFrame frame2 = InitStopWaitingFrame(1);
+ ProcessStopWaitingPacket(&frame2);
// Now claim it's one, but set the ordering so it was sent "after" the first
// one. This should cause a connection error.
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
peer_creator_.set_sequence_number(7);
- if (version() > QUIC_VERSION_15) {
- EXPECT_CALL(visitor_,
- OnConnectionClosed(QUIC_INVALID_STOP_WAITING_DATA, false));
- QuicStopWaitingFrame frame2 = InitStopWaitingFrame(1);
- ProcessStopWaitingPacket(&frame2);
- } else {
- EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_INVALID_ACK_DATA, false));
- QuicAckFrame frame2 = InitAckFrame(0, 1);
- ProcessAckPacket(&frame2);
- }
+ EXPECT_CALL(visitor_,
+ OnConnectionClosed(QUIC_INVALID_STOP_WAITING_DATA, false));
+ QuicStopWaitingFrame frame3 = InitStopWaitingFrame(1);
+ ProcessStopWaitingPacket(&frame3);
}
TEST_P(QuicConnectionTest, LargestObservedLower) {
@@ -1296,8 +1276,8 @@ TEST_P(QuicConnectionTest, LargestObservedLower) {
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
// Start out saying the largest observed is 2.
- QuicAckFrame frame1 = InitAckFrame(1, 0);
- QuicAckFrame frame2 = InitAckFrame(2, 0);
+ QuicAckFrame frame1 = InitAckFrame(1);
+ QuicAckFrame frame2 = InitAckFrame(2);
ProcessAckPacket(&frame2);
// Now change it to 1, and it should cause a connection error.
@@ -1311,7 +1291,7 @@ TEST_P(QuicConnectionTest, AckUnsentData) {
EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_INVALID_ACK_DATA, false));
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
- QuicAckFrame frame(MakeAckFrame(1, 0));
+ QuicAckFrame frame(MakeAckFrame(1));
EXPECT_CALL(visitor_, OnCanWrite()).Times(0);
ProcessAckPacket(&frame);
}
@@ -1321,7 +1301,7 @@ TEST_P(QuicConnectionTest, AckAll) {
ProcessPacket(1);
peer_creator_.set_sequence_number(1);
- QuicAckFrame frame1 = InitAckFrame(0, 1);
+ QuicAckFrame frame1 = InitAckFrame(0);
ProcessAckPacket(&frame1);
}
@@ -1443,7 +1423,7 @@ TEST_P(QuicConnectionTest, BasicSending) {
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
// Peer acks up to packet 3.
- QuicAckFrame frame = InitAckFrame(3, 0);
+ QuicAckFrame frame = InitAckFrame(3);
ProcessAckPacket(&frame);
SendAckPacketToPeer(); // Packet 6
@@ -1454,7 +1434,7 @@ TEST_P(QuicConnectionTest, BasicSending) {
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
// Peer acks up to packet 4, the last packet.
- QuicAckFrame frame2 = InitAckFrame(6, 0);
+ QuicAckFrame frame2 = InitAckFrame(6);
ProcessAckPacket(&frame2); // Acks don't instigate acks.
// Verify that we did not send an ack.
@@ -1551,7 +1531,7 @@ TEST_P(QuicConnectionTest, DontAbandonAckedFEC) {
connection_.SendStreamDataWithStringWithFec(3, "foo", 3, !kFin, NULL);
connection_.SendStreamDataWithStringWithFec(3, "foo", 6, !kFin, NULL);
- QuicAckFrame ack_fec = InitAckFrame(2, 1);
+ QuicAckFrame ack_fec = InitAckFrame(2);
// Data packet missing.
// TODO(ianswett): Note that this is not a sensible ack, since if the FEC was
// received, it would cause the covered packet to be acked as well.
@@ -1581,7 +1561,7 @@ TEST_P(QuicConnectionTest, AbandonAllFEC) {
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1));
connection_.SendStreamDataWithStringWithFec(3, "foo", 6, !kFin, NULL);
- QuicAckFrame ack_fec = InitAckFrame(5, 1);
+ QuicAckFrame ack_fec = InitAckFrame(5);
// Ack all data packets, but no fec packets.
NackPacket(2, &ack_fec);
NackPacket(4, &ack_fec);
@@ -1624,12 +1604,8 @@ TEST_P(QuicConnectionTest, FramePacking) {
// Parse the last packet and ensure it's an ack and two stream frames from
// two different streams.
- if (version() > QUIC_VERSION_15) {
- EXPECT_EQ(4u, writer_->frame_count());
- EXPECT_FALSE(writer_->stop_waiting_frames().empty());
- } else {
- EXPECT_EQ(3u, writer_->frame_count());
- }
+ EXPECT_EQ(4u, writer_->frame_count());
+ EXPECT_FALSE(writer_->stop_waiting_frames().empty());
EXPECT_FALSE(writer_->ack_frames().empty());
ASSERT_EQ(2u, writer_->stream_frames().size());
EXPECT_EQ(kClientDataStreamId1, writer_->stream_frames()[0].stream_id);
@@ -1726,7 +1702,7 @@ TEST_P(QuicConnectionTest, FramePackingAckResponse) {
// Process an ack to cause the visitor's OnCanWrite to be invoked.
peer_creator_.set_sequence_number(2);
- QuicAckFrame ack_one = InitAckFrame(0, 0);
+ QuicAckFrame ack_one = InitAckFrame(0);
ProcessAckPacket(&ack_one);
EXPECT_EQ(0u, connection_.NumQueuedPackets());
@@ -1734,12 +1710,8 @@ TEST_P(QuicConnectionTest, FramePackingAckResponse) {
// Parse the last packet and ensure it's an ack and two stream frames from
// two different streams.
- if (version() > QUIC_VERSION_15) {
- EXPECT_EQ(4u, writer_->frame_count());
- EXPECT_FALSE(writer_->stop_waiting_frames().empty());
- } else {
- EXPECT_EQ(3u, writer_->frame_count());
- }
+ EXPECT_EQ(4u, writer_->frame_count());
+ EXPECT_FALSE(writer_->stop_waiting_frames().empty());
EXPECT_FALSE(writer_->ack_frames().empty());
ASSERT_EQ(2u, writer_->stream_frames().size());
EXPECT_EQ(kClientDataStreamId1, writer_->stream_frames()[0].stream_id);
@@ -1846,11 +1818,11 @@ TEST_P(QuicConnectionTest, RetransmitOnNack) {
// Don't lose a packet on an ack, and nothing is retransmitted.
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- QuicAckFrame ack_one = InitAckFrame(1, 0);
+ QuicAckFrame ack_one = InitAckFrame(1);
ProcessAckPacket(&ack_one);
// Lose a packet and ensure it triggers retransmission.
- QuicAckFrame nack_two = InitAckFrame(3, 0);
+ QuicAckFrame nack_two = InitAckFrame(3);
NackPacket(2, &nack_two);
SequenceNumberSet lost_packets;
lost_packets.insert(2);
@@ -1872,7 +1844,7 @@ TEST_P(QuicConnectionTest, DiscardRetransmit) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
// Instigate a loss with an ack.
- QuicAckFrame nack_two = InitAckFrame(3, 0);
+ QuicAckFrame nack_two = InitAckFrame(3);
NackPacket(2, &nack_two);
// The first nack should trigger a fast retransmission, but we'll be
// write blocked, so the packet will be queued.
@@ -1888,7 +1860,7 @@ TEST_P(QuicConnectionTest, DiscardRetransmit) {
// Now, ack the previous transmission.
EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
.WillOnce(Return(SequenceNumberSet()));
- QuicAckFrame ack_all = InitAckFrame(3, 0);
+ QuicAckFrame ack_all = InitAckFrame(3);
ProcessAckPacket(&ack_all);
// Unblock the socket and attempt to send the queued packets. However,
@@ -1912,7 +1884,7 @@ TEST_P(QuicConnectionTest, RetransmitNackedLargestObserved) {
Return(true)));
connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL);
- QuicAckFrame frame = InitAckFrame(1, largest_observed);
+ QuicAckFrame frame = InitAckFrame(1);
NackPacket(largest_observed, &frame);
// The first nack should retransmit the largest observed packet.
SequenceNumberSet lost_packets;
@@ -1970,7 +1942,7 @@ TEST_P(QuicConnectionTest, WriteBlockedAckedThenSent) {
// Ack the sent packet before the callback returns, which happens in
// rare circumstances with write blocked sockets.
- QuicAckFrame ack = InitAckFrame(1, 0);
+ QuicAckFrame ack = InitAckFrame(1);
ProcessAckPacket(&ack);
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0);
@@ -1992,7 +1964,7 @@ TEST_P(QuicConnectionTest, RetransmitWriteBlockedAckedOriginalThenSent) {
// Ack the sent packet before the callback returns, which happens in
// rare circumstances with write blocked sockets.
- QuicAckFrame ack = InitAckFrame(1, 0);
+ QuicAckFrame ack = InitAckFrame(1);
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
EXPECT_CALL(*send_algorithm_, RevertRetransmissionTimeout());
ProcessAckPacket(&ack);
@@ -2031,7 +2003,7 @@ TEST_P(QuicConnectionTest, NoLimitPacketsPerNack) {
// Ack 15, nack 1-14.
SequenceNumberSet lost_packets;
- QuicAckFrame nack = InitAckFrame(15, 0);
+ QuicAckFrame nack = InitAckFrame(15);
for (int i = 1; i < 15; ++i) {
NackPacket(i, &nack);
lost_packets.insert(i);
@@ -2063,14 +2035,14 @@ TEST_P(QuicConnectionTest, MultipleAcks) {
// Client will ack packets 1, 2, [!3], 4, 5.
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- QuicAckFrame frame1 = InitAckFrame(5, 0);
+ QuicAckFrame frame1 = InitAckFrame(5);
NackPacket(3, &frame1);
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
ProcessAckPacket(&frame1);
// Now the client implicitly acks 3, and explicitly acks 6.
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- QuicAckFrame frame2 = InitAckFrame(6, 0);
+ QuicAckFrame frame2 = InitAckFrame(6);
ProcessAckPacket(&frame2);
}
@@ -2083,36 +2055,37 @@ TEST_P(QuicConnectionTest, DontLatchUnackedPacket) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- QuicAckFrame frame = InitAckFrame(1, 0);
+ QuicAckFrame frame = InitAckFrame(1);
ProcessAckPacket(&frame);
// Verify that our internal state has least-unacked as 2, because we're still
// waiting for a potential ack for 2.
- EXPECT_EQ(2u, outgoing_ack()->sent_info.least_unacked);
+
+ EXPECT_EQ(2u, stop_waiting()->least_unacked);
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- frame = InitAckFrame(2, 0);
+ frame = InitAckFrame(2);
ProcessAckPacket(&frame);
- EXPECT_EQ(3u, outgoing_ack()->sent_info.least_unacked);
+ EXPECT_EQ(3u, stop_waiting()->least_unacked);
// When we send an ack, we make sure our least-unacked makes sense. In this
// case since we're not waiting on an ack for 2 and all packets are acked, we
// set it to 3.
SendAckPacketToPeer(); // Packet 3
// Least_unacked remains at 3 until another ack is received.
- EXPECT_EQ(3u, outgoing_ack()->sent_info.least_unacked);
+ EXPECT_EQ(3u, stop_waiting()->least_unacked);
// Check that the outgoing ack had its sequence number as least_unacked.
EXPECT_EQ(3u, least_unacked());
// Ack the ack, which updates the rtt and raises the least unacked.
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- frame = InitAckFrame(3, 0);
+ frame = InitAckFrame(3);
ProcessAckPacket(&frame);
ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
.WillByDefault(Return(true));
SendStreamDataToPeer(1, "bar", 3, false, NULL); // Packet 4
- EXPECT_EQ(4u, outgoing_ack()->sent_info.least_unacked);
+ EXPECT_EQ(4u, stop_waiting()->least_unacked);
ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
.WillByDefault(Return(false));
SendAckPacketToPeer(); // Packet 5
@@ -2126,12 +2099,12 @@ TEST_P(QuicConnectionTest, DontLatchUnackedPacket) {
SendStreamDataToPeer(1, "bar", 9, false, NULL); // Packet 7
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- frame = InitAckFrame(7, 0);
+ frame = InitAckFrame(7);
NackPacket(5, &frame);
NackPacket(6, &frame);
ProcessAckPacket(&frame);
- EXPECT_EQ(6u, outgoing_ack()->sent_info.least_unacked);
+ EXPECT_EQ(6u, stop_waiting()->least_unacked);
}
TEST_P(QuicConnectionTest, ReviveMissingPacketAfterFecPacket) {
@@ -2251,7 +2224,7 @@ TEST_P(QuicConnectionTest, TLP) {
QuicConnectionPeer::GetSentPacketManager(&connection_), 1);
SendStreamDataToPeer(3, "foo", 0, !kFin, NULL);
- EXPECT_EQ(1u, outgoing_ack()->sent_info.least_unacked);
+ EXPECT_EQ(1u, stop_waiting()->least_unacked);
QuicTime retransmission_time =
connection_.GetRetransmissionAlarm()->deadline();
EXPECT_NE(QuicTime::Zero(), retransmission_time);
@@ -2264,14 +2237,14 @@ TEST_P(QuicConnectionTest, TLP) {
connection_.GetRetransmissionAlarm()->Fire();
EXPECT_EQ(2u, writer_->header().packet_sequence_number);
// We do not raise the high water mark yet.
- EXPECT_EQ(1u, outgoing_ack()->sent_info.least_unacked);
+ EXPECT_EQ(1u, stop_waiting()->least_unacked);
}
TEST_P(QuicConnectionTest, RTO) {
QuicTime default_retransmission_time = clock_.ApproximateNow().Add(
DefaultRetransmissionTime());
SendStreamDataToPeer(3, "foo", 0, !kFin, NULL);
- EXPECT_EQ(1u, outgoing_ack()->sent_info.least_unacked);
+ EXPECT_EQ(1u, stop_waiting()->least_unacked);
EXPECT_EQ(1u, writer_->header().packet_sequence_number);
EXPECT_EQ(default_retransmission_time,
@@ -2283,7 +2256,7 @@ TEST_P(QuicConnectionTest, RTO) {
connection_.GetRetransmissionAlarm()->Fire();
EXPECT_EQ(2u, writer_->header().packet_sequence_number);
// We do not raise the high water mark yet.
- EXPECT_EQ(1u, outgoing_ack()->sent_info.least_unacked);
+ EXPECT_EQ(1u, stop_waiting()->least_unacked);
}
TEST_P(QuicConnectionTest, RTOWithSameEncryptionLevel) {
@@ -2494,7 +2467,7 @@ TEST_P(QuicConnectionTest, RetransmissionCountCalculation) {
.Times(AnyNumber());
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
.WillOnce(DoAll(SaveArg<2>(&nack_sequence_number), Return(true)));
- QuicAckFrame ack = InitAckFrame(rto_sequence_number, 0);
+ QuicAckFrame ack = InitAckFrame(rto_sequence_number);
// Nack the retransmitted packet.
NackPacket(original_sequence_number, &ack);
NackPacket(rto_sequence_number, &ack);
@@ -2536,7 +2509,7 @@ TEST_P(QuicConnectionTest, DelayRTOWithAckReceipt) {
// packet to delay the RTO.
clock_.AdvanceTime(DefaultRetransmissionTime());
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- QuicAckFrame ack = InitAckFrame(1, 0);
+ QuicAckFrame ack = InitAckFrame(1);
ProcessAckPacket(&ack);
EXPECT_TRUE(retransmission_alarm->IsSet());
EXPECT_GT(retransmission_alarm->deadline(), clock_.Now());
@@ -2583,13 +2556,8 @@ TEST_P(QuicConnectionTest, CloseFecGroup) {
// Now send non-fec protected ack packet and close the group.
peer_creator_.set_sequence_number(4);
- if (version() > QUIC_VERSION_15) {
- QuicStopWaitingFrame frame = InitStopWaitingFrame(5);
- ProcessStopWaitingPacket(&frame);
- } else {
- QuicAckFrame frame = InitAckFrame(0, 5);
- ProcessAckPacket(&frame);
- }
+ QuicStopWaitingFrame frame = InitStopWaitingFrame(5);
+ ProcessStopWaitingPacket(&frame);
ASSERT_EQ(0u, connection_.NumFecGroups());
}
@@ -2668,7 +2636,7 @@ TEST_P(QuicConnectionTest, PingAfterSend) {
// Now recevie and ACK of the previous packet, which will move the
// ping alarm forward.
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5));
- QuicAckFrame frame = InitAckFrame(1, 0);
+ QuicAckFrame frame = InitAckFrame(1);
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
ProcessAckPacket(&frame);
@@ -2842,7 +2810,7 @@ TEST_P(QuicConnectionTest, SendSchedulerDelayThenAckAndSend) {
// Now send non-retransmitting information, that we're not going to
// retransmit 3. The far end should stop waiting for it.
- QuicAckFrame frame = InitAckFrame(0, 1);
+ QuicAckFrame frame = InitAckFrame(0);
EXPECT_CALL(*send_algorithm_,
TimeUntilSend(_, _, _)).WillRepeatedly(
testing::Return(QuicTime::Delta::Zero()));
@@ -2867,7 +2835,7 @@ TEST_P(QuicConnectionTest, SendSchedulerDelayThenAckAndHold) {
// Now send non-retransmitting information, that we're not going to
// retransmit 3. The far end should stop waiting for it.
- QuicAckFrame frame = InitAckFrame(0, 1);
+ QuicAckFrame frame = InitAckFrame(0);
EXPECT_CALL(*send_algorithm_,
TimeUntilSend(_, _, _)).WillOnce(
testing::Return(QuicTime::Delta::FromMicroseconds(1)));
@@ -2956,12 +2924,8 @@ TEST_P(QuicConnectionTest, SendDelayedAck) {
// Simulate delayed ack alarm firing.
connection_.GetAckAlarm()->Fire();
// Check that ack is sent and that delayed ack alarm is reset.
- if (version() > QUIC_VERSION_15) {
- EXPECT_EQ(2u, writer_->frame_count());
- EXPECT_FALSE(writer_->stop_waiting_frames().empty());
- } else {
- EXPECT_EQ(1u, writer_->frame_count());
- }
+ EXPECT_EQ(2u, writer_->frame_count());
+ EXPECT_FALSE(writer_->stop_waiting_frames().empty());
EXPECT_FALSE(writer_->ack_frames().empty());
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
}
@@ -2978,12 +2942,8 @@ TEST_P(QuicConnectionTest, SendEarlyDelayedAckForCrypto) {
// Simulate delayed ack alarm firing.
connection_.GetAckAlarm()->Fire();
// Check that ack is sent and that delayed ack alarm is reset.
- if (version() > QUIC_VERSION_15) {
- EXPECT_EQ(2u, writer_->frame_count());
- EXPECT_FALSE(writer_->stop_waiting_frames().empty());
- } else {
- EXPECT_EQ(1u, writer_->frame_count());
- }
+ EXPECT_EQ(2u, writer_->frame_count());
+ EXPECT_FALSE(writer_->stop_waiting_frames().empty());
EXPECT_FALSE(writer_->ack_frames().empty());
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
}
@@ -2993,12 +2953,8 @@ TEST_P(QuicConnectionTest, SendDelayedAckOnSecondPacket) {
ProcessPacket(1);
ProcessPacket(2);
// Check that ack is sent and that delayed ack alarm is reset.
- if (version() > QUIC_VERSION_15) {
- EXPECT_EQ(2u, writer_->frame_count());
- EXPECT_FALSE(writer_->stop_waiting_frames().empty());
- } else {
- EXPECT_EQ(1u, writer_->frame_count());
- }
+ EXPECT_EQ(2u, writer_->frame_count());
+ EXPECT_FALSE(writer_->stop_waiting_frames().empty());
EXPECT_FALSE(writer_->ack_frames().empty());
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
}
@@ -3007,7 +2963,7 @@ TEST_P(QuicConnectionTest, NoAckOnOldNacks) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
// Drop one packet, triggering a sequence of acks.
ProcessPacket(2);
- size_t frames_per_ack = version() > QUIC_VERSION_15 ? 2 : 1;
+ size_t frames_per_ack = 2;
EXPECT_EQ(frames_per_ack, writer_->frame_count());
EXPECT_FALSE(writer_->ack_frames().empty());
writer_->Reset();
@@ -3036,12 +2992,8 @@ TEST_P(QuicConnectionTest, SendDelayedAckOnOutgoingPacket) {
!kFin, NULL);
// Check that ack is bundled with outgoing data and that delayed ack
// alarm is reset.
- if (version() > QUIC_VERSION_15) {
- EXPECT_EQ(3u, writer_->frame_count());
- EXPECT_FALSE(writer_->stop_waiting_frames().empty());
- } else {
- EXPECT_EQ(2u, writer_->frame_count());
- }
+ EXPECT_EQ(3u, writer_->frame_count());
+ EXPECT_FALSE(writer_->stop_waiting_frames().empty());
EXPECT_FALSE(writer_->ack_frames().empty());
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
}
@@ -3051,7 +3003,7 @@ TEST_P(QuicConnectionTest, SendDelayedAckOnOutgoingCryptoPacket) {
ProcessPacket(1);
connection_.SendStreamDataWithString(kCryptoStreamId, "foo", 0, !kFin, NULL);
// Check that ack is bundled with outgoing crypto data.
- EXPECT_EQ(version() <= QUIC_VERSION_15 ? 2u : 3u, writer_->frame_count());
+ EXPECT_EQ(3u, writer_->frame_count());
EXPECT_FALSE(writer_->ack_frames().empty());
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
}
@@ -3067,12 +3019,8 @@ TEST_P(QuicConnectionTest, BundleAckForSecondCHLO) {
// immediately send an ack, due to the packet gap.
ProcessPacket(2);
// Check that ack is sent and that delayed ack alarm is reset.
- if (version() > QUIC_VERSION_15) {
- EXPECT_EQ(3u, writer_->frame_count());
- EXPECT_FALSE(writer_->stop_waiting_frames().empty());
- } else {
- EXPECT_EQ(2u, writer_->frame_count());
- }
+ EXPECT_EQ(3u, writer_->frame_count());
+ EXPECT_FALSE(writer_->stop_waiting_frames().empty());
EXPECT_EQ(1u, writer_->stream_frames().size());
EXPECT_FALSE(writer_->ack_frames().empty());
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
@@ -3085,7 +3033,7 @@ TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) {
connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 3,
!kFin, NULL);
// Ack the second packet, which will retransmit the first packet.
- QuicAckFrame ack = InitAckFrame(2, 0);
+ QuicAckFrame ack = InitAckFrame(2);
NackPacket(1, &ack);
SequenceNumberSet lost_packets;
lost_packets.insert(1);
@@ -3099,7 +3047,7 @@ TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) {
// Now ack the retransmission, which will both raise the high water mark
// and see if there is more data to send.
- ack = InitAckFrame(3, 0);
+ ack = InitAckFrame(3);
NackPacket(1, &ack);
EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
.WillOnce(Return(SequenceNumberSet()));
@@ -3112,7 +3060,7 @@ TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) {
writer_->Reset();
// Send the same ack, but send both data and an ack together.
- ack = InitAckFrame(3, 0);
+ ack = InitAckFrame(3);
NackPacket(1, &ack);
EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
.WillOnce(Return(SequenceNumberSet()));
@@ -3124,12 +3072,8 @@ TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) {
// Check that ack is bundled with outgoing data and the delayed ack
// alarm is reset.
- if (version() > QUIC_VERSION_15) {
- EXPECT_EQ(3u, writer_->frame_count());
- EXPECT_FALSE(writer_->stop_waiting_frames().empty());
- } else {
- EXPECT_EQ(2u, writer_->frame_count());
- }
+ EXPECT_EQ(3u, writer_->frame_count());
+ EXPECT_FALSE(writer_->stop_waiting_frames().empty());
EXPECT_FALSE(writer_->ack_frames().empty());
EXPECT_EQ(1u, writer_->stream_frames().size());
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
@@ -3211,13 +3155,8 @@ TEST_P(QuicConnectionTest, MissingPacketsBeforeLeastUnacked) {
// Set the sequence number of the ack packet to be least unacked (4).
peer_creator_.set_sequence_number(3);
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- if (version() > QUIC_VERSION_15) {
- QuicStopWaitingFrame frame = InitStopWaitingFrame(4);
- ProcessStopWaitingPacket(&frame);
- } else {
- QuicAckFrame ack = InitAckFrame(0, 4);
- ProcessAckPacket(&ack);
- }
+ QuicStopWaitingFrame frame = InitStopWaitingFrame(4);
+ ProcessStopWaitingPacket(&frame);
EXPECT_TRUE(outgoing_ack()->received_info.missing_packets.empty());
}
@@ -3253,18 +3192,10 @@ TEST_P(QuicConnectionTest, UpdateEntropyForReceivedPackets) {
peer_creator_.set_sequence_number(5);
QuicPacketEntropyHash six_packet_entropy_hash = 0;
QuicPacketEntropyHash kRandomEntropyHash = 129u;
- if (version() > QUIC_VERSION_15) {
- QuicStopWaitingFrame frame = InitStopWaitingFrame(4);
- frame.entropy_hash = kRandomEntropyHash;
- if (ProcessStopWaitingPacket(&frame)) {
- six_packet_entropy_hash = 1 << 6;
- }
- } else {
- QuicAckFrame ack = InitAckFrame(0, 4);
- ack.sent_info.entropy_hash = kRandomEntropyHash;
- if (ProcessAckPacket(&ack)) {
- six_packet_entropy_hash = 1 << 6;
- }
+ QuicStopWaitingFrame frame = InitStopWaitingFrame(4);
+ frame.entropy_hash = kRandomEntropyHash;
+ if (ProcessStopWaitingPacket(&frame)) {
+ six_packet_entropy_hash = 1 << 6;
}
EXPECT_EQ((kRandomEntropyHash + (1 << 5) + six_packet_entropy_hash),
@@ -3282,15 +3213,9 @@ TEST_P(QuicConnectionTest, UpdateEntropyHashUptoCurrentPacket) {
QuicPacketEntropyHash kRandomEntropyHash = 85u;
// Current packet is the least unacked packet.
QuicPacketEntropyHash ack_entropy_hash;
- if (version() > QUIC_VERSION_15) {
- QuicStopWaitingFrame frame = InitStopWaitingFrame(23);
- frame.entropy_hash = kRandomEntropyHash;
- ack_entropy_hash = ProcessStopWaitingPacket(&frame);
- } else {
- QuicAckFrame ack = InitAckFrame(0, 23);
- ack.sent_info.entropy_hash = kRandomEntropyHash;
- ack_entropy_hash = ProcessAckPacket(&ack);
- }
+ QuicStopWaitingFrame frame = InitStopWaitingFrame(23);
+ frame.entropy_hash = kRandomEntropyHash;
+ ack_entropy_hash = ProcessStopWaitingPacket(&frame);
EXPECT_EQ((kRandomEntropyHash + ack_entropy_hash),
outgoing_ack()->received_info.entropy_hash);
ProcessDataPacket(25, 1, kEntropyFlag);
@@ -3551,7 +3476,7 @@ TEST_P(QuicConnectionTest, CheckSendStats) {
connection_.GetRetransmissionAlarm()->Fire();
// Retransmit due to explicit nacks.
- QuicAckFrame nack_three = InitAckFrame(4, 0);
+ QuicAckFrame nack_three = InitAckFrame(4);
NackPacket(3, &nack_three);
NackPacket(1, &nack_three);
SequenceNumberSet lost_packets;
@@ -3735,7 +3660,7 @@ TEST_P(QuicConnectionTest, AckNotifierTriggerCallback) {
// Process an ACK from the server which should trigger the callback.
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- QuicAckFrame frame = InitAckFrame(1, 0);
+ QuicAckFrame frame = InitAckFrame(1);
ProcessAckPacket(&frame);
}
@@ -3756,7 +3681,7 @@ TEST_P(QuicConnectionTest, AckNotifierFailToTriggerCallback) {
// Now we receive ACK for packets 2 and 3, but importantly missing packet 1
// which we registered to be notified about.
- QuicAckFrame frame = InitAckFrame(3, 0);
+ QuicAckFrame frame = InitAckFrame(3);
NackPacket(1, &frame);
SequenceNumberSet lost_packets;
lost_packets.insert(1);
@@ -3780,7 +3705,7 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackAfterRetransmission) {
connection_.SendStreamDataWithString(3, "qux", 0, !kFin, NULL);
// Now we receive ACK for packets 1, 3, and 4 and lose 2.
- QuicAckFrame frame = InitAckFrame(4, 0);
+ QuicAckFrame frame = InitAckFrame(4);
NackPacket(2, &frame);
SequenceNumberSet lost_packets;
lost_packets.insert(2);
@@ -3795,7 +3720,7 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackAfterRetransmission) {
EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
.WillRepeatedly(Return(SequenceNumberSet()));
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- QuicAckFrame second_ack_frame = InitAckFrame(5, 0);
+ QuicAckFrame second_ack_frame = InitAckFrame(5);
ProcessAckPacket(&second_ack_frame);
}
@@ -3812,7 +3737,7 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackForAckAfterRTO) {
QuicTime default_retransmission_time = clock_.ApproximateNow().Add(
DefaultRetransmissionTime());
connection_.SendStreamDataWithString(3, "foo", 0, !kFin, delegate.get());
- EXPECT_EQ(1u, outgoing_ack()->sent_info.least_unacked);
+ EXPECT_EQ(1u, stop_waiting()->least_unacked);
EXPECT_EQ(1u, writer_->header().packet_sequence_number);
EXPECT_EQ(default_retransmission_time,
@@ -3824,19 +3749,19 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackForAckAfterRTO) {
connection_.GetRetransmissionAlarm()->Fire();
EXPECT_EQ(2u, writer_->header().packet_sequence_number);
// We do not raise the high water mark yet.
- EXPECT_EQ(1u, outgoing_ack()->sent_info.least_unacked);
+ EXPECT_EQ(1u, stop_waiting()->least_unacked);
// Ack the original packet, which will revert the RTO.
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
EXPECT_CALL(*delegate, OnAckNotification(1, _, 1, _, _));
EXPECT_CALL(*send_algorithm_, RevertRetransmissionTimeout());
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- QuicAckFrame ack_frame = InitAckFrame(1, 0);
+ QuicAckFrame ack_frame = InitAckFrame(1);
ProcessAckPacket(&ack_frame);
// Delegate is not notified again when the retransmit is acked.
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- QuicAckFrame second_ack_frame = InitAckFrame(2, 0);
+ QuicAckFrame second_ack_frame = InitAckFrame(2);
ProcessAckPacket(&second_ack_frame);
}
@@ -3857,7 +3782,7 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackForAckOfNackedPacket) {
connection_.SendStreamDataWithString(3, "qux", 0, !kFin, NULL);
// Now we receive ACK for packets 1, 3, and 4 and lose 2.
- QuicAckFrame frame = InitAckFrame(4, 0);
+ QuicAckFrame frame = InitAckFrame(4);
NackPacket(2, &frame);
SequenceNumberSet lost_packets;
lost_packets.insert(2);
@@ -3873,7 +3798,7 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackForAckOfNackedPacket) {
EXPECT_CALL(*delegate, OnAckNotification(1, _, 1, _, _));
EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
.WillOnce(Return(no_lost_packets));
- QuicAckFrame second_ack_frame = InitAckFrame(4, 0);
+ QuicAckFrame second_ack_frame = InitAckFrame(4);
ProcessAckPacket(&second_ack_frame);
// Verify that the delegate is not notified again when the
@@ -3881,7 +3806,7 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackForAckOfNackedPacket) {
EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
.WillOnce(Return(no_lost_packets));
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- QuicAckFrame third_ack_frame = InitAckFrame(5, 0);
+ QuicAckFrame third_ack_frame = InitAckFrame(5);
ProcessAckPacket(&third_ack_frame);
}
@@ -3900,7 +3825,7 @@ TEST_P(QuicConnectionTest, AckNotifierFECTriggerCallback) {
// Process an ACK from the server with a revived packet, which should trigger
// the callback.
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
- QuicAckFrame frame = InitAckFrame(2, 0);
+ QuicAckFrame frame = InitAckFrame(2);
NackPacket(1, &frame);
frame.received_info.revived_packets.insert(1);
ProcessAckPacket(&frame);
@@ -3926,7 +3851,7 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackAfterFECRecovery) {
// Should recover the Ack packet and trigger the notification callback.
QuicFrames frames;
- QuicAckFrame ack_frame = InitAckFrame(1, 0);
+ QuicAckFrame ack_frame = InitAckFrame(1);
frames.push_back(QuicFrame(&ack_frame));
// Dummy stream frame to satisfy expectations set elsewhere.
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698