| 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 5211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5222 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); | 5222 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); |
| 5223 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, | 5223 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, |
| 5224 ConnectionCloseSource::FROM_SELF)) | 5224 ConnectionCloseSource::FROM_SELF)) |
| 5225 .Times(1); | 5225 .Times(1); |
| 5226 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); | 5226 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); |
| 5227 } | 5227 } |
| 5228 | 5228 |
| 5229 // Verify that if connection has no outstanding data, it notifies the send | 5229 // Verify that if connection has no outstanding data, it notifies the send |
| 5230 // algorithm after the write. | 5230 // algorithm after the write. |
| 5231 TEST_P(QuicConnectionTest, SendDataAndBecomeApplicationLimited) { | 5231 TEST_P(QuicConnectionTest, SendDataAndBecomeApplicationLimited) { |
| 5232 FLAGS_quic_enable_app_limited_check = true; | |
| 5233 | |
| 5234 EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(1); | 5232 EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(1); |
| 5235 { | 5233 { |
| 5236 InSequence seq; | 5234 InSequence seq; |
| 5237 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillRepeatedly(Return(true)); | 5235 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillRepeatedly(Return(true)); |
| 5238 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) | 5236 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) |
| 5239 .WillOnce(Return(true)); | 5237 .WillOnce(Return(true)); |
| 5240 EXPECT_CALL(visitor_, WillingAndAbleToWrite()) | 5238 EXPECT_CALL(visitor_, WillingAndAbleToWrite()) |
| 5241 .WillRepeatedly(Return(false)); | 5239 .WillRepeatedly(Return(false)); |
| 5242 } | 5240 } |
| 5243 | 5241 |
| 5244 connection_.SendStreamData3(); | 5242 connection_.SendStreamData3(); |
| 5245 } | 5243 } |
| 5246 | 5244 |
| 5247 // Verify that the connection does not become app-limited if there is | 5245 // Verify that the connection does not become app-limited if there is |
| 5248 // outstanding data to send after the write. | 5246 // outstanding data to send after the write. |
| 5249 TEST_P(QuicConnectionTest, NotBecomeApplicationLimitedIfMoreDataAvailable) { | 5247 TEST_P(QuicConnectionTest, NotBecomeApplicationLimitedIfMoreDataAvailable) { |
| 5250 FLAGS_quic_enable_app_limited_check = true; | |
| 5251 | |
| 5252 EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(0); | 5248 EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(0); |
| 5253 { | 5249 { |
| 5254 InSequence seq; | 5250 InSequence seq; |
| 5255 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) | 5251 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) |
| 5256 .WillOnce(Return(true)); | 5252 .WillOnce(Return(true)); |
| 5257 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillRepeatedly(Return(true)); | 5253 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillRepeatedly(Return(true)); |
| 5258 } | 5254 } |
| 5259 | 5255 |
| 5260 connection_.SendStreamData3(); | 5256 connection_.SendStreamData3(); |
| 5261 } | 5257 } |
| 5262 | 5258 |
| 5263 // Verify that the connection does not become app-limited after blocked write | 5259 // Verify that the connection does not become app-limited after blocked write |
| 5264 // even if there is outstanding data to send after the write. | 5260 // even if there is outstanding data to send after the write. |
| 5265 TEST_P(QuicConnectionTest, NotBecomeApplicationLimitedDueToWriteBlock) { | 5261 TEST_P(QuicConnectionTest, NotBecomeApplicationLimitedDueToWriteBlock) { |
| 5266 FLAGS_quic_enable_app_limited_check = true; | |
| 5267 | |
| 5268 EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(0); | 5262 EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(0); |
| 5269 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillRepeatedly(Return(true)); | 5263 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillRepeatedly(Return(true)); |
| 5270 BlockOnNextWrite(); | 5264 BlockOnNextWrite(); |
| 5271 | 5265 |
| 5272 connection_.SendStreamData3(); | 5266 connection_.SendStreamData3(); |
| 5273 } | 5267 } |
| 5274 | 5268 |
| 5275 TEST_P(QuicConnectionTest, ForceSendingAckOnPacketTooLarge) { | 5269 TEST_P(QuicConnectionTest, ForceSendingAckOnPacketTooLarge) { |
| 5276 FLAGS_quic_do_not_send_ack_on_emsgsize = false; | 5270 FLAGS_quic_do_not_send_ack_on_emsgsize = false; |
| 5277 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 5271 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 5304 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); | 5298 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); |
| 5305 EXPECT_EQ(1u, writer_->frame_count()); | 5299 EXPECT_EQ(1u, writer_->frame_count()); |
| 5306 EXPECT_FALSE(writer_->connection_close_frames().empty()); | 5300 EXPECT_FALSE(writer_->connection_close_frames().empty()); |
| 5307 // Ack frame is not bundled in connection close packet. | 5301 // Ack frame is not bundled in connection close packet. |
| 5308 EXPECT_TRUE(writer_->ack_frames().empty()); | 5302 EXPECT_TRUE(writer_->ack_frames().empty()); |
| 5309 } | 5303 } |
| 5310 | 5304 |
| 5311 } // namespace | 5305 } // namespace |
| 5312 } // namespace test | 5306 } // namespace test |
| 5313 } // namespace net | 5307 } // namespace net |
| OLD | NEW |