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

Side by Side 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 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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 997
998 private: 998 private:
999 DISALLOW_COPY_AND_ASSIGN(QuicConnectionTest); 999 DISALLOW_COPY_AND_ASSIGN(QuicConnectionTest);
1000 }; 1000 };
1001 1001
1002 // Run all end to end tests with all supported versions. 1002 // Run all end to end tests with all supported versions.
1003 INSTANTIATE_TEST_CASE_P(SupportedVersion, 1003 INSTANTIATE_TEST_CASE_P(SupportedVersion,
1004 QuicConnectionTest, 1004 QuicConnectionTest,
1005 ::testing::ValuesIn(QuicSupportedVersions())); 1005 ::testing::ValuesIn(QuicSupportedVersions()));
1006 1006
1007 TEST_P(QuicConnectionTest, MaxPacketSize) {
1008 EXPECT_FALSE(connection_.is_server());
1009 EXPECT_EQ(1350u, connection_.max_packet_length());
1010 }
1011
1012 TEST_P(QuicConnectionTest, SmallerServerMaxPacketSize) {
1013 ValueRestore<bool> old_flag(&FLAGS_quic_small_default_packet_size, true);
1014 QuicConnectionId connection_id = 42;
1015 bool kIsServer = true;
1016 TestConnection connection(connection_id, IPEndPoint(), helper_.get(),
1017 factory_, kIsServer, version());
1018 EXPECT_TRUE(connection.is_server());
1019 EXPECT_EQ(1000u, connection.max_packet_length());
1020 }
1021
1022 TEST_P(QuicConnectionTest, ServerMaxPacketSize) {
1023 ValueRestore<bool> old_flag(&FLAGS_quic_small_default_packet_size, false);
1024 QuicConnectionId connection_id = 42;
1025 bool kIsServer = true;
1026 TestConnection connection(connection_id, IPEndPoint(), helper_.get(),
1027 factory_, kIsServer, version());
1028 EXPECT_TRUE(connection.is_server());
1029 EXPECT_EQ(1350u, connection.max_packet_length());
1030 }
1031
1032 TEST_P(QuicConnectionTest, IncreaseServerMaxPacketSize) {
1033 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1034
1035 connection_.set_is_server(true);
1036 connection_.set_max_packet_length(1000);
1037
1038 QuicPacketHeader header;
1039 header.public_header.connection_id = connection_id_;
1040 header.public_header.reset_flag = false;
1041 header.public_header.version_flag = true;
1042 header.entropy_flag = false;
1043 header.fec_flag = false;
1044 header.packet_sequence_number = 1;
1045 header.fec_group = 0;
1046
1047 QuicFrames frames;
1048 QuicPaddingFrame padding;
1049 frames.push_back(QuicFrame(&frame1_));
1050 frames.push_back(QuicFrame(&padding));
1051
1052 scoped_ptr<QuicPacket> packet(
1053 BuildUnsizedDataPacket(&framer_, header, frames));
1054 scoped_ptr<QuicEncryptedPacket> encrypted(
1055 framer_.EncryptPacket(ENCRYPTION_NONE, 12, *packet));
1056 EXPECT_EQ(kMaxPacketSize, encrypted->length());
1057
1058 framer_.set_version(version());
1059 EXPECT_CALL(visitor_, OnStreamFrames(_)).Times(1);
1060 connection_.ProcessUdpPacket(IPEndPoint(), IPEndPoint(), *encrypted);
1061
1062 EXPECT_EQ(kMaxPacketSize, connection_.max_packet_length());
1063 }
1064
1007 TEST_P(QuicConnectionTest, PacketsInOrder) { 1065 TEST_P(QuicConnectionTest, PacketsInOrder) {
1008 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 1066 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1009 1067
1010 ProcessPacket(1); 1068 ProcessPacket(1);
1011 EXPECT_EQ(1u, outgoing_ack()->largest_observed); 1069 EXPECT_EQ(1u, outgoing_ack()->largest_observed);
1012 EXPECT_EQ(0u, outgoing_ack()->missing_packets.size()); 1070 EXPECT_EQ(0u, outgoing_ack()->missing_packets.size());
1013 1071
1014 ProcessPacket(2); 1072 ProcessPacket(2);
1015 EXPECT_EQ(2u, outgoing_ack()->largest_observed); 1073 EXPECT_EQ(2u, outgoing_ack()->largest_observed);
1016 EXPECT_EQ(0u, outgoing_ack()->missing_packets.size()); 1074 EXPECT_EQ(0u, outgoing_ack()->missing_packets.size());
(...skipping 3387 matching lines...) Expand 10 before | Expand all | Expand 10 after
4404 // Regression test for b/18594622 4462 // Regression test for b/18594622
4405 scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate); 4463 scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate);
4406 EXPECT_DFATAL( 4464 EXPECT_DFATAL(
4407 connection_.SendStreamDataWithString(3, "", 0, !kFin, delegate.get()), 4465 connection_.SendStreamDataWithString(3, "", 0, !kFin, delegate.get()),
4408 "Attempt to send empty stream frame"); 4466 "Attempt to send empty stream frame");
4409 } 4467 }
4410 4468
4411 } // namespace 4469 } // namespace
4412 } // namespace test 4470 } // namespace test
4413 } // namespace net 4471 } // 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