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/quic_connection.h" | 5 #include "net/quic/quic_connection.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 3195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3206 | 3206 |
3207 TEST_P(QuicConnectionTest, Blocked) { | 3207 TEST_P(QuicConnectionTest, Blocked) { |
3208 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 3208 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
3209 | 3209 |
3210 QuicBlockedFrame blocked; | 3210 QuicBlockedFrame blocked; |
3211 blocked.stream_id = 3; | 3211 blocked.stream_id = 3; |
3212 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 3212 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
3213 ProcessFramePacket(QuicFrame(&blocked)); | 3213 ProcessFramePacket(QuicFrame(&blocked)); |
3214 } | 3214 } |
3215 | 3215 |
3216 TEST_P(QuicConnectionTest, InvalidPacket) { | 3216 TEST_P(QuicConnectionTest, ZeroBytePacket) { |
3217 EXPECT_CALL(visitor_, | 3217 // Don't close the connection for zero byte packets. |
3218 OnConnectionClosed(QUIC_INVALID_PACKET_HEADER, false)); | 3218 EXPECT_CALL(visitor_, OnConnectionClosed(_, _)).Times(0); |
3219 QuicEncryptedPacket encrypted(nullptr, 0); | 3219 QuicEncryptedPacket encrypted(nullptr, 0); |
3220 connection_.ProcessUdpPacket(IPEndPoint(), IPEndPoint(), encrypted); | 3220 connection_.ProcessUdpPacket(IPEndPoint(), IPEndPoint(), encrypted); |
3221 // The connection close packet should have error details. | |
3222 ASSERT_FALSE(writer_->connection_close_frames().empty()); | |
3223 EXPECT_EQ("Unable to read public flags.", | |
3224 writer_->connection_close_frames()[0].error_details); | |
3225 } | 3221 } |
3226 | 3222 |
3227 TEST_P(QuicConnectionTest, MissingPacketsBeforeLeastUnacked) { | 3223 TEST_P(QuicConnectionTest, MissingPacketsBeforeLeastUnacked) { |
3228 // Set the sequence number of the ack packet to be least unacked (4). | 3224 // Set the sequence number of the ack packet to be least unacked (4). |
3229 peer_creator_.set_sequence_number(3); | 3225 peer_creator_.set_sequence_number(3); |
3230 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 3226 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
3231 QuicStopWaitingFrame frame = InitStopWaitingFrame(4); | 3227 QuicStopWaitingFrame frame = InitStopWaitingFrame(4); |
3232 ProcessStopWaitingPacket(&frame); | 3228 ProcessStopWaitingPacket(&frame); |
3233 EXPECT_TRUE(outgoing_ack()->missing_packets.empty()); | 3229 EXPECT_TRUE(outgoing_ack()->missing_packets.empty()); |
3234 } | 3230 } |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4025 QuicBlockedFrame blocked; | 4021 QuicBlockedFrame blocked; |
4026 blocked.stream_id = 3; | 4022 blocked.stream_id = 3; |
4027 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 4023 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
4028 ProcessFramePacket(QuicFrame(&blocked)); | 4024 ProcessFramePacket(QuicFrame(&blocked)); |
4029 EXPECT_TRUE(ack_alarm->IsSet()); | 4025 EXPECT_TRUE(ack_alarm->IsSet()); |
4030 } | 4026 } |
4031 | 4027 |
4032 } // namespace | 4028 } // namespace |
4033 } // namespace test | 4029 } // namespace test |
4034 } // namespace net | 4030 } // namespace net |
OLD | NEW |