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

Unified Diff: net/quic/quic_connection_test.cc

Issue 572083003: Add a separate QUIC_CONNECTION_OVERALL_TIMED_OUT to identify overall (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Fix_crash_on_ConnectionClose_75541290
Patch Set: Created 6 years, 3 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_crypto_client_stream_test.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 f75f975ff6498b28b0566828c98fb5d093ac1ef6..22ad20052b472973a3405f20f7161cf1d4e1a10f 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -2681,7 +2681,43 @@ TEST_P(QuicConnectionTest, InitialTimeout) {
EXPECT_FALSE(connection_.GetResumeWritesAlarm()->IsSet());
EXPECT_FALSE(connection_.GetRetransmissionAlarm()->IsSet());
EXPECT_FALSE(connection_.GetSendAlarm()->IsSet());
+}
+
+TEST_P(QuicConnectionTest, OverallTimeout) {
+ connection_.SetOverallConnectionTimeout(
+ QuicTime::Delta::FromSeconds(kDefaultMaxTimeForCryptoHandshakeSecs));
+ EXPECT_TRUE(connection_.connected());
+ EXPECT_CALL(visitor_,
+ OnConnectionClosed(QUIC_CONNECTION_OVERALL_TIMED_OUT, false));
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AnyNumber());
+
+ QuicTime overall_timeout = clock_.ApproximateNow().Add(
+ QuicTime::Delta::FromSeconds(kDefaultMaxTimeForCryptoHandshakeSecs));
+ EXPECT_EQ(overall_timeout, connection_.GetTimeoutAlarm()->deadline());
+
+ EXPECT_TRUE(connection_.connected());
+ SendStreamDataToPeer(1, "GET /", 0, kFin, NULL);
+
+ clock_.AdvanceTime(
+ QuicTime::Delta::FromSeconds(2 * kDefaultInitialTimeoutSecs));
+
+ // Process an ack and see that the connection still times out.
+ QuicAckFrame frame = InitAckFrame(1);
+ EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
+ EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
+ ProcessAckPacket(&frame);
+
+ // Simulate the timeout alarm firing.
+ connection_.GetTimeoutAlarm()->Fire();
+
EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet());
+ EXPECT_FALSE(connection_.connected());
+
+ EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
+ EXPECT_FALSE(connection_.GetPingAlarm()->IsSet());
+ EXPECT_FALSE(connection_.GetResumeWritesAlarm()->IsSet());
+ EXPECT_FALSE(connection_.GetRetransmissionAlarm()->IsSet());
+ EXPECT_FALSE(connection_.GetSendAlarm()->IsSet());
}
TEST_P(QuicConnectionTest, PingAfterSend) {
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_crypto_client_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698