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

Unified Diff: net/quic/quic_connection_test.cc

Issue 916143004: Change the initial maximum packet size for a QUIC server to 1000 bytes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Adding_DCHECKS_in_crypto_stream_86300482
Patch Set: Created 5 years, 10 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_flags.h » ('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 a25065eb8463ad5b5eb06d5d631e116ac51c0f06..0dc817c762b80e59ee8beda1ac3f568e6a39a362 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -1004,6 +1004,64 @@ INSTANTIATE_TEST_CASE_P(SupportedVersion,
QuicConnectionTest,
::testing::ValuesIn(QuicSupportedVersions()));
+TEST_P(QuicConnectionTest, MaxPacketSize) {
+ EXPECT_FALSE(connection_.is_server());
+ EXPECT_EQ(1350u, connection_.max_packet_length());
+}
+
+TEST_P(QuicConnectionTest, SmallerServerMaxPacketSize) {
+ ValueRestore<bool> old_flag(&FLAGS_quic_small_default_packet_size, true);
+ QuicConnectionId connection_id = 42;
+ bool kIsServer = true;
+ TestConnection connection(connection_id, IPEndPoint(), helper_.get(),
+ factory_, kIsServer, version());
+ EXPECT_TRUE(connection.is_server());
+ EXPECT_EQ(1000u, connection.max_packet_length());
+}
+
+TEST_P(QuicConnectionTest, ServerMaxPacketSize) {
+ ValueRestore<bool> old_flag(&FLAGS_quic_small_default_packet_size, false);
+ QuicConnectionId connection_id = 42;
+ bool kIsServer = true;
+ TestConnection connection(connection_id, IPEndPoint(), helper_.get(),
+ factory_, kIsServer, version());
+ EXPECT_TRUE(connection.is_server());
+ EXPECT_EQ(1350u, connection.max_packet_length());
+}
+
+TEST_P(QuicConnectionTest, IncreaseServerMaxPacketSize) {
+ EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
+
+ connection_.set_is_server(true);
+ connection_.set_max_packet_length(1000);
+
+ QuicPacketHeader header;
+ header.public_header.connection_id = connection_id_;
+ header.public_header.reset_flag = false;
+ header.public_header.version_flag = true;
+ header.entropy_flag = false;
+ header.fec_flag = false;
+ header.packet_sequence_number = 1;
+ header.fec_group = 0;
+
+ QuicFrames frames;
+ QuicPaddingFrame padding;
+ frames.push_back(QuicFrame(&frame1_));
+ frames.push_back(QuicFrame(&padding));
+
+ scoped_ptr<QuicPacket> packet(
+ BuildUnsizedDataPacket(&framer_, header, frames));
+ scoped_ptr<QuicEncryptedPacket> encrypted(
+ framer_.EncryptPacket(ENCRYPTION_NONE, 12, *packet));
+ EXPECT_EQ(kMaxPacketSize, encrypted->length());
+
+ framer_.set_version(version());
+ EXPECT_CALL(visitor_, OnStreamFrames(_)).Times(1);
+ connection_.ProcessUdpPacket(IPEndPoint(), IPEndPoint(), *encrypted);
+
+ EXPECT_EQ(kMaxPacketSize, connection_.max_packet_length());
+}
+
TEST_P(QuicConnectionTest, PacketsInOrder) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
« 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