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

Unified Diff: net/quic/quic_connection_test.cc

Issue 288313003: Land Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: implemented rch's comments Created 6 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
Index: net/quic/quic_connection_test.cc
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index 6ca7c30e215b96fd8f31f9d7dc83192bfb183906..48cb2db1665d3a768f9d446f002e4cb381d0359b 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -419,11 +419,9 @@ class TestConnection : public QuicConnection {
TestConnectionHelper* helper,
TestPacketWriter* writer,
bool is_server,
- QuicVersion version,
- uint32 flow_control_send_window)
+ QuicVersion version)
: QuicConnection(connection_id, address, helper, writer, is_server,
- SupportedVersions(version),
- flow_control_send_window),
+ SupportedVersions(version)),
writer_(writer) {
// Disable tail loss probes for most tests.
QuicSentPacketManagerPeer::SetMaxTailLossProbes(
@@ -588,8 +586,7 @@ class QuicConnectionTest : public ::testing::TestWithParam<QuicVersion> {
helper_(new TestConnectionHelper(&clock_, &random_generator_)),
writer_(new TestPacketWriter(version())),
connection_(connection_id_, IPEndPoint(), helper_.get(),
- writer_.get(), false, version(),
- kDefaultFlowControlSendWindow),
+ writer_.get(), false, version()),
frame1_(1, false, 0, MakeIOVector(data1)),
frame2_(1, false, 3, MakeIOVector(data2)),
sequence_number_length_(PACKET_6BYTE_SEQUENCE_NUMBER),
@@ -613,7 +610,7 @@ class QuicConnectionTest : public ::testing::TestWithParam<QuicVersion> {
Return(kMaxPacketSize));
ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
.WillByDefault(Return(true));
- EXPECT_CALL(visitor_, HasPendingWrites()).Times(AnyNumber());
+ EXPECT_CALL(visitor_, WillingAndAbleToWrite()).Times(AnyNumber());
EXPECT_CALL(visitor_, HasPendingHandshake()).Times(AnyNumber());
EXPECT_CALL(visitor_, OnCanWrite()).Times(AnyNumber());
EXPECT_CALL(visitor_, HasOpenDataStreams()).WillRepeatedly(Return(false));
@@ -1444,7 +1441,8 @@ TEST_P(QuicConnectionTest, FECSending) {
connection_.version(), kIncludeVersion, PACKET_1BYTE_SEQUENCE_NUMBER,
IN_FEC_GROUP, &payload_length);
// And send FEC every two packets.
- connection_.options()->max_packets_per_fec_group = 2;
+ EXPECT_TRUE(QuicPacketCreatorPeer::SwitchFecProtectionOn(
+ QuicConnectionPeer::GetPacketCreator(&connection_), 2));
// Send 4 data packets and 2 FEC packets.
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(6);
@@ -1463,7 +1461,8 @@ TEST_P(QuicConnectionTest, FECQueueing) {
connection_.version(), kIncludeVersion, PACKET_1BYTE_SEQUENCE_NUMBER,
IN_FEC_GROUP, &payload_length);
// And send FEC every two packets.
- connection_.options()->max_packets_per_fec_group = 2;
+ EXPECT_TRUE(QuicPacketCreatorPeer::SwitchFecProtectionOn(
+ QuicConnectionPeer::GetPacketCreator(&connection_), 2));
EXPECT_EQ(0u, connection_.NumQueuedPackets());
BlockOnNextWrite();
@@ -1475,7 +1474,9 @@ TEST_P(QuicConnectionTest, FECQueueing) {
}
TEST_P(QuicConnectionTest, AbandonFECFromCongestionWindow) {
- connection_.options()->max_packets_per_fec_group = 1;
+ EXPECT_TRUE(QuicPacketCreatorPeer::SwitchFecProtectionOn(
+ QuicConnectionPeer::GetPacketCreator(&connection_), 1));
+
// 1 Data and 1 FEC packet.
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL);
@@ -1493,7 +1494,8 @@ TEST_P(QuicConnectionTest, AbandonFECFromCongestionWindow) {
TEST_P(QuicConnectionTest, DontAbandonAckedFEC) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- connection_.options()->max_packets_per_fec_group = 1;
+ EXPECT_TRUE(QuicPacketCreatorPeer::SwitchFecProtectionOn(
+ QuicConnectionPeer::GetPacketCreator(&connection_), 1));
// 1 Data and 1 FEC packet.
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(6);
@@ -1520,7 +1522,8 @@ TEST_P(QuicConnectionTest, DontAbandonAckedFEC) {
TEST_P(QuicConnectionTest, AbandonAllFEC) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- connection_.options()->max_packets_per_fec_group = 1;
+ EXPECT_TRUE(QuicPacketCreatorPeer::SwitchFecProtectionOn(
+ QuicConnectionPeer::GetPacketCreator(&connection_), 1));
// 1 Data and 1 FEC packet.
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(6);
@@ -1645,7 +1648,9 @@ TEST_P(QuicConnectionTest, FramePackingFEC) {
return;
}
// Enable fec.
- connection_.options()->max_packets_per_fec_group = 6;
+ EXPECT_TRUE(QuicPacketCreatorPeer::SwitchFecProtectionOn(
+ QuicConnectionPeer::GetPacketCreator(&connection_), 6));
+
// Block the connection.
connection_.GetSendAlarm()->Set(
clock_.ApproximateNow().Add(QuicTime::Delta::FromSeconds(1)));
@@ -1778,7 +1783,7 @@ TEST_P(QuicConnectionTest, OnCanWrite) {
&TestConnection::SendStreamData3)),
IgnoreResult(InvokeWithoutArgs(&connection_,
&TestConnection::SendStreamData5))));
- EXPECT_CALL(visitor_, HasPendingWrites()).WillOnce(Return(true));
+ EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillOnce(Return(true));
EXPECT_CALL(*send_algorithm_,
TimeUntilSend(_, _, _)).WillRepeatedly(
testing::Return(QuicTime::Delta::Zero()));
@@ -3948,11 +3953,9 @@ TEST_P(QuicConnectionTest, Pacing) {
ValueRestore<bool> old_flag(&FLAGS_enable_quic_pacing, true);
TestConnection server(connection_id_, IPEndPoint(), helper_.get(),
- writer_.get(), true, version(),
- kDefaultFlowControlSendWindow);
+ writer_.get(), true, version());
TestConnection client(connection_id_, IPEndPoint(), helper_.get(),
- writer_.get(), false, version(),
- kDefaultFlowControlSendWindow);
+ writer_.get(), false, version());
EXPECT_TRUE(client.sent_packet_manager().using_pacing());
EXPECT_FALSE(server.sent_packet_manager().using_pacing());
}
@@ -3980,17 +3983,6 @@ TEST_P(QuicConnectionTest, ControlFramesInstigateAcks) {
EXPECT_TRUE(ack_alarm->IsSet());
}
-TEST_P(QuicConnectionTest, InvalidFlowControlWindow) {
- ValueRestore<bool> old_flag(&FLAGS_enable_quic_pacing, true);
-
- const uint32 kSmallerFlowControlWindow = kDefaultFlowControlSendWindow - 1;
- TestConnection connection(connection_id_, IPEndPoint(), helper_.get(),
- writer_.get(), true, version(),
- kSmallerFlowControlWindow);
- EXPECT_EQ(kDefaultFlowControlSendWindow,
- connection.max_flow_control_receive_window_bytes());
-}
-
} // namespace
} // namespace test
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698