Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1315)

Side by Side Diff: net/quic/quic_connection_test.cc

Issue 1003863006: Rollback of merge internal change: 87346681. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Make_SentPacketManager_remove_pending_88507368
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); 1325 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
1326 QuicPacketCreatorPeer::SetSequenceNumber(&peer_creator_, 7); 1326 QuicPacketCreatorPeer::SetSequenceNumber(&peer_creator_, 7);
1327 EXPECT_CALL(visitor_, 1327 EXPECT_CALL(visitor_,
1328 OnConnectionClosed(QUIC_INVALID_STOP_WAITING_DATA, false)); 1328 OnConnectionClosed(QUIC_INVALID_STOP_WAITING_DATA, false));
1329 QuicStopWaitingFrame frame3 = InitStopWaitingFrame(1); 1329 QuicStopWaitingFrame frame3 = InitStopWaitingFrame(1);
1330 ProcessStopWaitingPacket(&frame3); 1330 ProcessStopWaitingPacket(&frame3);
1331 } 1331 }
1332 1332
1333 TEST_P(QuicConnectionTest, TooManySentPackets) { 1333 TEST_P(QuicConnectionTest, TooManySentPackets) {
1334 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 1334 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1335 const QuicPacketCount num_sent_packets = kMaxTrackedPackets + 100; 1335
1336 for (QuicPacketCount i = 0; i < num_sent_packets; ++i) { 1336 for (int i = 0; i < 1100; ++i) {
1337 SendStreamDataToPeer(1, "foo", 3 * i, !kFin, nullptr); 1337 SendStreamDataToPeer(1, "foo", 3 * i, !kFin, nullptr);
1338 } 1338 }
1339 1339
1340 // Ack packet 1, which leaves more than the limit outstanding. 1340 // Ack packet 1, which leaves more than the limit outstanding.
1341 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); 1341 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
1342 EXPECT_CALL(visitor_, OnConnectionClosed( 1342 EXPECT_CALL(visitor_, OnConnectionClosed(
1343 QUIC_TOO_MANY_OUTSTANDING_SENT_PACKETS, false)); 1343 QUIC_TOO_MANY_OUTSTANDING_SENT_PACKETS, false));
1344 // We're receive buffer limited, so the connection won't try to write more. 1344 // We're receive buffer limited, so the connection won't try to write more.
1345 EXPECT_CALL(visitor_, OnCanWrite()).Times(0); 1345 EXPECT_CALL(visitor_, OnCanWrite()).Times(0);
1346 1346
1347 // Nack every packet except the last one, leaving a huge gap. 1347 // Nack every packet except the last one, leaving a huge gap.
1348 QuicAckFrame frame1 = InitAckFrame(num_sent_packets); 1348 QuicAckFrame frame1 = InitAckFrame(1100);
1349 for (QuicPacketSequenceNumber i = 1; i < num_sent_packets; ++i) { 1349 for (QuicPacketSequenceNumber i = 1; i < 1100; ++i) {
1350 NackPacket(i, &frame1); 1350 NackPacket(i, &frame1);
1351 } 1351 }
1352 ProcessAckPacket(&frame1); 1352 ProcessAckPacket(&frame1);
1353 } 1353 }
1354 1354
1355 TEST_P(QuicConnectionTest, TooManyReceivedPackets) { 1355 TEST_P(QuicConnectionTest, TooManyReceivedPackets) {
1356 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 1356 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1357 EXPECT_CALL(visitor_, OnConnectionClosed( 1357 EXPECT_CALL(visitor_, OnConnectionClosed(
1358 QUIC_TOO_MANY_OUTSTANDING_RECEIVED_PACKETS, false)); 1358 QUIC_TOO_MANY_OUTSTANDING_RECEIVED_PACKETS, false));
1359 1359
1360 // Miss every other packet for 5000 packets. 1360 // Miss every other packet for 1000 packets.
1361 for (QuicPacketSequenceNumber i = 1; i < kMaxTrackedPackets; ++i) { 1361 for (QuicPacketSequenceNumber i = 1; i < 1000; ++i) {
1362 ProcessPacket(i * 2); 1362 ProcessPacket(i * 2);
1363 if (!connection_.connected()) { 1363 if (!connection_.connected()) {
1364 break; 1364 break;
1365 } 1365 }
1366 } 1366 }
1367 } 1367 }
1368 1368
1369 TEST_P(QuicConnectionTest, LargestObservedLower) { 1369 TEST_P(QuicConnectionTest, LargestObservedLower) {
1370 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 1370 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1371 1371
(...skipping 2979 matching lines...) Expand 10 before | Expand all | Expand 10 after
4351 // Regression test for b/18594622 4351 // Regression test for b/18594622
4352 scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate); 4352 scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate);
4353 EXPECT_DFATAL( 4353 EXPECT_DFATAL(
4354 connection_.SendStreamDataWithString(3, "", 0, !kFin, delegate.get()), 4354 connection_.SendStreamDataWithString(3, "", 0, !kFin, delegate.get()),
4355 "Attempt to send empty stream frame"); 4355 "Attempt to send empty stream frame");
4356 } 4356 }
4357 4357
4358 } // namespace 4358 } // namespace
4359 } // namespace test 4359 } // namespace test
4360 } // namespace net 4360 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698