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

Unified Diff: net/quic/quic_connection_test.cc

Issue 2002083002: Add QuicSentPacketManagerInterface, and QuicSentPacketManager implements it. No functional change e… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_flow_controller_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection_test.cc
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index 760ef02c90927d3e383a5ff488d0e2f8f6651027..12dfa948b4708e1e7c166c1550322559931ef8b0 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -469,8 +469,11 @@ class TestConnection : public QuicConnection {
}
void SetLossAlgorithm(LossDetectionInterface* loss_algorithm) {
+ // TODO(fayang): connection tests should use MockSentPacketManager.
QuicSentPacketManagerPeer::SetLossAlgorithm(
- QuicConnectionPeer::GetSentPacketManager(this), loss_algorithm);
+ static_cast<QuicSentPacketManager*>(
+ QuicConnectionPeer::GetSentPacketManager(this)),
+ loss_algorithm);
}
void SendPacket(EncryptionLevel level,
@@ -1362,7 +1365,7 @@ TEST_P(QuicConnectionTest, TruncatedAck) {
ProcessAckPacket(&frame);
// A truncated ack will not have the true largest observed.
- EXPECT_GT(num_packets, manager_->largest_observed());
+ EXPECT_GT(num_packets, manager_->GetLargestObserved(frame.path_id));
AckPacket(192, &frame);
@@ -1371,7 +1374,7 @@ TEST_P(QuicConnectionTest, TruncatedAck) {
EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _, _));
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
ProcessAckPacket(&frame);
- EXPECT_EQ(num_packets, manager_->largest_observed());
+ EXPECT_EQ(num_packets, manager_->GetLargestObserved(frame.path_id));
}
TEST_P(QuicConnectionTest, AckReceiptCausesAckSendBadEntropy) {
@@ -2351,7 +2354,8 @@ TEST_P(QuicConnectionTest, RetransmitWriteBlockedAckedOriginalThenSent) {
connection_.OnCanWrite();
// There is now a pending packet, but with no retransmittable frames.
EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet());
- EXPECT_FALSE(connection_.sent_packet_manager().HasRetransmittableFrames(2));
+ EXPECT_FALSE(connection_.sent_packet_manager().HasRetransmittableFrames(
+ ack.path_id, 2));
}
TEST_P(QuicConnectionTest, AlarmsWhenWriteBlocked) {
@@ -3438,8 +3442,8 @@ TEST_P(QuicConnectionTest, TimeoutAfter5RTOs) {
EXPECT_TRUE(connection_.connected());
}
- EXPECT_EQ(2u, connection_.sent_packet_manager().consecutive_tlp_count());
- EXPECT_EQ(4u, connection_.sent_packet_manager().consecutive_rto_count());
+ EXPECT_EQ(2u, connection_.sent_packet_manager().GetConsecutiveTlpCount());
+ EXPECT_EQ(4u, connection_.sent_packet_manager().GetConsecutiveRtoCount());
// This time, we should time out.
EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_TOO_MANY_RTOS, _,
ConnectionCloseSource::FROM_SELF));
@@ -4768,14 +4772,20 @@ TEST_P(QuicConnectionTest, OnPacketHeaderDebugVisitor) {
}
TEST_P(QuicConnectionTest, Pacing) {
+ // static_cast here does not work if using multipath_sent_packet_manager.
+ FLAGS_quic_enable_multipath = false;
TestConnection server(connection_id_, kSelfAddress, helper_.get(),
alarm_factory_.get(), writer_.get(),
Perspective::IS_SERVER, version());
TestConnection client(connection_id_, kPeerAddress, helper_.get(),
alarm_factory_.get(), writer_.get(),
Perspective::IS_CLIENT, version());
- EXPECT_FALSE(client.sent_packet_manager().using_pacing());
- EXPECT_FALSE(server.sent_packet_manager().using_pacing());
+ EXPECT_FALSE(QuicSentPacketManagerPeer::UsingPacing(
+ static_cast<const QuicSentPacketManager*>(
+ &client.sent_packet_manager())));
+ EXPECT_FALSE(QuicSentPacketManagerPeer::UsingPacing(
+ static_cast<const QuicSentPacketManager*>(
+ &server.sent_packet_manager())));
}
TEST_P(QuicConnectionTest, WindowUpdateInstigateAcks) {
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_flow_controller_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698