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 5167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5178 frame1_.data_buffer = data->data(); | 5178 frame1_.data_buffer = data->data(); |
5179 frame1_.data_length = data->length(); | 5179 frame1_.data_length = data->length(); |
5180 | 5180 |
5181 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_MAYBE_CORRUPTED_MEMORY, _, | 5181 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_MAYBE_CORRUPTED_MEMORY, _, |
5182 ConnectionCloseSource::FROM_SELF)); | 5182 ConnectionCloseSource::FROM_SELF)); |
5183 ForceProcessFramePacket(QuicFrame(&frame1_)); | 5183 ForceProcessFramePacket(QuicFrame(&frame1_)); |
5184 } | 5184 } |
5185 | 5185 |
5186 TEST_P(QuicConnectionTest, CloseConnectionOnPacketTooLarge) { | 5186 TEST_P(QuicConnectionTest, CloseConnectionOnPacketTooLarge) { |
5187 SimulateNextPacketTooLarge(); | 5187 SimulateNextPacketTooLarge(); |
5188 // Although the data packet cannot be written, the send packet manager is | 5188 if (!FLAGS_quic_only_track_sent_packets) { |
5189 // informed. Also a connection close packet is sent. | 5189 // Although the data packet cannot be written, the send packet manager is |
5190 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); | 5190 // informed. |
| 5191 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); |
| 5192 } |
| 5193 // A connection close packet is sent |
5191 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, | 5194 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, |
5192 ConnectionCloseSource::FROM_SELF)) | 5195 ConnectionCloseSource::FROM_SELF)) |
5193 .Times(1); | 5196 .Times(1); |
5194 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); | 5197 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); |
5195 } | 5198 } |
5196 | 5199 |
5197 TEST_P(QuicConnectionTest, AlwaysGetPacketTooLarge) { | 5200 TEST_P(QuicConnectionTest, AlwaysGetPacketTooLarge) { |
5198 // Test even we always get packet too large, we do not infinitely try to send | 5201 // Test even we always get packet too large, we do not infinitely try to send |
5199 // close packet. | 5202 // close packet. |
5200 AlwaysGetPacketTooLarge(); | 5203 AlwaysGetPacketTooLarge(); |
5201 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); | 5204 if (!FLAGS_quic_only_track_sent_packets) { |
| 5205 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); |
| 5206 } |
5202 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, | 5207 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, |
5203 ConnectionCloseSource::FROM_SELF)) | 5208 ConnectionCloseSource::FROM_SELF)) |
5204 .Times(1); | 5209 .Times(1); |
5205 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); | 5210 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); |
5206 } | 5211 } |
5207 | 5212 |
5208 // Verify that if connection has no outstanding data, it notifies the send | 5213 // Verify that if connection has no outstanding data, it notifies the send |
5209 // algorithm after the write. | 5214 // algorithm after the write. |
5210 TEST_P(QuicConnectionTest, SendDataAndBecomeApplicationLimited) { | 5215 TEST_P(QuicConnectionTest, SendDataAndBecomeApplicationLimited) { |
5211 EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(1); | 5216 EXPECT_CALL(*send_algorithm_, OnApplicationLimited(_)).Times(1); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5258 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); | 5263 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); |
5259 EXPECT_EQ(1u, writer_->frame_count()); | 5264 EXPECT_EQ(1u, writer_->frame_count()); |
5260 EXPECT_FALSE(writer_->connection_close_frames().empty()); | 5265 EXPECT_FALSE(writer_->connection_close_frames().empty()); |
5261 // Ack frame is not bundled in connection close packet. | 5266 // Ack frame is not bundled in connection close packet. |
5262 EXPECT_TRUE(writer_->ack_frames().empty()); | 5267 EXPECT_TRUE(writer_->ack_frames().empty()); |
5263 } | 5268 } |
5264 | 5269 |
5265 } // namespace | 5270 } // namespace |
5266 } // namespace test | 5271 } // namespace test |
5267 } // namespace net | 5272 } // namespace net |
OLD | NEW |