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

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

Issue 555653002: Send an ack when it 20 packets have been received since the last ack was (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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') | no next file » | 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/stl_util.h" 9 #include "base/stl_util.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 EXPECT_EQ(3u, writer_->frame_count()); 1270 EXPECT_EQ(3u, writer_->frame_count());
1271 EXPECT_EQ(1u, writer_->stream_frames().size()); 1271 EXPECT_EQ(1u, writer_->stream_frames().size());
1272 EXPECT_FALSE(writer_->ack_frames().empty()); 1272 EXPECT_FALSE(writer_->ack_frames().empty());
1273 1273
1274 // But an ack with no missing packets will not send an ack. 1274 // But an ack with no missing packets will not send an ack.
1275 AckPacket(original, &frame2); 1275 AckPacket(original, &frame2);
1276 ProcessAckPacket(&frame2); 1276 ProcessAckPacket(&frame2);
1277 ProcessAckPacket(&frame2); 1277 ProcessAckPacket(&frame2);
1278 } 1278 }
1279 1279
1280 TEST_P(QuicConnectionTest, 20AcksCausesAckSend) {
1281 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1282
1283 SendStreamDataToPeer(1, "foo", 0, !kFin, NULL);
1284
1285 QuicAlarm* ack_alarm = QuicConnectionPeer::GetAckAlarm(&connection_);
1286 // But an ack with no missing packets will not send an ack.
1287 QuicAckFrame frame = InitAckFrame(1);
1288 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
1289 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
1290 .WillRepeatedly(Return(SequenceNumberSet()));
1291 for (int i = 0; i < 20; ++i) {
1292 EXPECT_FALSE(ack_alarm->IsSet());
1293 ProcessAckPacket(&frame);
1294 }
1295 EXPECT_TRUE(ack_alarm->IsSet());
1296 }
1297
1280 TEST_P(QuicConnectionTest, LeastUnackedLower) { 1298 TEST_P(QuicConnectionTest, LeastUnackedLower) {
1281 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 1299 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1282 1300
1283 SendStreamDataToPeer(1, "foo", 0, !kFin, NULL); 1301 SendStreamDataToPeer(1, "foo", 0, !kFin, NULL);
1284 SendStreamDataToPeer(1, "bar", 3, !kFin, NULL); 1302 SendStreamDataToPeer(1, "bar", 3, !kFin, NULL);
1285 SendStreamDataToPeer(1, "eep", 6, !kFin, NULL); 1303 SendStreamDataToPeer(1, "eep", 6, !kFin, NULL);
1286 1304
1287 // Start out saying the least unacked is 2. 1305 // Start out saying the least unacked is 2.
1288 peer_creator_.set_sequence_number(5); 1306 peer_creator_.set_sequence_number(5);
1289 QuicStopWaitingFrame frame = InitStopWaitingFrame(2); 1307 QuicStopWaitingFrame frame = InitStopWaitingFrame(2);
(...skipping 2586 matching lines...) Expand 10 before | Expand all | Expand 10 after
3876 QuicBlockedFrame blocked; 3894 QuicBlockedFrame blocked;
3877 blocked.stream_id = 3; 3895 blocked.stream_id = 3;
3878 EXPECT_CALL(visitor_, OnBlockedFrames(_)); 3896 EXPECT_CALL(visitor_, OnBlockedFrames(_));
3879 ProcessFramePacket(QuicFrame(&blocked)); 3897 ProcessFramePacket(QuicFrame(&blocked));
3880 EXPECT_TRUE(ack_alarm->IsSet()); 3898 EXPECT_TRUE(ack_alarm->IsSet());
3881 } 3899 }
3882 3900
3883 } // namespace 3901 } // namespace
3884 } // namespace test 3902 } // namespace test
3885 } // namespace net 3903 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698