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

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

Issue 1904213002: QUIC: support diversified keys with version 33. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hkdf
Patch Set: Rebase Created 4 years, 8 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/test_tools/simple_quic_framer.cc ('k') | net/tools/quic/quic_dispatcher_test.cc » ('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 <stddef.h> 5 #include <stddef.h>
6 #include <sys/epoll.h> 6 #include <sys/epoll.h>
7 7
8 #include <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 client_->client()->session()->GetNumSentClientHellos()); 783 client_->client()->session()->GetNumSentClientHellos());
784 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos()); 784 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos());
785 785
786 client_->Disconnect(); 786 client_->Disconnect();
787 787
788 // The 0-RTT handshake should succeed. 788 // The 0-RTT handshake should succeed.
789 client_->Connect(); 789 client_->Connect();
790 client_->WaitForResponseForMs(-1); 790 client_->WaitForResponseForMs(-1);
791 ASSERT_TRUE(client_->client()->connected()); 791 ASSERT_TRUE(client_->client()->connected());
792 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); 792 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
793 EXPECT_EQ(expected_num_hellos_latest_session, 793
794 client_->client()->session()->GetNumSentClientHellos()); 794 if (negotiated_version_ <= QUIC_VERSION_32) {
795 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos()); 795 EXPECT_EQ(expected_num_hellos_latest_session,
796 client_->client()->session()->GetNumSentClientHellos());
797 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos());
798 } else {
799 EXPECT_EQ(1, client_->client()->session()->GetNumSentClientHellos());
800 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos());
801 }
796 802
797 client_->Disconnect(); 803 client_->Disconnect();
798 804
799 // Restart the server so that the 0-RTT handshake will take 1 RTT. 805 // Restart the server so that the 0-RTT handshake will take 1 RTT.
800 StopServer(); 806 StopServer();
801 server_writer_ = new PacketDroppingTestWriter(); 807 server_writer_ = new PacketDroppingTestWriter();
802 StartServer(); 808 StartServer();
803 809
804 client_->Connect(); 810 client_->Connect();
805 ASSERT_TRUE(client_->client()->connected()); 811 ASSERT_TRUE(client_->client()->connected());
(...skipping 30 matching lines...) Expand all
836 client_->client()->session()->GetNumSentClientHellos()); 842 client_->client()->session()->GetNumSentClientHellos());
837 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos()); 843 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos());
838 844
839 client_->Disconnect(); 845 client_->Disconnect();
840 846
841 // The 0-RTT handshake should succeed. 847 // The 0-RTT handshake should succeed.
842 client_->Connect(); 848 client_->Connect();
843 client_->WaitForInitialResponse(); 849 client_->WaitForInitialResponse();
844 ASSERT_TRUE(client_->client()->connected()); 850 ASSERT_TRUE(client_->client()->connected());
845 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); 851 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
846 EXPECT_EQ(expected_num_hellos_latest_session, 852
847 client_->client()->session()->GetNumSentClientHellos()); 853 if (negotiated_version_ <= QUIC_VERSION_32) {
848 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos()); 854 EXPECT_EQ(expected_num_hellos_latest_session,
855 client_->client()->session()->GetNumSentClientHellos());
856 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos());
857 } else {
858 EXPECT_EQ(1, client_->client()->session()->GetNumSentClientHellos());
859 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos());
860 }
849 861
850 client_->Disconnect(); 862 client_->Disconnect();
851 863
852 // Restart the server so that the 0-RTT handshake will take 1 RTT. 864 // Restart the server so that the 0-RTT handshake will take 1 RTT.
853 StopServer(); 865 StopServer();
854 server_writer_ = new PacketDroppingTestWriter(); 866 server_writer_ = new PacketDroppingTestWriter();
855 StartServer(); 867 StartServer();
856 868
857 client_->Connect(); 869 client_->Connect();
858 ASSERT_TRUE(client_->client()->connected()); 870 ASSERT_TRUE(client_->client()->connected());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 client_->client()->session()->GetNumSentClientHellos()); 907 client_->client()->session()->GetNumSentClientHellos());
896 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos()); 908 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos());
897 909
898 client_->Disconnect(); 910 client_->Disconnect();
899 911
900 // The 0-RTT handshake should succeed. 912 // The 0-RTT handshake should succeed.
901 client_->Connect(); 913 client_->Connect();
902 client_->WaitForInitialResponse(); 914 client_->WaitForInitialResponse();
903 ASSERT_TRUE(client_->client()->connected()); 915 ASSERT_TRUE(client_->client()->connected());
904 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); 916 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
905 EXPECT_EQ(expected_num_hellos_latest_session, 917
906 client_->client()->session()->GetNumSentClientHellos()); 918 if (negotiated_version_ <= QUIC_VERSION_32) {
907 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos()); 919 EXPECT_EQ(expected_num_hellos_latest_session,
920 client_->client()->session()->GetNumSentClientHellos());
921 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos());
922 } else {
923 EXPECT_EQ(1, client_->client()->session()->GetNumSentClientHellos());
924 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos());
925 }
908 926
909 client_->Disconnect(); 927 client_->Disconnect();
910 928
911 // Restart the server so that the 0-RTT handshake will take 1 RTT. 929 // Restart the server so that the 0-RTT handshake will take 1 RTT.
912 StopServer(); 930 StopServer();
913 server_writer_ = new PacketDroppingTestWriter(); 931 server_writer_ = new PacketDroppingTestWriter();
914 StartServer(); 932 StartServer();
915 933
916 client_->Connect(); 934 client_->Connect();
917 ASSERT_TRUE(client_->client()->connected()); 935 ASSERT_TRUE(client_->client()->connected());
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 1289
1272 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); 1290 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1273 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); 1291 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1274 1292
1275 QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader( 1293 QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
1276 client_->client()->session()->connection()); 1294 client_->client()->session()->connection());
1277 EXPECT_EQ(PACKET_0BYTE_CONNECTION_ID, 1295 EXPECT_EQ(PACKET_0BYTE_CONNECTION_ID,
1278 header->public_header.connection_id_length); 1296 header->public_header.connection_id_length);
1279 } 1297 }
1280 1298
1281 TEST_P(EndToEndTest, 1ByteConnectionId) {
1282 client_config_.SetBytesForConnectionIdToSend(1);
1283 ASSERT_TRUE(Initialize());
1284
1285 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1286 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1287 QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
1288 client_->client()->session()->connection());
1289 EXPECT_EQ(PACKET_1BYTE_CONNECTION_ID,
1290 header->public_header.connection_id_length);
1291 }
1292
1293 TEST_P(EndToEndTest, 4ByteConnectionId) {
1294 client_config_.SetBytesForConnectionIdToSend(4);
1295 ASSERT_TRUE(Initialize());
1296
1297 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1298 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1299 QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
1300 client_->client()->session()->connection());
1301 EXPECT_EQ(PACKET_4BYTE_CONNECTION_ID,
1302 header->public_header.connection_id_length);
1303 }
1304
1305 TEST_P(EndToEndTest, 8ByteConnectionId) { 1299 TEST_P(EndToEndTest, 8ByteConnectionId) {
1306 client_config_.SetBytesForConnectionIdToSend(8); 1300 client_config_.SetBytesForConnectionIdToSend(8);
1307 ASSERT_TRUE(Initialize()); 1301 ASSERT_TRUE(Initialize());
1308 1302
1309 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); 1303 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1310 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); 1304 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1311 QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader( 1305 QuicPacketHeader* header = QuicConnectionPeer::GetLastHeader(
1312 client_->client()->session()->connection()); 1306 client_->client()->session()->connection());
1313 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID, 1307 EXPECT_EQ(PACKET_8BYTE_CONNECTION_ID,
1314 header->public_header.connection_id_length); 1308 header->public_header.connection_id_length);
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2651 client_->client()->WaitForCryptoHandshakeConfirmed(); 2645 client_->client()->WaitForCryptoHandshakeConfirmed();
2652 SetPacketLossPercentage(1); 2646 SetPacketLossPercentage(1);
2653 client_->SendRequest("/huge_response"); 2647 client_->SendRequest("/huge_response");
2654 client_->WaitForResponse(); 2648 client_->WaitForResponse();
2655 VerifyCleanConnection(false); 2649 VerifyCleanConnection(false);
2656 } 2650 }
2657 2651
2658 } // namespace 2652 } // namespace
2659 } // namespace test 2653 } // namespace test
2660 } // namespace net 2654 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/simple_quic_framer.cc ('k') | net/tools/quic/quic_dispatcher_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698