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 4218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4229 ProcessPacket(kDefaultPathId, 2); | 4229 ProcessPacket(kDefaultPathId, 2); |
4230 // Check that ack is sent and that delayed ack alarm is reset. | 4230 // Check that ack is sent and that delayed ack alarm is reset. |
4231 EXPECT_EQ(3u, writer_->frame_count()); | 4231 EXPECT_EQ(3u, writer_->frame_count()); |
4232 EXPECT_FALSE(writer_->stop_waiting_frames().empty()); | 4232 EXPECT_FALSE(writer_->stop_waiting_frames().empty()); |
4233 EXPECT_EQ(1u, writer_->stream_frames().size()); | 4233 EXPECT_EQ(1u, writer_->stream_frames().size()); |
4234 EXPECT_FALSE(writer_->ack_frames().empty()); | 4234 EXPECT_FALSE(writer_->ack_frames().empty()); |
4235 EXPECT_EQ(2u, writer_->ack_frames().front().largest_observed); | 4235 EXPECT_EQ(2u, writer_->ack_frames().front().largest_observed); |
4236 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); | 4236 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); |
4237 } | 4237 } |
4238 | 4238 |
| 4239 TEST_P(QuicConnectionTest, BundleAckForSecondCHLOTwoPacketReject) { |
| 4240 FLAGS_quic_receive_packet_once_decrypted = true; |
| 4241 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 4242 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); |
| 4243 |
| 4244 // Process two packets from the crypto stream, which is frame1_'s default, |
| 4245 // simulating a 2 packet reject. |
| 4246 { |
| 4247 ProcessPacket(kDefaultPathId, 1); |
| 4248 // Send the new CHLO when the REJ is processed. |
| 4249 EXPECT_CALL(visitor_, OnStreamFrame(_)) |
| 4250 .WillOnce(IgnoreResult(InvokeWithoutArgs( |
| 4251 &connection_, &TestConnection::SendCryptoStreamData))); |
| 4252 ProcessDataPacket(kDefaultPathId, 2, kEntropyFlag); |
| 4253 } |
| 4254 // Check that ack is sent and that delayed ack alarm is reset. |
| 4255 EXPECT_EQ(3u, writer_->frame_count()); |
| 4256 EXPECT_FALSE(writer_->stop_waiting_frames().empty()); |
| 4257 EXPECT_EQ(1u, writer_->stream_frames().size()); |
| 4258 EXPECT_FALSE(writer_->ack_frames().empty()); |
| 4259 EXPECT_EQ(2u, writer_->ack_frames().front().largest_observed); |
| 4260 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); |
| 4261 } |
| 4262 |
4239 TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) { | 4263 TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) { |
4240 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 4264 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
4241 connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 0, !kFin, | 4265 connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 0, !kFin, |
4242 nullptr); | 4266 nullptr); |
4243 connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 3, !kFin, | 4267 connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 3, !kFin, |
4244 nullptr); | 4268 nullptr); |
4245 // Ack the second packet, which will retransmit the first packet. | 4269 // Ack the second packet, which will retransmit the first packet. |
4246 QuicAckFrame ack = InitAckFrame(2); | 4270 QuicAckFrame ack = InitAckFrame(2); |
4247 NackPacket(1, &ack); | 4271 NackPacket(1, &ack); |
4248 SendAlgorithmInterface::CongestionVector lost_packets; | 4272 SendAlgorithmInterface::CongestionVector lost_packets; |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5256 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); | 5280 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); |
5257 EXPECT_EQ(1u, writer_->frame_count()); | 5281 EXPECT_EQ(1u, writer_->frame_count()); |
5258 EXPECT_FALSE(writer_->connection_close_frames().empty()); | 5282 EXPECT_FALSE(writer_->connection_close_frames().empty()); |
5259 // Ack frame is not bundled in connection close packet. | 5283 // Ack frame is not bundled in connection close packet. |
5260 EXPECT_TRUE(writer_->ack_frames().empty()); | 5284 EXPECT_TRUE(writer_->ack_frames().empty()); |
5261 } | 5285 } |
5262 | 5286 |
5263 } // namespace | 5287 } // namespace |
5264 } // namespace test | 5288 } // namespace test |
5265 } // namespace net | 5289 } // namespace net |
OLD | NEW |