Index: net/quic/quic_connection_test.cc |
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc |
index 52d9d8e439467def8efc89414761c0794c024b09..ede61c8a98dc8aaec975c0470b680bef2bad7826 100644 |
--- a/net/quic/quic_connection_test.cc |
+++ b/net/quic/quic_connection_test.cc |
@@ -3163,22 +3163,25 @@ TEST_P(QuicConnectionTest, SendDelayedAck) { |
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); |
} |
-TEST_P(QuicConnectionTest, SendEarlyDelayedAckForCrypto) { |
- QuicTime ack_time = clock_.ApproximateNow(); |
+TEST_P(QuicConnectionTest, SendDelayedAckOnHandshakeConfirmed) { |
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
- EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); |
- // Process a packet from the crypto stream, which is frame1_'s default. |
ProcessPacket(1); |
- // Check if delayed ack timer is running for the expected interval. |
+ // Check that ack is sent and that delayed ack alarm is set. |
EXPECT_TRUE(connection_.GetAckAlarm()->IsSet()); |
+ QuicTime ack_time = clock_.ApproximateNow().Add(DefaultDelayedAckTime()); |
EXPECT_EQ(ack_time, connection_.GetAckAlarm()->deadline()); |
- // Simulate delayed ack alarm firing. |
- connection_.GetAckAlarm()->Fire(); |
- // Check that ack is sent and that delayed ack alarm is reset. |
- EXPECT_EQ(2u, writer_->frame_count()); |
- EXPECT_FALSE(writer_->stop_waiting_frames().empty()); |
- EXPECT_FALSE(writer_->ack_frames().empty()); |
- EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); |
+ |
+ // Completing the handshake as the server does nothing. |
+ QuicConnectionPeer::SetIsServer(&connection_, true); |
+ connection_.OnHandshakeComplete(); |
+ EXPECT_TRUE(connection_.GetAckAlarm()->IsSet()); |
+ EXPECT_EQ(ack_time, connection_.GetAckAlarm()->deadline()); |
+ |
+ // Complete the handshake as the client decreases the delayed ack time to 0ms. |
+ QuicConnectionPeer::SetIsServer(&connection_, false); |
+ connection_.OnHandshakeComplete(); |
+ EXPECT_TRUE(connection_.GetAckAlarm()->IsSet()); |
+ EXPECT_EQ(clock_.ApproximateNow(), connection_.GetAckAlarm()->deadline()); |
} |
TEST_P(QuicConnectionTest, SendDelayedAckOnSecondPacket) { |