| 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/quic_connection.h" | 5 #include "net/quic/quic_connection.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 for (int i = 0; i < 1100; ++i) { | 1320 for (int i = 0; i < 1100; ++i) { |
| 1321 SendStreamDataToPeer(1, "foo", 3 * i, !kFin, nullptr); | 1321 SendStreamDataToPeer(1, "foo", 3 * i, !kFin, nullptr); |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 // Ack packet 1, which leaves more than the limit outstanding. | 1324 // Ack packet 1, which leaves more than the limit outstanding. |
| 1325 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); | 1325 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
| 1326 if (FLAGS_quic_too_many_outstanding_packets) { | 1326 if (FLAGS_quic_too_many_outstanding_packets) { |
| 1327 EXPECT_CALL(visitor_, | 1327 EXPECT_CALL(visitor_, |
| 1328 OnConnectionClosed(QUIC_TOO_MANY_OUTSTANDING_SENT_PACKETS, | 1328 OnConnectionClosed(QUIC_TOO_MANY_OUTSTANDING_SENT_PACKETS, |
| 1329 false)); | 1329 false)); |
| 1330 EXPECT_CALL(visitor_, OnCanWrite()).Times(0); | |
| 1331 } else { | |
| 1332 EXPECT_CALL(visitor_, OnCanWrite()).Times(1); | |
| 1333 } | 1330 } |
| 1331 // We're receive buffer limited, so the connection won't try to write more. |
| 1332 EXPECT_CALL(visitor_, OnCanWrite()).Times(0); |
| 1333 |
| 1334 // Nack every packet except the last one, leaving a huge gap. | 1334 // Nack every packet except the last one, leaving a huge gap. |
| 1335 QuicAckFrame frame1 = InitAckFrame(1100); | 1335 QuicAckFrame frame1 = InitAckFrame(1100); |
| 1336 for (QuicPacketSequenceNumber i = 1; i < 1100; ++i) { | 1336 for (QuicPacketSequenceNumber i = 1; i < 1100; ++i) { |
| 1337 NackPacket(i, &frame1); | 1337 NackPacket(i, &frame1); |
| 1338 } | 1338 } |
| 1339 ProcessAckPacket(&frame1); | 1339 ProcessAckPacket(&frame1); |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 TEST_P(QuicConnectionTest, TooManyReceivedPackets) { | 1342 TEST_P(QuicConnectionTest, TooManyReceivedPackets) { |
| 1343 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 1343 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| (...skipping 2763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4107 QuicBlockedFrame blocked; | 4107 QuicBlockedFrame blocked; |
| 4108 blocked.stream_id = 3; | 4108 blocked.stream_id = 3; |
| 4109 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 4109 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
| 4110 ProcessFramePacket(QuicFrame(&blocked)); | 4110 ProcessFramePacket(QuicFrame(&blocked)); |
| 4111 EXPECT_TRUE(ack_alarm->IsSet()); | 4111 EXPECT_TRUE(ack_alarm->IsSet()); |
| 4112 } | 4112 } |
| 4113 | 4113 |
| 4114 } // namespace | 4114 } // namespace |
| 4115 } // namespace test | 4115 } // namespace test |
| 4116 } // namespace net | 4116 } // namespace net |
| OLD | NEW |