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

Unified Diff: net/quic/quic_connection_test.cc

Issue 113123004: Change QUIC to only ack every other packet when there are no losses (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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_received_packet_manager.h » ('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 c35918bc0f918b64bbc5668eeb33448d860435ad..39655d0fe2a73277fe37afeb4a0e347d0da83646 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -313,6 +313,11 @@ class TestPacketWriter : public QuicPacketWriter {
return is_write_blocked_data_buffered_;
}
+ // Resets the visitor's state by clearing out the headers and frames.
+ void Reset() {
+ visitor_.Reset();
+ }
+
QuicPacketHeader* header() { return visitor_.header(); }
size_t frame_count() const { return visitor_.frame_count(); }
@@ -2610,6 +2615,31 @@ TEST_F(QuicConnectionTest, SendDelayedAckOnSecondPacket) {
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
}
+TEST_F(QuicConnectionTest, NoAckOnOldNacks) {
+ EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
+ // Drop one packet, triggering a sequence of acks.
+ ProcessPacket(2);
+ EXPECT_EQ(1u, writer_->frame_count());
+ EXPECT_TRUE(writer_->ack());
+ writer_->Reset();
+ ProcessPacket(3);
+ EXPECT_EQ(1u, writer_->frame_count());
+ EXPECT_TRUE(writer_->ack());
+ writer_->Reset();
+ ProcessPacket(4);
+ EXPECT_EQ(1u, writer_->frame_count());
+ EXPECT_TRUE(writer_->ack());
+ writer_->Reset();
+ ProcessPacket(5);
+ EXPECT_EQ(1u, writer_->frame_count());
+ EXPECT_TRUE(writer_->ack());
+ // Now only set the timer on the 6th packet, instead of sending another ack.
+ writer_->Reset();
+ ProcessPacket(6);
+ EXPECT_EQ(0u, writer_->frame_count());
+ EXPECT_TRUE(connection_.GetAckAlarm()->IsSet());
+}
+
TEST_F(QuicConnectionTest, SendDelayedAckOnOutgoingPacket) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
ProcessPacket(1);
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_received_packet_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698