| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/core/quic_connection.h" | 5 #include "net/quic/core/quic_connection.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <ostream> | 9 #include <ostream> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 3599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3610 EXPECT_EQ(4u, connection_.sent_packet_manager().GetConsecutiveRtoCount()); | 3610 EXPECT_EQ(4u, connection_.sent_packet_manager().GetConsecutiveRtoCount()); |
| 3611 // This time, we should time out. | 3611 // This time, we should time out. |
| 3612 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_TOO_MANY_RTOS, _, | 3612 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_TOO_MANY_RTOS, _, |
| 3613 ConnectionCloseSource::FROM_SELF)); | 3613 ConnectionCloseSource::FROM_SELF)); |
| 3614 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); | 3614 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
| 3615 connection_.GetRetransmissionAlarm()->Fire(); | 3615 connection_.GetRetransmissionAlarm()->Fire(); |
| 3616 EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet()); | 3616 EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet()); |
| 3617 EXPECT_FALSE(connection_.connected()); | 3617 EXPECT_FALSE(connection_.connected()); |
| 3618 } | 3618 } |
| 3619 | 3619 |
| 3620 TEST_P(QuicConnectionTest, TimeoutAfter3ClientRTOs) { |
| 3621 FLAGS_quic_reloadable_flag_quic_enable_3rtos = true; |
| 3622 connection_.SetMaxTailLossProbes(2); |
| 3623 EXPECT_TRUE(connection_.connected()); |
| 3624 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
| 3625 QuicConfig config; |
| 3626 QuicTagVector connection_options; |
| 3627 connection_options.push_back(k3RTO); |
| 3628 config.SetConnectionOptionsToSend(connection_options); |
| 3629 connection_.SetFromConfig(config); |
| 3630 |
| 3631 // Send stream data. |
| 3632 SendStreamDataToPeer(kClientDataStreamId1, "foo", 0, FIN, nullptr); |
| 3633 |
| 3634 EXPECT_CALL(visitor_, OnPathDegrading()); |
| 3635 // Fire the retransmission alarm 4 times, twice for TLP and 2 times for RTO. |
| 3636 for (int i = 0; i < 4; ++i) { |
| 3637 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
| 3638 connection_.GetRetransmissionAlarm()->Fire(); |
| 3639 EXPECT_TRUE(connection_.GetTimeoutAlarm()->IsSet()); |
| 3640 EXPECT_TRUE(connection_.connected()); |
| 3641 } |
| 3642 |
| 3643 EXPECT_EQ(2u, connection_.sent_packet_manager().GetConsecutiveTlpCount()); |
| 3644 EXPECT_EQ(2u, connection_.sent_packet_manager().GetConsecutiveRtoCount()); |
| 3645 // This time, we should time out. |
| 3646 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_TOO_MANY_RTOS, _, |
| 3647 ConnectionCloseSource::FROM_SELF)); |
| 3648 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
| 3649 connection_.GetRetransmissionAlarm()->Fire(); |
| 3650 EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet()); |
| 3651 EXPECT_FALSE(connection_.connected()); |
| 3652 } |
| 3653 |
| 3620 TEST_P(QuicConnectionTest, SendScheduler) { | 3654 TEST_P(QuicConnectionTest, SendScheduler) { |
| 3621 // Test that if we send a packet without delay, it is not queued. | 3655 // Test that if we send a packet without delay, it is not queued. |
| 3622 QuicPacket* packet = ConstructDataPacket(1, !kHasStopWaiting); | 3656 QuicPacket* packet = ConstructDataPacket(1, !kHasStopWaiting); |
| 3623 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); | 3657 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
| 3624 connection_.SendPacket(ENCRYPTION_NONE, 1, packet, HAS_RETRANSMITTABLE_DATA, | 3658 connection_.SendPacket(ENCRYPTION_NONE, 1, packet, HAS_RETRANSMITTABLE_DATA, |
| 3625 false, false); | 3659 false, false); |
| 3626 EXPECT_EQ(0u, connection_.NumQueuedPackets()); | 3660 EXPECT_EQ(0u, connection_.NumQueuedPackets()); |
| 3627 } | 3661 } |
| 3628 | 3662 |
| 3629 TEST_P(QuicConnectionTest, FailToSendFirstPacket) { | 3663 TEST_P(QuicConnectionTest, FailToSendFirstPacket) { |
| (...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5217 error_details, ConnectionCloseSource::FROM_PEER)); | 5251 error_details, ConnectionCloseSource::FROM_PEER)); |
| 5218 connection_.set_perspective(Perspective::IS_CLIENT); | 5252 connection_.set_perspective(Perspective::IS_CLIENT); |
| 5219 connection_.CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, | 5253 connection_.CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, |
| 5220 error_details, | 5254 error_details, |
| 5221 ConnectionCloseBehavior::SILENT_CLOSE); | 5255 ConnectionCloseBehavior::SILENT_CLOSE); |
| 5222 } | 5256 } |
| 5223 | 5257 |
| 5224 } // namespace | 5258 } // namespace |
| 5225 } // namespace test | 5259 } // namespace test |
| 5226 } // namespace net | 5260 } // namespace net |
| OLD | NEW |