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

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

Issue 1813513002: Deprecate quic_respect_send_alarm2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@116877752
Patch Set: Created 4 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_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/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); 1308 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
1309 ProcessAckPacket(&frame); 1309 ProcessAckPacket(&frame);
1310 EXPECT_EQ(num_packets, manager_->largest_observed()); 1310 EXPECT_EQ(num_packets, manager_->largest_observed());
1311 } 1311 }
1312 1312
1313 TEST_P(QuicConnectionTest, AckReceiptCausesAckSendBadEntropy) { 1313 TEST_P(QuicConnectionTest, AckReceiptCausesAckSendBadEntropy) {
1314 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 1314 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1315 1315
1316 ProcessPacket(kDefaultPathId, 1); 1316 ProcessPacket(kDefaultPathId, 1);
1317 // Delay sending, then queue up an ack. 1317 // Delay sending, then queue up an ack.
1318 if (!FLAGS_quic_respect_send_alarm2) {
1319 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
1320 .WillOnce(testing::Return(QuicTime::Delta::FromMicroseconds(1)));
1321 }
1322 QuicConnectionPeer::SendAck(&connection_); 1318 QuicConnectionPeer::SendAck(&connection_);
1323 1319
1324 // Process an ack with a least unacked of the received ack. 1320 // Process an ack with a least unacked of the received ack.
1325 // This causes an ack to be sent when TimeUntilSend returns 0. 1321 // This causes an ack to be sent when TimeUntilSend returns 0.
1326 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) 1322 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
1327 .WillRepeatedly(testing::Return(QuicTime::Delta::Zero())); 1323 .WillRepeatedly(testing::Return(QuicTime::Delta::Zero()));
1328 // Skip a packet and then record an ack. 1324 // Skip a packet and then record an ack.
1329 QuicAckFrame frame = InitAckFrame(0); 1325 QuicAckFrame frame = InitAckFrame(0);
1330 ProcessAckPacket(3, &frame); 1326 ProcessAckPacket(3, &frame);
1331 } 1327 }
(...skipping 3233 matching lines...) Expand 10 before | Expand all | Expand 10 after
4565 TEST_P(QuicConnectionTest, DoNotSendGoAwayTwice) { 4561 TEST_P(QuicConnectionTest, DoNotSendGoAwayTwice) {
4566 EXPECT_FALSE(connection_.goaway_sent()); 4562 EXPECT_FALSE(connection_.goaway_sent());
4567 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); 4563 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
4568 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away."); 4564 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away.");
4569 EXPECT_TRUE(connection_.goaway_sent()); 4565 EXPECT_TRUE(connection_.goaway_sent());
4570 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0); 4566 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0);
4571 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away."); 4567 connection_.SendGoAway(QUIC_PEER_GOING_AWAY, kHeadersStreamId, "Going Away.");
4572 } 4568 }
4573 4569
4574 TEST_P(QuicConnectionTest, ReevaluateTimeUntilSendOnAck) { 4570 TEST_P(QuicConnectionTest, ReevaluateTimeUntilSendOnAck) {
4575 ValueRestore<bool> old_flag(&FLAGS_quic_respect_send_alarm2, true);
4576 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 4571 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
4577 connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 0, !kFin, 4572 connection_.SendStreamDataWithString(kClientDataStreamId1, "foo", 0, !kFin,
4578 nullptr); 4573 nullptr);
4579 4574
4580 // Evaluate CanWrite, and have it return a non-Zero value. 4575 // Evaluate CanWrite, and have it return a non-Zero value.
4581 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) 4576 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
4582 .WillRepeatedly(Return(QuicTime::Delta::FromMilliseconds(1))); 4577 .WillRepeatedly(Return(QuicTime::Delta::FromMilliseconds(1)));
4583 connection_.OnCanWrite(); 4578 connection_.OnCanWrite();
4584 EXPECT_TRUE(connection_.GetSendAlarm()->IsSet()); 4579 EXPECT_TRUE(connection_.GetSendAlarm()->IsSet());
4585 EXPECT_EQ(clock_.Now().Add(QuicTime::Delta::FromMilliseconds(1)), 4580 EXPECT_EQ(clock_.Now().Add(QuicTime::Delta::FromMilliseconds(1)),
4586 connection_.GetSendAlarm()->deadline()); 4581 connection_.GetSendAlarm()->deadline());
4587 4582
4588 // Process an ack and the send alarm will be set to the new 2ms delay. 4583 // Process an ack and the send alarm will be set to the new 2ms delay.
4589 QuicAckFrame ack = InitAckFrame(1); 4584 QuicAckFrame ack = InitAckFrame(1);
4590 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)); 4585 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _));
4591 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); 4586 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
4592 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)) 4587 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
4593 .WillRepeatedly(Return(QuicTime::Delta::FromMilliseconds(2))); 4588 .WillRepeatedly(Return(QuicTime::Delta::FromMilliseconds(2)));
4594 ProcessAckPacket(&ack); 4589 ProcessAckPacket(&ack);
4595 EXPECT_EQ(1u, writer_->frame_count()); 4590 EXPECT_EQ(1u, writer_->frame_count());
4596 EXPECT_EQ(1u, writer_->stream_frames().size()); 4591 EXPECT_EQ(1u, writer_->stream_frames().size());
4597 EXPECT_TRUE(connection_.GetSendAlarm()->IsSet()); 4592 EXPECT_TRUE(connection_.GetSendAlarm()->IsSet());
4598 EXPECT_EQ(clock_.Now().Add(QuicTime::Delta::FromMilliseconds(2)), 4593 EXPECT_EQ(clock_.Now().Add(QuicTime::Delta::FromMilliseconds(2)),
4599 connection_.GetSendAlarm()->deadline()); 4594 connection_.GetSendAlarm()->deadline());
4600 writer_->Reset(); 4595 writer_->Reset();
4601 } 4596 }
4602 4597
4603 TEST_P(QuicConnectionTest, SendAcksImmediately) { 4598 TEST_P(QuicConnectionTest, SendAcksImmediately) {
4604 FLAGS_quic_respect_send_alarm2 = true;
4605 CongestionBlockWrites(); 4599 CongestionBlockWrites();
4606 SendAckPacketToPeer(); 4600 SendAckPacketToPeer();
4607 } 4601 }
4608 4602
4609 TEST_P(QuicConnectionTest, SendPingImmediately) { 4603 TEST_P(QuicConnectionTest, SendPingImmediately) {
4610 CongestionBlockWrites(); 4604 CongestionBlockWrites();
4611 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1); 4605 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
4612 connection_.SendPing(); 4606 connection_.SendPing();
4613 EXPECT_FALSE(connection_.HasQueuedData()); 4607 EXPECT_FALSE(connection_.HasQueuedData());
4614 } 4608 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
4703 // result in multiple attempts to close the connection - it will be marked as 4697 // result in multiple attempts to close the connection - it will be marked as
4704 // disconnected after the first call. 4698 // disconnected after the first call.
4705 EXPECT_CALL(visitor_, OnConnectionClosed(_, _)).Times(1); 4699 EXPECT_CALL(visitor_, OnConnectionClosed(_, _)).Times(1);
4706 connection_.SendConnectionCloseWithDetails(QUIC_NO_ERROR, "no reason"); 4700 connection_.SendConnectionCloseWithDetails(QUIC_NO_ERROR, "no reason");
4707 connection_.SendConnectionCloseWithDetails(QUIC_NO_ERROR, "no reason"); 4701 connection_.SendConnectionCloseWithDetails(QUIC_NO_ERROR, "no reason");
4708 } 4702 }
4709 4703
4710 } // namespace 4704 } // namespace
4711 } // namespace test 4705 } // namespace test
4712 } // namespace net 4706 } // 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