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

Unified Diff: net/quic/quic_connection_test.cc

Issue 1531543004: Fix a bug protected by gfe2_reloadable_flag_quic_respect_send_alarm where acks would not be sent im… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@110021608
Patch Set: Created 5 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_flags.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 22bf390aaddca65837dc02584f08fca365dd9b53..fcee1772de20db12d2fe9203046f09d573c1a6ef 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -1383,9 +1383,10 @@ TEST_P(QuicConnectionTest, AckReceiptCausesAckSendBadEntropy) {
ProcessPacket(1);
// Delay sending, then queue up an ack.
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillOnce(
- testing::Return(QuicTime::Delta::FromMicroseconds(1)));
+ if (!FLAGS_quic_respect_send_alarm2) {
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillOnce(testing::Return(QuicTime::Delta::FromMicroseconds(1)));
+ }
QuicConnectionPeer::SendAck(&connection_);
// Process an ack with a least unacked of the received ack.
@@ -2219,19 +2220,14 @@ TEST_P(QuicConnectionTest, NoTLPForFECPacket) {
}
TEST_P(QuicConnectionTest, FramePacking) {
- CongestionBlockWrites();
-
// Send an ack and two stream frames in 1 packet by queueing them.
- connection_.SendAck();
- EXPECT_CALL(visitor_, OnCanWrite()).WillOnce(DoAll(
- IgnoreResult(InvokeWithoutArgs(&connection_,
- &TestConnection::SendStreamData3)),
- IgnoreResult(InvokeWithoutArgs(&connection_,
- &TestConnection::SendStreamData5))));
-
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
- CongestionUnblockWrites();
- connection_.GetSendAlarm()->Fire();
+ {
+ QuicConnection::ScopedPacketBundler bundler(&connection_,
+ QuicConnection::SEND_ACK);
+ connection_.SendStreamData3();
+ connection_.SendStreamData5();
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
+ }
EXPECT_EQ(0u, connection_.NumQueuedPackets());
EXPECT_FALSE(connection_.HasQueuedData());
@@ -2246,20 +2242,15 @@ TEST_P(QuicConnectionTest, FramePacking) {
}
TEST_P(QuicConnectionTest, FramePackingNonCryptoThenCrypto) {
- CongestionBlockWrites();
-
// Send an ack and two stream frames (one non-crypto, then one crypto) in 2
// packets by queueing them.
- connection_.SendAck();
- EXPECT_CALL(visitor_, OnCanWrite()).WillOnce(DoAll(
- IgnoreResult(InvokeWithoutArgs(&connection_,
- &TestConnection::SendStreamData3)),
- IgnoreResult(InvokeWithoutArgs(&connection_,
- &TestConnection::SendCryptoStreamData))));
-
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
- CongestionUnblockWrites();
- connection_.GetSendAlarm()->Fire();
+ {
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
+ QuicConnection::ScopedPacketBundler bundler(&connection_,
+ QuicConnection::SEND_ACK);
+ connection_.SendStreamData3();
+ connection_.SendCryptoStreamData();
+ }
EXPECT_EQ(0u, connection_.NumQueuedPackets());
EXPECT_FALSE(connection_.HasQueuedData());
@@ -2270,20 +2261,15 @@ TEST_P(QuicConnectionTest, FramePackingNonCryptoThenCrypto) {
}
TEST_P(QuicConnectionTest, FramePackingCryptoThenNonCrypto) {
- CongestionBlockWrites();
-
// Send an ack and two stream frames (one crypto, then one non-crypto) in 2
// packets by queueing them.
- connection_.SendAck();
- EXPECT_CALL(visitor_, OnCanWrite()).WillOnce(DoAll(
- IgnoreResult(InvokeWithoutArgs(&connection_,
- &TestConnection::SendCryptoStreamData)),
- IgnoreResult(InvokeWithoutArgs(&connection_,
- &TestConnection::SendStreamData3))));
-
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
- CongestionUnblockWrites();
- connection_.GetSendAlarm()->Fire();
+ {
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
+ QuicConnection::ScopedPacketBundler bundler(&connection_,
+ QuicConnection::SEND_ACK);
+ connection_.SendCryptoStreamData();
+ connection_.SendStreamData3();
+ }
EXPECT_EQ(0u, connection_.NumQueuedPackets());
EXPECT_FALSE(connection_.HasQueuedData());
@@ -2296,20 +2282,15 @@ TEST_P(QuicConnectionTest, FramePackingCryptoThenNonCrypto) {
TEST_P(QuicConnectionTest, FramePackingFEC) {
EXPECT_TRUE(QuicPacketCreatorPeer::IsFecEnabled(creator_));
- CongestionBlockWrites();
-
// Queue an ack and two stream frames. Ack gets flushed when FEC is turned on
// for sending protected data; two stream frames are packed in 1 packet.
- EXPECT_CALL(visitor_, OnCanWrite()).WillOnce(DoAll(
- IgnoreResult(InvokeWithoutArgs(
- &connection_, &TestConnection::SendStreamData3WithFec)),
- IgnoreResult(InvokeWithoutArgs(
- &connection_, &TestConnection::SendStreamData5WithFec))));
- connection_.SendAck();
-
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
- CongestionUnblockWrites();
- connection_.GetSendAlarm()->Fire();
+ {
+ QuicConnection::ScopedPacketBundler bundler(&connection_,
+ QuicConnection::SEND_ACK);
+ connection_.SendStreamData3WithFec();
+ connection_.SendStreamData5WithFec();
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
+ }
EXPECT_EQ(0u, connection_.NumQueuedPackets());
EXPECT_FALSE(connection_.HasQueuedData());
@@ -5478,7 +5459,7 @@ TEST_P(QuicConnectionTest, DoNotSendGoAwayTwice) {
}
TEST_P(QuicConnectionTest, ReevaluateTimeUntilSendOnAck) {
- ValueRestore<bool> old_flag(&FLAGS_quic_respect_send_alarm, true);
+ ValueRestore<bool> old_flag(&FLAGS_quic_respect_send_alarm2, true);
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 0, !kFin,
nullptr);
@@ -5511,6 +5492,12 @@ TEST_P(QuicConnectionTest, ReevaluateTimeUntilSendOnAck) {
writer_->Reset();
}
+TEST_P(QuicConnectionTest, SendAcksImmediately) {
+ FLAGS_quic_respect_send_alarm2 = true;
+ CongestionBlockWrites();
+ SendAckPacketToPeer();
+}
+
TEST_P(QuicConnectionTest, SendingUnencryptedStreamDataFails) {
FLAGS_quic_never_write_unencrypted_data = true;
EXPECT_CALL(visitor_,
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698