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

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

Issue 2513113002: Remove strike-register code from QuicCryptoServerConfig (Closed)
Patch Set: Created 4 years, 1 month 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/quic_crypto_server_config_peer.cc ('k') | net/tools/quic/quic_server.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 <stddef.h> 5 #include <stddef.h>
6 #include <sys/epoll.h> 6 #include <sys/epoll.h>
7 7
8 #include <cstdint> 8 #include <cstdint>
9 #include <list> 9 #include <list>
10 #include <memory> 10 #include <memory>
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 class EndToEndTest : public ::testing::TestWithParam<TestParams> { 271 class EndToEndTest : public ::testing::TestWithParam<TestParams> {
272 protected: 272 protected:
273 EndToEndTest() 273 EndToEndTest()
274 : initialized_(false), 274 : initialized_(false),
275 server_address_(IPEndPoint(Loopback4(), 0)), 275 server_address_(IPEndPoint(Loopback4(), 0)),
276 server_hostname_("test.example.com"), 276 server_hostname_("test.example.com"),
277 client_writer_(nullptr), 277 client_writer_(nullptr),
278 server_writer_(nullptr), 278 server_writer_(nullptr),
279 server_started_(false), 279 server_started_(false),
280 strike_register_no_startup_period_(false),
281 chlo_multiplier_(0), 280 chlo_multiplier_(0),
282 stream_factory_(nullptr), 281 stream_factory_(nullptr),
283 support_server_push_(false) { 282 support_server_push_(false) {
284 client_supported_versions_ = GetParam().client_supported_versions; 283 client_supported_versions_ = GetParam().client_supported_versions;
285 server_supported_versions_ = GetParam().server_supported_versions; 284 server_supported_versions_ = GetParam().server_supported_versions;
286 negotiated_version_ = GetParam().negotiated_version; 285 negotiated_version_ = GetParam().negotiated_version;
287 286
288 VLOG(1) << "Using Configuration: " << GetParam(); 287 VLOG(1) << "Using Configuration: " << GetParam();
289 288
290 // Use different flow control windows for client/server. 289 // Use different flow control windows for client/server.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 StopServer(); 425 StopServer();
427 } 426 }
428 427
429 void StartServer() { 428 void StartServer() {
430 FLAGS_quic_use_cheap_stateless_rejects = 429 FLAGS_quic_use_cheap_stateless_rejects =
431 GetParam().use_cheap_stateless_reject; 430 GetParam().use_cheap_stateless_reject;
432 431
433 auto test_server = 432 auto test_server =
434 new QuicTestServer(CryptoTestUtils::ProofSourceForTesting(), 433 new QuicTestServer(CryptoTestUtils::ProofSourceForTesting(),
435 server_config_, server_supported_versions_); 434 server_config_, server_supported_versions_);
436 server_thread_.reset(new ServerThread(test_server, server_address_, 435 server_thread_.reset(new ServerThread(test_server, server_address_));
437 strike_register_no_startup_period_));
438 if (chlo_multiplier_ != 0) { 436 if (chlo_multiplier_ != 0) {
439 server_thread_->server()->SetChloMultiplier(chlo_multiplier_); 437 server_thread_->server()->SetChloMultiplier(chlo_multiplier_);
440 } 438 }
441 server_thread_->Initialize(); 439 server_thread_->Initialize();
442 server_address_ = 440 server_address_ =
443 IPEndPoint(server_address_.address(), server_thread_->GetPort()); 441 IPEndPoint(server_address_.address(), server_thread_->GetPort());
444 QuicDispatcher* dispatcher = 442 QuicDispatcher* dispatcher =
445 QuicServerPeer::GetDispatcher(server_thread_->server()); 443 QuicServerPeer::GetDispatcher(server_thread_->server());
446 QuicDispatcherPeer::UseWriter(dispatcher, server_writer_); 444 QuicDispatcherPeer::UseWriter(dispatcher, server_writer_);
447 445
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 std::unique_ptr<ServerThread> server_thread_; 562 std::unique_ptr<ServerThread> server_thread_;
565 std::unique_ptr<QuicTestClient> client_; 563 std::unique_ptr<QuicTestClient> client_;
566 PacketDroppingTestWriter* client_writer_; 564 PacketDroppingTestWriter* client_writer_;
567 PacketDroppingTestWriter* server_writer_; 565 PacketDroppingTestWriter* server_writer_;
568 bool server_started_; 566 bool server_started_;
569 QuicConfig client_config_; 567 QuicConfig client_config_;
570 QuicConfig server_config_; 568 QuicConfig server_config_;
571 QuicVersionVector client_supported_versions_; 569 QuicVersionVector client_supported_versions_;
572 QuicVersionVector server_supported_versions_; 570 QuicVersionVector server_supported_versions_;
573 QuicVersion negotiated_version_; 571 QuicVersion negotiated_version_;
574 bool strike_register_no_startup_period_;
575 size_t chlo_multiplier_; 572 size_t chlo_multiplier_;
576 QuicTestServer::StreamFactory* stream_factory_; 573 QuicTestServer::StreamFactory* stream_factory_;
577 bool support_server_push_; 574 bool support_server_push_;
578 bool force_hol_blocking_; 575 bool force_hol_blocking_;
579 }; 576 };
580 577
581 // Run all end to end tests with all supported versions. 578 // Run all end to end tests with all supported versions.
582 INSTANTIATE_TEST_CASE_P(EndToEndTests, 579 INSTANTIATE_TEST_CASE_P(EndToEndTests,
583 EndToEndTest, 580 EndToEndTest,
584 ::testing::ValuesIn(GetTestParams())); 581 ::testing::ValuesIn(GetTestParams()));
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 headers[":method"] = "POST"; 840 headers[":method"] = "POST";
844 headers[":path"] = "/foo"; 841 headers[":path"] = "/foo";
845 headers[":scheme"] = "https"; 842 headers[":scheme"] = "https";
846 headers[":authority"] = server_hostname_; 843 headers[":authority"] = server_hostname_;
847 844
848 EXPECT_EQ(kFooResponseBody, 845 EXPECT_EQ(kFooResponseBody,
849 client_->SendCustomSynchronousRequest(headers, body)); 846 client_->SendCustomSynchronousRequest(headers, body));
850 } 847 }
851 848
852 TEST_P(EndToEndTest, LargePostZeroRTTFailure) { 849 TEST_P(EndToEndTest, LargePostZeroRTTFailure) {
853 // Have the server accept 0-RTT without waiting a startup period.
854 strike_register_no_startup_period_ = true;
855
856 // Send a request and then disconnect. This prepares the client to attempt 850 // Send a request and then disconnect. This prepares the client to attempt
857 // a 0-RTT handshake for the next request. 851 // a 0-RTT handshake for the next request.
858 ASSERT_TRUE(Initialize()); 852 ASSERT_TRUE(Initialize());
859 853
860 string body; 854 string body;
861 GenerateBody(&body, 20480); 855 GenerateBody(&body, 20480);
862 SpdyHeaderBlock headers; 856 SpdyHeaderBlock headers;
863 headers[":method"] = "POST"; 857 headers[":method"] = "POST";
864 headers[":path"] = "/foo"; 858 headers[":path"] = "/foo";
865 headers[":scheme"] = "https"; 859 headers[":scheme"] = "https";
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 // torn down after the reject. The number of hellos sent on the 901 // torn down after the reject. The number of hellos sent on the
908 // latest session is 1. 902 // latest session is 1.
909 EXPECT_EQ(expected_num_hellos_latest_session, 903 EXPECT_EQ(expected_num_hellos_latest_session,
910 client_->client()->session()->GetNumSentClientHellos()); 904 client_->client()->session()->GetNumSentClientHellos());
911 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos()); 905 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos());
912 906
913 VerifyCleanConnection(false); 907 VerifyCleanConnection(false);
914 } 908 }
915 909
916 TEST_P(EndToEndTest, SynchronousRequestZeroRTTFailure) { 910 TEST_P(EndToEndTest, SynchronousRequestZeroRTTFailure) {
917 // Have the server accept 0-RTT without waiting a startup period.
918 strike_register_no_startup_period_ = true;
919
920 // Send a request and then disconnect. This prepares the client to attempt 911 // Send a request and then disconnect. This prepares the client to attempt
921 // a 0-RTT handshake for the next request. 912 // a 0-RTT handshake for the next request.
922 ASSERT_TRUE(Initialize()); 913 ASSERT_TRUE(Initialize());
923 914
924 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); 915 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
925 // In the non-stateless case, the same session is used for both 916 // In the non-stateless case, the same session is used for both
926 // hellos, so the number of hellos sent on that session is 2. In 917 // hellos, so the number of hellos sent on that session is 2. In
927 // the stateless case, the first client session will be completely 918 // the stateless case, the first client session will be completely
928 // torn down after the reject. The number of hellos on that second 919 // torn down after the reject. The number of hellos on that second
929 // latest session is 1. 920 // latest session is 1.
(...skipping 30 matching lines...) Expand all
960 // torn down after the reject. The number of hellos sent on the 951 // torn down after the reject. The number of hellos sent on the
961 // latest session is 1. 952 // latest session is 1.
962 EXPECT_EQ(expected_num_hellos_latest_session, 953 EXPECT_EQ(expected_num_hellos_latest_session,
963 client_->client()->session()->GetNumSentClientHellos()); 954 client_->client()->session()->GetNumSentClientHellos());
964 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos()); 955 EXPECT_EQ(2, client_->client()->GetNumSentClientHellos());
965 956
966 VerifyCleanConnection(false); 957 VerifyCleanConnection(false);
967 } 958 }
968 959
969 TEST_P(EndToEndTest, LargePostSynchronousRequest) { 960 TEST_P(EndToEndTest, LargePostSynchronousRequest) {
970 // Have the server accept 0-RTT without waiting a startup period.
971 strike_register_no_startup_period_ = true;
972
973 // Send a request and then disconnect. This prepares the client to attempt 961 // Send a request and then disconnect. This prepares the client to attempt
974 // a 0-RTT handshake for the next request. 962 // a 0-RTT handshake for the next request.
975 ASSERT_TRUE(Initialize()); 963 ASSERT_TRUE(Initialize());
976 964
977 string body; 965 string body;
978 GenerateBody(&body, 20480); 966 GenerateBody(&body, 20480);
979 SpdyHeaderBlock headers; 967 SpdyHeaderBlock headers;
980 headers[":method"] = "POST"; 968 headers[":method"] = "POST";
981 headers[":path"] = "/foo"; 969 headers[":path"] = "/foo";
982 headers[":scheme"] = "https"; 970 headers[":scheme"] = "https";
(...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after
2959 client_->WaitForResponse(); 2947 client_->WaitForResponse();
2960 EXPECT_EQ(kBarResponseBody, client_->response_body()); 2948 EXPECT_EQ(kBarResponseBody, client_->response_body());
2961 QuicConnectionStats client_stats = 2949 QuicConnectionStats client_stats =
2962 client_->client()->session()->connection()->GetStats(); 2950 client_->client()->session()->connection()->GetStats();
2963 EXPECT_EQ(0u, client_stats.packets_lost); 2951 EXPECT_EQ(0u, client_stats.packets_lost);
2964 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); 2952 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos());
2965 } 2953 }
2966 } // namespace 2954 } // namespace
2967 } // namespace test 2955 } // namespace test
2968 } // namespace net 2956 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_crypto_server_config_peer.cc ('k') | net/tools/quic/quic_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698