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

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

Issue 1466153002: Clear the connection's send alarm when a new ack is received. Flag protected by gfe2_reloadable_fl… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@107691686
Patch Set: Created 5 years 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_flags.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 <ostream> 7 #include <ostream>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 5231 matching lines...) Expand 10 before | Expand all | Expand 10 after
5242 5242
5243 TEST_P(QuicConnectionTest, DoNotSendGoAwayTwice) { 5243 TEST_P(QuicConnectionTest, DoNotSendGoAwayTwice) {
5244 EXPECT_FALSE(connection_.goaway_sent()); 5244 EXPECT_FALSE(connection_.goaway_sent());
5245 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); 5245 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
5246 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away."); 5246 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away.");
5247 EXPECT_TRUE(connection_.goaway_sent()); 5247 EXPECT_TRUE(connection_.goaway_sent());
5248 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); 5248 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0);
5249 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away."); 5249 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away.");
5250 } 5250 }
5251 5251
5252 TEST_P(QuicConnectionTest, ReevaluateTimeUntilSendOnAck) {
5253 FLAGS_quic_respect_send_alarm = true;
5254 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
5255 connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 0, !kFin,
5256 nullptr);
5257
5258 // Evaluate CanWrite, and have it return a non-Zero value.
5259 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
5260 .WillRepeatedly(Return(QuicTime::Delta::FromMilliseconds(1)));
5261 connection_.OnCanWrite();
5262 EXPECT_TRUE(connection_.GetSendAlarm()->IsSet());
5263 EXPECT_EQ(clock_.Now().Add(QuicTime::Delta::FromMilliseconds(1)),
5264 connection_.GetSendAlarm()->deadline());
5265
5266 // Process an ack and the send alarm will be set to the new 2ms delay.
5267 QuicAckFrame ack = InitAckFrame(1);
5268 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _));
5269 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
5270 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
5271 .WillRepeatedly(Return(QuicTime::Delta::FromMilliseconds(2)));
5272 ProcessAckPacket(&ack);
5273 EXPECT_EQ(1u, writer_->frame_count());
5274 EXPECT_EQ(1u, writer_->stream_frames().size());
5275 EXPECT_TRUE(connection_.GetSendAlarm()->IsSet());
5276 EXPECT_EQ(clock_.Now().Add(QuicTime::Delta::FromMilliseconds(2)),
5277 connection_.GetSendAlarm()->deadline());
5278 writer_->Reset();
5279 }
5280
5252 } // namespace 5281 } // namespace
5253 } // namespace test 5282 } // namespace test
5254 } // namespace net 5283 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698