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

Unified Diff: net/quic/core/quic_connection_test.cc

Issue 2875333002: Landing Recent QUIC changes until Mon May 8 21:42:46 2017 +0000 (Closed)
Patch Set: Created 3 years, 7 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/core/quic_connection.cc ('k') | net/quic/core/quic_crypto_server_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_connection_test.cc
diff --git a/net/quic/core/quic_connection_test.cc b/net/quic/core/quic_connection_test.cc
index f6df716f18223318588c385de54a5cb0bffff2af..1ac628591a3268083347e2b323d9b522966f666a 100644
--- a/net/quic/core/quic_connection_test.cc
+++ b/net/quic/core/quic_connection_test.cc
@@ -583,6 +583,7 @@ class TestConnection : public QuicConnection {
QuicTagVector connection_options;
connection_options.push_back(kMTUH);
config.SetConnectionOptionsToSend(connection_options);
+ EXPECT_CALL(*send_algorithm, GetCongestionControlType());
EXPECT_CALL(*send_algorithm, SetFromConfig(_, _));
SetFromConfig(config);
@@ -2695,6 +2696,7 @@ TEST_P(QuicConnectionTest, RetransmitPacketsWithInitialEncryption) {
TEST_P(QuicConnectionTest, BufferNonDecryptablePackets) {
// SetFromConfig is always called after construction from InitializeSession.
+ EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
QuicConfig config;
connection_.SetFromConfig(config);
@@ -2724,6 +2726,7 @@ TEST_P(QuicConnectionTest, BufferNonDecryptablePackets) {
TEST_P(QuicConnectionTest, Buffer100NonDecryptablePackets) {
// SetFromConfig is always called after construction from InitializeSession.
+ EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
QuicConfig config;
config.set_max_undecryptable_packets(100);
@@ -2862,6 +2865,7 @@ TEST_P(QuicConnectionTest, InitialTimeout) {
EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet());
// SetFromConfig sets the initial timeouts before negotiation.
+ EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
QuicConfig config;
connection_.SetFromConfig(config);
@@ -3298,6 +3302,7 @@ TEST_P(QuicConnectionTest, NoMtuDiscoveryAfterConnectionClosed) {
TEST_P(QuicConnectionTest, TimeoutAfterSend) {
EXPECT_TRUE(connection_.connected());
+ EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
QuicConfig config;
connection_.SetFromConfig(config);
@@ -3344,6 +3349,7 @@ TEST_P(QuicConnectionTest, TimeoutAfterSend) {
TEST_P(QuicConnectionTest, TimeoutAfterRetransmission) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
EXPECT_TRUE(connection_.connected());
+ EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
QuicConfig config;
connection_.SetFromConfig(config);
@@ -3418,6 +3424,7 @@ TEST_P(QuicConnectionTest, NewTimeoutAfterSendSilentClose) {
// Same test as above, but complete a handshake which enables silent close,
// causing no connection close packet to be sent.
EXPECT_TRUE(connection_.connected());
+ EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
QuicConfig config;
@@ -3480,6 +3487,7 @@ TEST_P(QuicConnectionTest, NewTimeoutAfterSendSilentClose) {
TEST_P(QuicConnectionTest, TimeoutAfterReceive) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
EXPECT_TRUE(connection_.connected());
+ EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
QuicConfig config;
connection_.SetFromConfig(config);
@@ -3528,6 +3536,7 @@ TEST_P(QuicConnectionTest, TimeoutAfterReceive) {
TEST_P(QuicConnectionTest, TimeoutAfterReceiveNotSendWhenUnacked) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
EXPECT_TRUE(connection_.connected());
+ EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
QuicConfig config;
connection_.SetFromConfig(config);
@@ -3587,6 +3596,7 @@ TEST_P(QuicConnectionTest, TimeoutAfterReceiveNotSendWhenUnacked) {
TEST_P(QuicConnectionTest, TimeoutAfter5ClientRTOs) {
connection_.SetMaxTailLossProbes(2);
EXPECT_TRUE(connection_.connected());
+ EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
QuicConfig config;
QuicTagVector connection_options;
@@ -3617,6 +3627,41 @@ TEST_P(QuicConnectionTest, TimeoutAfter5ClientRTOs) {
EXPECT_FALSE(connection_.connected());
}
+TEST_P(QuicConnectionTest, TimeoutAfter3ClientRTOs) {
+ FLAGS_quic_reloadable_flag_quic_enable_3rtos = true;
+ connection_.SetMaxTailLossProbes(2);
+ EXPECT_TRUE(connection_.connected());
+ EXPECT_CALL(*send_algorithm_, GetCongestionControlType());
+ EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
+ QuicConfig config;
+ QuicTagVector connection_options;
+ connection_options.push_back(k3RTO);
+ config.SetConnectionOptionsToSend(connection_options);
+ connection_.SetFromConfig(config);
+
+ // Send stream data.
+ SendStreamDataToPeer(kClientDataStreamId1, "foo", 0, FIN, nullptr);
+
+ EXPECT_CALL(visitor_, OnPathDegrading());
+ // Fire the retransmission alarm 4 times, twice for TLP and 2 times for RTO.
+ for (int i = 0; i < 4; ++i) {
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
+ connection_.GetRetransmissionAlarm()->Fire();
+ EXPECT_TRUE(connection_.GetTimeoutAlarm()->IsSet());
+ EXPECT_TRUE(connection_.connected());
+ }
+
+ EXPECT_EQ(2u, connection_.sent_packet_manager().GetConsecutiveTlpCount());
+ EXPECT_EQ(2u, connection_.sent_packet_manager().GetConsecutiveRtoCount());
+ // This time, we should time out.
+ EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_TOO_MANY_RTOS, _,
+ ConnectionCloseSource::FROM_SELF));
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
+ connection_.GetRetransmissionAlarm()->Fire();
+ EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet());
+ EXPECT_FALSE(connection_.connected());
+}
+
TEST_P(QuicConnectionTest, SendScheduler) {
// Test that if we send a packet without delay, it is not queued.
QuicPacket* packet = ConstructDataPacket(1, !kHasStopWaiting);
@@ -3690,6 +3735,7 @@ TEST_P(QuicConnectionTest, LoopThroughSendingPackets) {
TEST_P(QuicConnectionTest, LoopThroughSendingPacketsWithTruncation) {
// Set up a larger payload than will fit in one packet.
const string payload(connection_.max_packet_length(), 'a');
+ EXPECT_CALL(*send_algorithm_, GetCongestionControlType()).Times(AnyNumber());
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)).Times(AnyNumber());
// Now send some packets with no truncation.
« no previous file with comments | « net/quic/core/quic_connection.cc ('k') | net/quic/core/quic_crypto_server_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698