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 5225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5236 frame1_.data_buffer = data->data(); | 5236 frame1_.data_buffer = data->data(); |
5237 frame1_.data_length = data->length(); | 5237 frame1_.data_length = data->length(); |
5238 | 5238 |
5239 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_MAYBE_CORRUPTED_MEMORY, _, | 5239 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_MAYBE_CORRUPTED_MEMORY, _, |
5240 ConnectionCloseSource::FROM_SELF)); | 5240 ConnectionCloseSource::FROM_SELF)); |
5241 ForceProcessFramePacket(QuicFrame(&frame1_)); | 5241 ForceProcessFramePacket(QuicFrame(&frame1_)); |
5242 } | 5242 } |
5243 | 5243 |
5244 TEST_P(QuicConnectionTest, CloseConnectionOnPacketTooLarge) { | 5244 TEST_P(QuicConnectionTest, CloseConnectionOnPacketTooLarge) { |
5245 SimulateNextPacketTooLarge(); | 5245 SimulateNextPacketTooLarge(); |
5246 if (!FLAGS_quic_only_track_sent_packets) { | |
5247 // Although the data packet cannot be written, the send packet manager is | |
5248 // informed. | |
5249 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); | |
5250 } | |
5251 // A connection close packet is sent | 5246 // A connection close packet is sent |
5252 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, | 5247 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, |
5253 ConnectionCloseSource::FROM_SELF)) | 5248 ConnectionCloseSource::FROM_SELF)) |
5254 .Times(1); | 5249 .Times(1); |
5255 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); | 5250 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); |
5256 } | 5251 } |
5257 | 5252 |
5258 TEST_P(QuicConnectionTest, AlwaysGetPacketTooLarge) { | 5253 TEST_P(QuicConnectionTest, AlwaysGetPacketTooLarge) { |
5259 // Test even we always get packet too large, we do not infinitely try to send | 5254 // Test even we always get packet too large, we do not infinitely try to send |
5260 // close packet. | 5255 // close packet. |
5261 AlwaysGetPacketTooLarge(); | 5256 AlwaysGetPacketTooLarge(); |
5262 if (!FLAGS_quic_only_track_sent_packets) { | |
5263 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); | |
5264 } | |
5265 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, | 5257 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, |
5266 ConnectionCloseSource::FROM_SELF)) | 5258 ConnectionCloseSource::FROM_SELF)) |
5267 .Times(1); | 5259 .Times(1); |
5268 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); | 5260 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); |
5269 } | 5261 } |
5270 | 5262 |
5271 // Verify that if connection has no outstanding data, it notifies the send | 5263 // Verify that if connection has no outstanding data, it notifies the send |
5272 // algorithm after the write. | 5264 // algorithm after the write. |
5273 TEST_P(QuicConnectionTest, SendDataAndBecomeApplicationLimited) { | 5265 TEST_P(QuicConnectionTest, SendDataAndBecomeApplicationLimited) { |
5274 EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(1); | 5266 EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(1); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5321 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); | 5313 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); |
5322 EXPECT_EQ(1u, writer_->frame_count()); | 5314 EXPECT_EQ(1u, writer_->frame_count()); |
5323 EXPECT_FALSE(writer_->connection_close_frames().empty()); | 5315 EXPECT_FALSE(writer_->connection_close_frames().empty()); |
5324 // Ack frame is not bundled in connection close packet. | 5316 // Ack frame is not bundled in connection close packet. |
5325 EXPECT_TRUE(writer_->ack_frames().empty()); | 5317 EXPECT_TRUE(writer_->ack_frames().empty()); |
5326 } | 5318 } |
5327 | 5319 |
5328 } // namespace | 5320 } // namespace |
5329 } // namespace test | 5321 } // namespace test |
5330 } // namespace net | 5322 } // namespace net |
OLD | NEW |