| 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 4231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4242 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 4242 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 4243 | 4243 |
| 4244 QuicBlockedFrame blocked; | 4244 QuicBlockedFrame blocked; |
| 4245 blocked.stream_id = 3; | 4245 blocked.stream_id = 3; |
| 4246 EXPECT_CALL(visitor_, OnBlockedFrame(_)); | 4246 EXPECT_CALL(visitor_, OnBlockedFrame(_)); |
| 4247 ProcessFramePacket(QuicFrame(&blocked)); | 4247 ProcessFramePacket(QuicFrame(&blocked)); |
| 4248 EXPECT_EQ(1u, connection_.GetStats().blocked_frames_received); | 4248 EXPECT_EQ(1u, connection_.GetStats().blocked_frames_received); |
| 4249 EXPECT_EQ(0u, connection_.GetStats().blocked_frames_sent); | 4249 EXPECT_EQ(0u, connection_.GetStats().blocked_frames_sent); |
| 4250 } | 4250 } |
| 4251 | 4251 |
| 4252 TEST_P(QuicConnectionTest, PathClose) { | |
| 4253 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | |
| 4254 | |
| 4255 QuicPathCloseFrame path_close = QuicPathCloseFrame(1); | |
| 4256 ProcessPathClosePacket(&path_close); | |
| 4257 EXPECT_TRUE(QuicFramerPeer::IsPathClosed( | |
| 4258 QuicConnectionPeer::GetFramer(&connection_), 1)); | |
| 4259 } | |
| 4260 | |
| 4261 TEST_P(QuicConnectionTest, ZeroBytePacket) { | 4252 TEST_P(QuicConnectionTest, ZeroBytePacket) { |
| 4262 // Don't close the connection for zero byte packets. | 4253 // Don't close the connection for zero byte packets. |
| 4263 EXPECT_CALL(visitor_, OnConnectionClosed(_, _, _)).Times(0); | 4254 EXPECT_CALL(visitor_, OnConnectionClosed(_, _, _)).Times(0); |
| 4264 QuicReceivedPacket encrypted(nullptr, 0, QuicTime::Zero()); | 4255 QuicReceivedPacket encrypted(nullptr, 0, QuicTime::Zero()); |
| 4265 connection_.ProcessUdpPacket(kSelfAddress, kPeerAddress, encrypted); | 4256 connection_.ProcessUdpPacket(kSelfAddress, kPeerAddress, encrypted); |
| 4266 } | 4257 } |
| 4267 | 4258 |
| 4268 TEST_P(QuicConnectionTest, MissingPacketsBeforeLeastUnacked) { | 4259 TEST_P(QuicConnectionTest, MissingPacketsBeforeLeastUnacked) { |
| 4269 // Set the packet number of the ack packet to be least unacked (4). | 4260 // Set the packet number of the ack packet to be least unacked (4). |
| 4270 QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 3); | 4261 QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 3); |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4886 client_config.SetMultipathEnabled(true); | 4877 client_config.SetMultipathEnabled(true); |
| 4887 client_config.ToHandshakeMessage(&msg); | 4878 client_config.ToHandshakeMessage(&msg); |
| 4888 const QuicErrorCode error = | 4879 const QuicErrorCode error = |
| 4889 config.ProcessPeerHello(msg, CLIENT, &error_details); | 4880 config.ProcessPeerHello(msg, CLIENT, &error_details); |
| 4890 EXPECT_EQ(QUIC_NO_ERROR, error); | 4881 EXPECT_EQ(QUIC_NO_ERROR, error); |
| 4891 | 4882 |
| 4892 connection_.SetFromConfig(config); | 4883 connection_.SetFromConfig(config); |
| 4893 EXPECT_TRUE(QuicConnectionPeer::IsMultipathEnabled(&connection_)); | 4884 EXPECT_TRUE(QuicConnectionPeer::IsMultipathEnabled(&connection_)); |
| 4894 } | 4885 } |
| 4895 | 4886 |
| 4896 TEST_P(QuicConnectionTest, ClosePath) { | |
| 4897 QuicPathId kTestPathId = 1; | |
| 4898 connection_.SendPathClose(kTestPathId); | |
| 4899 EXPECT_TRUE(QuicFramerPeer::IsPathClosed( | |
| 4900 QuicConnectionPeer::GetFramer(&connection_), kTestPathId)); | |
| 4901 } | |
| 4902 | |
| 4903 TEST_P(QuicConnectionTest, OnPathDegrading) { | 4887 TEST_P(QuicConnectionTest, OnPathDegrading) { |
| 4904 QuicByteCount packet_size; | 4888 QuicByteCount packet_size; |
| 4905 const size_t kMinTimeoutsBeforePathDegrading = 2; | 4889 const size_t kMinTimeoutsBeforePathDegrading = 2; |
| 4906 | 4890 |
| 4907 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) | 4891 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) |
| 4908 .WillOnce(DoAll(SaveArg<3>(&packet_size), Return(true))); | 4892 .WillOnce(DoAll(SaveArg<3>(&packet_size), Return(true))); |
| 4909 connection_.SendStreamDataWithString(3, "packet", 0, !kFin, nullptr); | 4893 connection_.SendStreamDataWithString(3, "packet", 0, !kFin, nullptr); |
| 4910 size_t num_timeouts = | 4894 size_t num_timeouts = |
| 4911 kMinTimeoutsBeforePathDegrading + | 4895 kMinTimeoutsBeforePathDegrading + |
| 4912 QuicSentPacketManagerPeer::GetMaxTailLossProbes( | 4896 QuicSentPacketManagerPeer::GetMaxTailLossProbes( |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5057 error_details, ConnectionCloseSource::FROM_PEER)); | 5041 error_details, ConnectionCloseSource::FROM_PEER)); |
| 5058 connection_.set_perspective(Perspective::IS_CLIENT); | 5042 connection_.set_perspective(Perspective::IS_CLIENT); |
| 5059 connection_.CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, | 5043 connection_.CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, |
| 5060 error_details, | 5044 error_details, |
| 5061 ConnectionCloseBehavior::SILENT_CLOSE); | 5045 ConnectionCloseBehavior::SILENT_CLOSE); |
| 5062 } | 5046 } |
| 5063 | 5047 |
| 5064 } // namespace | 5048 } // namespace |
| 5065 } // namespace test | 5049 } // namespace test |
| 5066 } // namespace net | 5050 } // namespace net |
| OLD | NEW |