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

Unified 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: disable truncate_ids by default 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/test_tools/mock_crypto_client_stream.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/end_to_end_test.cc
diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc
index 65005f6c96bb2c2ca1aa133b46a9875f0b58f4b6..3330effbe5c2bbd174db71b189ad42d6fb50a233 100644
--- a/net/tools/quic/end_to_end_test.cc
+++ b/net/tools/quic/end_to_end_test.cc
@@ -1017,6 +1017,78 @@ TEST_P(EndToEndTest, MinInitialRTT) {
server_thread_->Resume();
}
+TEST_P(EndToEndTest, 0ByteConnectionId) {
+ ValueRestore<bool> old_flag(&FLAGS_allow_truncated_connection_ids_for_quic,
+ true);
+ client_config_.SetBytesForConnectionIdToSend(0);
+ ASSERT_TRUE(Initialize());
+
+ EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
+ EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
+
+ QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
+ client_->client()->session()->connection());
+ EXPECT_EQ(PACKET_0BYTE_CONNECTION_ID,
+ header->public_header.connection_id_length);
+}
+
+TEST_P(EndToEndTest, 1ByteConnectionId) {
+ ValueRestore<bool> old_flag(&FLAGS_allow_truncated_connection_ids_for_quic,
+ true);
+ client_config_.SetBytesForConnectionIdToSend(1);
+ ASSERT_TRUE(Initialize());
+
+ EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
+ EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
+ QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
+ client_->client()->session()->connection());
+ EXPECT_EQ(PACKET_1BYTE_CONNECTION_ID,
+ header->public_header.connection_id_length);
+}
+
+TEST_P(EndToEndTest, 4ByteConnectionId) {
+ ValueRestore<bool> old_flag(&FLAGS_allow_truncated_connection_ids_for_quic,
+ true);
+ client_config_.SetBytesForConnectionIdToSend(4);
+ ASSERT_TRUE(Initialize());
+
+ EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
+ EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
+ QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
+ client_->client()->session()->connection());
+ EXPECT_EQ(PACKET_4BYTE_CONNECTION_ID,
+ header->public_header.connection_id_length);
+}
+
+TEST_P(EndToEndTest, 8ByteConnectionId) {
+ ValueRestore<bool> old_flag(&FLAGS_allow_truncated_connection_ids_for_quic,
+ true);
+ client_config_.SetBytesForConnectionIdToSend(8);
+ ASSERT_TRUE(Initialize());
+
+ EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
+ EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
+ QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
+ client_->client()->session()->connection());
+ EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID,
+ header->public_header.connection_id_length);
+}
+
+TEST_P(EndToEndTest, 15ByteConnectionId) {
+ ValueRestore<bool> old_flag(&FLAGS_allow_truncated_connection_ids_for_quic,
+ true);
+ client_config_.SetBytesForConnectionIdToSend(15);
+ ASSERT_TRUE(Initialize());
+
+ // Our server is permissive and allows for out of bounds values.
+ EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
+ EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
+ QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
+ client_->client()->session()->connection());
+ EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID,
+ header->public_header.connection_id_length);
+}
+
TEST_P(EndToEndTest, ResetConnection) {
ASSERT_TRUE(Initialize());
client_->client()->WaitForCryptoHandshakeConfirmed();
« no previous file with comments | « net/quic/test_tools/mock_crypto_client_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698