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

Side by Side Diff: net/tools/quic/end_to_end_test.cc

Issue 804813010: QUIC - enabled FLAGS_allow_truncated_connection_ids_for_quic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
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 <stddef.h> 5 #include <stddef.h>
6 #include <string> 6 #include <string>
7 #include <sys/epoll.h> 7 #include <sys/epoll.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 client_sent_packet_manager.GetRttStats()->smoothed_rtt().IsInfinite()); 1010 client_sent_packet_manager.GetRttStats()->smoothed_rtt().IsInfinite());
1011 // Expect the default rtt of 100ms. 1011 // Expect the default rtt of 100ms.
1012 EXPECT_EQ(static_cast<int64>(100 * kNumMicrosPerMilli), 1012 EXPECT_EQ(static_cast<int64>(100 * kNumMicrosPerMilli),
1013 server_sent_packet_manager.GetRttStats()->initial_rtt_us()); 1013 server_sent_packet_manager.GetRttStats()->initial_rtt_us());
1014 // Ensure the bandwidth is valid. 1014 // Ensure the bandwidth is valid.
1015 client_sent_packet_manager.BandwidthEstimate(); 1015 client_sent_packet_manager.BandwidthEstimate();
1016 server_sent_packet_manager.BandwidthEstimate(); 1016 server_sent_packet_manager.BandwidthEstimate();
1017 server_thread_->Resume(); 1017 server_thread_->Resume();
1018 } 1018 }
1019 1019
1020 TEST_P(EndToEndTest, 0ByteConnectionId) {
1021 client_config_.SetBytesForConnectionIdToSend(0);
1022 ASSERT_TRUE(Initialize());
1023
1024 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1025 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1026
1027 QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
1028 client_->client()->session()->connection());
1029 EXPECT_EQ(PACKET_0BYTE_CONNECTION_ID,
1030 header->public_header.connection_id_length);
1031 }
1032
1033 TEST_P(EndToEndTest, 1ByteConnectionId) {
1034 client_config_.SetBytesForConnectionIdToSend(1);
1035 ASSERT_TRUE(Initialize());
1036
1037 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1038 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1039 QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
1040 client_->client()->session()->connection());
1041 EXPECT_EQ(PACKET_1BYTE_CONNECTION_ID,
1042 header->public_header.connection_id_length);
1043 }
1044
1045 TEST_P(EndToEndTest, 4ByteConnectionId) {
1046 client_config_.SetBytesForConnectionIdToSend(4);
1047 ASSERT_TRUE(Initialize());
1048
1049 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1050 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1051 QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
1052 client_->client()->session()->connection());
1053 EXPECT_EQ(PACKET_4BYTE_CONNECTION_ID,
1054 header->public_header.connection_id_length);
1055 }
1056
1057 TEST_P(EndToEndTest, 8ByteConnectionId) {
1058 client_config_.SetBytesForConnectionIdToSend(8);
1059 ASSERT_TRUE(Initialize());
1060
1061 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1062 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1063 QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
1064 client_->client()->session()->connection());
1065 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID,
1066 header->public_header.connection_id_length);
1067 }
1068
1069 TEST_P(EndToEndTest, 15ByteConnectionId) {
1070 client_config_.SetBytesForConnectionIdToSend(15);
1071 ASSERT_TRUE(Initialize());
1072
1073 // Our server is permissive and allows for out of bounds values.
1074 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1075 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1076 QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
1077 client_->client()->session()->connection());
1078 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID,
1079 header->public_header.connection_id_length);
1080 }
1081
1020 TEST_P(EndToEndTest, ResetConnection) { 1082 TEST_P(EndToEndTest, ResetConnection) {
1021 ASSERT_TRUE(Initialize()); 1083 ASSERT_TRUE(Initialize());
1022 client_->client()->WaitForCryptoHandshakeConfirmed(); 1084 client_->client()->WaitForCryptoHandshakeConfirmed();
1023 1085
1024 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); 1086 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1025 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); 1087 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1026 client_->ResetConnection(); 1088 client_->ResetConnection();
1027 EXPECT_EQ(kBarResponseBody, client_->SendSynchronousRequest("/bar")); 1089 EXPECT_EQ(kBarResponseBody, client_->SendSynchronousRequest("/bar"));
1028 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); 1090 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1029 } 1091 }
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 const QuicSentPacketManager& server_sent_packet_manager = 1427 const QuicSentPacketManager& server_sent_packet_manager =
1366 *GetSentPacketManagerFromFirstServerSession(); 1428 *GetSentPacketManagerFromFirstServerSession();
1367 EXPECT_TRUE(server_sent_packet_manager.using_pacing()); 1429 EXPECT_TRUE(server_sent_packet_manager.using_pacing());
1368 EXPECT_TRUE(client_sent_packet_manager.using_pacing()); 1430 EXPECT_TRUE(client_sent_packet_manager.using_pacing());
1369 } 1431 }
1370 1432
1371 } // namespace 1433 } // namespace
1372 } // namespace test 1434 } // namespace test
1373 } // namespace tools 1435 } // namespace tools
1374 } // namespace net 1436 } // namespace net
OLDNEW
« net/quic/quic_stream_factory.cc ('K') | « net/quic/quic_stream_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698