| 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 5193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5204 // Verify that the connection does not become app-limited after blocked write | 5204 // Verify that the connection does not become app-limited after blocked write |
| 5205 // even if there is outstanding data to send after the write. | 5205 // even if there is outstanding data to send after the write. |
| 5206 TEST_P(QuicConnectionTest, NotBecomeApplicationLimitedDueToWriteBlock) { | 5206 TEST_P(QuicConnectionTest, NotBecomeApplicationLimitedDueToWriteBlock) { |
| 5207 EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(0); | 5207 EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(0); |
| 5208 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillRepeatedly(Return(true)); | 5208 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillRepeatedly(Return(true)); |
| 5209 BlockOnNextWrite(); | 5209 BlockOnNextWrite(); |
| 5210 | 5210 |
| 5211 connection_.SendStreamData3(); | 5211 connection_.SendStreamData3(); |
| 5212 } | 5212 } |
| 5213 | 5213 |
| 5214 TEST_P(QuicConnectionTest, ForceSendingAckOnPacketTooLarge) { | 5214 TEST_P(QuicConnectionTest, DonotForceSendingAckOnPacketTooLarge) { |
| 5215 FLAGS_quic_do_not_send_ack_on_emsgsize = false; | |
| 5216 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 5215 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 5217 // Send an ack by simulating delayed ack alarm firing. | 5216 // Send an ack by simulating delayed ack alarm firing. |
| 5218 ProcessPacket(kDefaultPathId, 1); | 5217 ProcessPacket(kDefaultPathId, 1); |
| 5219 QuicAlarm* ack_alarm = QuicConnectionPeer::GetAckAlarm(&connection_); | |
| 5220 EXPECT_TRUE(ack_alarm->IsSet()); | |
| 5221 connection_.GetAckAlarm()->Fire(); | |
| 5222 // Simulate data packet causes write error. | |
| 5223 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, _)); | |
| 5224 SimulateNextPacketTooLarge(); | |
| 5225 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); | |
| 5226 EXPECT_EQ(3u, writer_->frame_count()); | |
| 5227 EXPECT_FALSE(writer_->connection_close_frames().empty()); | |
| 5228 // Ack frame is bundled. | |
| 5229 EXPECT_FALSE(writer_->ack_frames().empty()); | |
| 5230 } | |
| 5231 | |
| 5232 TEST_P(QuicConnectionTest, DonotForceSendingAckOnPacketTooLarge) { | |
| 5233 FLAGS_quic_do_not_send_ack_on_emsgsize = true; | |
| 5234 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | |
| 5235 // Send an ack by simulating delayed ack alarm firing. | |
| 5236 ProcessPacket(kDefaultPathId, 1); | |
| 5237 QuicAlarm* ack_alarm = QuicConnectionPeer::GetAckAlarm(&connection_); | 5218 QuicAlarm* ack_alarm = QuicConnectionPeer::GetAckAlarm(&connection_); |
| 5238 EXPECT_TRUE(ack_alarm->IsSet()); | 5219 EXPECT_TRUE(ack_alarm->IsSet()); |
| 5239 connection_.GetAckAlarm()->Fire(); | 5220 connection_.GetAckAlarm()->Fire(); |
| 5240 // Simulate data packet causes write error. | 5221 // Simulate data packet causes write error. |
| 5241 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, _)); | 5222 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, _)); |
| 5242 SimulateNextPacketTooLarge(); | 5223 SimulateNextPacketTooLarge(); |
| 5243 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); | 5224 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); |
| 5244 EXPECT_EQ(1u, writer_->frame_count()); | 5225 EXPECT_EQ(1u, writer_->frame_count()); |
| 5245 EXPECT_FALSE(writer_->connection_close_frames().empty()); | 5226 EXPECT_FALSE(writer_->connection_close_frames().empty()); |
| 5246 // Ack frame is not bundled in connection close packet. | 5227 // Ack frame is not bundled in connection close packet. |
| 5247 EXPECT_TRUE(writer_->ack_frames().empty()); | 5228 EXPECT_TRUE(writer_->ack_frames().empty()); |
| 5248 } | 5229 } |
| 5249 | 5230 |
| 5250 } // namespace | 5231 } // namespace |
| 5251 } // namespace test | 5232 } // namespace test |
| 5252 } // namespace net | 5233 } // namespace net |
| OLD | NEW |