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

Unified Diff: net/quic/quic_connection_test.cc

Issue 512933005: Fix a QUIC bug in which PING frames were not being ACK'd. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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') | no next file » | 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 5befba789063c8ffd551fe2a6115df1dea2f16ed..c137db9c3c177afcccbbd218f9be83e401ba95e4 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -733,6 +733,13 @@ class QuicConnectionTest : public ::testing::TestWithParam<QuicVersion> {
return encrypted->length();
}
+ void ProcessPingPacket(QuicPacketSequenceNumber number) {
+ scoped_ptr<QuicPacket> packet(ConstructPingPacket(number));
+ scoped_ptr<QuicEncryptedPacket> encrypted(framer_.EncryptPacket(
+ ENCRYPTION_NONE, number, *packet));
+ connection_.ProcessUdpPacket(IPEndPoint(), IPEndPoint(), *encrypted);
+ }
+
void ProcessClosePacket(QuicPacketSequenceNumber number,
QuicFecGroupNumber fec_group) {
scoped_ptr<QuicPacket> packet(ConstructClosePacket(number, fec_group));
@@ -872,6 +879,27 @@ class QuicConnectionTest : public ::testing::TestWithParam<QuicVersion> {
return packet;
}
+ QuicPacket* ConstructPingPacket(QuicPacketSequenceNumber number) {
+ header_.public_header.connection_id = connection_id_;
+ header_.packet_sequence_number = number;
+ header_.public_header.reset_flag = false;
+ header_.public_header.version_flag = false;
+ header_.entropy_flag = false;
+ header_.fec_flag = false;
+ header_.is_in_fec_group = NOT_IN_FEC_GROUP;
+ header_.fec_group = 0;
+
+ QuicPingFrame ping;
+
+ QuicFrames frames;
+ QuicFrame frame(&ping);
+ frames.push_back(frame);
+ QuicPacket* packet =
+ BuildUnsizedDataPacket(&framer_, header_, frames).packet;
+ EXPECT_TRUE(packet != NULL);
+ return packet;
+ }
+
QuicPacket* ConstructClosePacket(QuicPacketSequenceNumber number,
QuicFecGroupNumber fec_group) {
header_.public_header.connection_id = connection_id_;
@@ -2967,6 +2995,16 @@ TEST_P(QuicConnectionTest, SendDelayedAckOnSecondPacket) {
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
}
+TEST_P(QuicConnectionTest, SendDelayedAckForPing) {
+ if (version() < QUIC_VERSION_18) {
+ return;
+ }
+ EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
+ EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
+ ProcessPingPacket(1);
+ EXPECT_TRUE(connection_.GetAckAlarm()->IsSet());
+}
+
TEST_P(QuicConnectionTest, NoAckOnOldNacks) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
// Drop one packet, triggering a sequence of acks.
« no previous file with comments | « net/quic/quic_connection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698