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

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

Issue 2875333002: Landing Recent QUIC changes until Mon May 8 21:42:46 2017 +0000 (Closed)
Patch Set: Created 3 years, 7 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/quartc/quartc_packet_writer.cc ('k') | net/tools/quic/quic_dispatcher.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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 version_buckets[0].push_back(version); 159 version_buckets[0].push_back(version);
160 } 160 }
161 161
162 // This must be kept in sync with the number of nested for-loops below as it 162 // This must be kept in sync with the number of nested for-loops below as it
163 // is used to prune the number of tests that are run. 163 // is used to prune the number of tests that are run.
164 const int kMaxEnabledOptions = 7; 164 const int kMaxEnabledOptions = 7;
165 int max_enabled_options = 0; 165 int max_enabled_options = 0;
166 std::vector<TestParams> params; 166 std::vector<TestParams> params;
167 for (bool server_uses_stateless_rejects_if_peer_supported : {true, false}) { 167 for (bool server_uses_stateless_rejects_if_peer_supported : {true, false}) {
168 for (bool client_supports_stateless_rejects : {true, false}) { 168 for (bool client_supports_stateless_rejects : {true, false}) {
169 for (const QuicTag congestion_control_tag : {kRENO, kTBBR, kQBIC}) { 169 for (const QuicTag congestion_control_tag :
170 {kRENO, kTBBR, kQBIC, kTPCC}) {
170 for (bool disable_hpack_dynamic_table : {false}) { 171 for (bool disable_hpack_dynamic_table : {false}) {
171 for (bool force_hol_blocking : {true, false}) { 172 for (bool force_hol_blocking : {true, false}) {
172 for (bool use_cheap_stateless_reject : {true, false}) { 173 for (bool use_cheap_stateless_reject : {true, false}) {
173 for (bool connection_id_big_endian_client : {true, false}) { 174 for (bool connection_id_big_endian_client : {true, false}) {
174 for (bool connection_id_big_endian_server : {true, false}) { 175 for (bool connection_id_big_endian_server : {true, false}) {
175 int enabled_options = 0; 176 int enabled_options = 0;
176 if (force_hol_blocking) { 177 if (force_hol_blocking) {
177 ++enabled_options; 178 ++enabled_options;
178 } 179 }
179 if (congestion_control_tag != kQBIC) { 180 if (congestion_control_tag != kQBIC) {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 copt.push_back(kCCVX); 419 copt.push_back(kCCVX);
419 } 420 }
420 if (GetParam().congestion_control_tag == kQBIC && 421 if (GetParam().congestion_control_tag == kQBIC &&
421 FLAGS_quic_reloadable_flag_quic_fix_cubic_bytes_quantization) { 422 FLAGS_quic_reloadable_flag_quic_fix_cubic_bytes_quantization) {
422 copt.push_back(kCBQT); 423 copt.push_back(kCBQT);
423 } 424 }
424 if (GetParam().congestion_control_tag == kQBIC && 425 if (GetParam().congestion_control_tag == kQBIC &&
425 FLAGS_quic_reloadable_flag_quic_enable_cubic_per_ack_updates) { 426 FLAGS_quic_reloadable_flag_quic_enable_cubic_per_ack_updates) {
426 copt.push_back(kCPAU); 427 copt.push_back(kCPAU);
427 } 428 }
429 if (GetParam().congestion_control_tag == kTPCC &&
430 FLAGS_quic_reloadable_flag_quic_enable_pcc) {
431 copt.push_back(kTPCC);
432 }
428 433
429 if (support_server_push_) { 434 if (support_server_push_) {
430 copt.push_back(kSPSH); 435 copt.push_back(kSPSH);
431 } 436 }
432 if (GetParam().client_supports_stateless_rejects) { 437 if (GetParam().client_supports_stateless_rejects) {
433 copt.push_back(kSREJ); 438 copt.push_back(kSREJ);
434 } 439 }
435 if (GetParam().disable_hpack_dynamic_table) { 440 if (GetParam().disable_hpack_dynamic_table) {
436 copt.push_back(kDHDT); 441 copt.push_back(kDHDT);
437 } 442 }
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 QuicServerPeer::GetDispatcher(server_thread_->server()); 1346 QuicServerPeer::GetDispatcher(server_thread_->server());
1342 QuicSession* server_session = dispatcher->session_map().begin()->second.get(); 1347 QuicSession* server_session = dispatcher->session_map().begin()->second.get();
1343 EXPECT_EQ(kClientMaxIncomingDynamicStreams, 1348 EXPECT_EQ(kClientMaxIncomingDynamicStreams,
1344 server_session->max_open_outgoing_streams()); 1349 server_session->max_open_outgoing_streams());
1345 server_thread_->Resume(); 1350 server_thread_->Resume();
1346 } 1351 }
1347 1352
1348 TEST_P(EndToEndTest, NegotiateCongestionControl) { 1353 TEST_P(EndToEndTest, NegotiateCongestionControl) {
1349 FLAGS_quic_reloadable_flag_quic_allow_new_bbr = true; 1354 FLAGS_quic_reloadable_flag_quic_allow_new_bbr = true;
1350 ASSERT_TRUE(Initialize()); 1355 ASSERT_TRUE(Initialize());
1356
1357 // For PCC, the underlying implementation may be a stub with a
1358 // different name-tag. Skip the rest of this test.
1359 if (GetParam().congestion_control_tag == kTPCC) {
1360 return;
1361 }
1362
1351 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); 1363 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed());
1352 1364
1353 CongestionControlType expected_congestion_control_type = kReno; 1365 CongestionControlType expected_congestion_control_type = kReno;
1354 switch (GetParam().congestion_control_tag) { 1366 switch (GetParam().congestion_control_tag) {
1355 case kRENO: 1367 case kRENO:
1356 expected_congestion_control_type = kReno; 1368 expected_congestion_control_type = kReno;
1357 break; 1369 break;
1358 case kTBBR: 1370 case kTBBR:
1359 expected_congestion_control_type = kBBR; 1371 expected_congestion_control_type = kBBR;
1360 break; 1372 break;
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2536 QuicSession* server_session = it->second.get(); 2548 QuicSession* server_session = it->second.get();
2537 2549
2538 // The stream is not waiting for the arrival of the peer's final offset. 2550 // The stream is not waiting for the arrival of the peer's final offset.
2539 EXPECT_EQ( 2551 EXPECT_EQ(
2540 0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(server_session) 2552 0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(server_session)
2541 .size()); 2553 .size());
2542 2554
2543 server_thread_->Resume(); 2555 server_thread_->Resume();
2544 } 2556 }
2545 2557
2546 TEST_P(EndToEndTest, LargePostEarlyResponse) {
2547 const uint32_t kWindowSize = 65536;
2548 set_client_initial_stream_flow_control_receive_window(kWindowSize);
2549 set_client_initial_session_flow_control_receive_window(kWindowSize);
2550 set_server_initial_stream_flow_control_receive_window(kWindowSize);
2551 set_server_initial_session_flow_control_receive_window(kWindowSize);
2552
2553 ASSERT_TRUE(Initialize());
2554 if (FLAGS_quic_reloadable_flag_quic_always_enable_bidi_streaming) {
2555 // This test is testing the same behavior as
2556 // EarlyResponseWithQuicStreamNoError, except for the additional final check
2557 // that the stream is reset on early response. Once this flag is deprecated
2558 // the tests will be the same and this one can be removed.
2559 return;
2560 }
2561
2562 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed());
2563
2564 // POST to a URL that gets an early error response, after the headers are
2565 // received and before the body is received.
2566 SpdyHeaderBlock headers;
2567 headers[":method"] = "POST";
2568 headers[":path"] = "/foo";
2569 headers[":scheme"] = "https";
2570 headers[":authority"] = server_hostname_;
2571 headers["content-length"] = "-1";
2572
2573 // Tell the client to not close the stream if it receives an early response.
2574 client_->set_allow_bidirectional_data(true);
2575 // Send the headers.
2576 client_->SendMessage(headers, "", /*fin=*/false);
2577
2578 // Receive the response and let the server close writing.
2579 client_->WaitForInitialResponse();
2580 EXPECT_EQ("500", client_->response_headers()->find(":status")->second);
2581
2582 // Receive the reset stream from server on early response.
2583 QuicStream* stream = client_->client()->session()->GetOrCreateStream(
2584 GetNthClientInitiatedId(0));
2585 // The stream is reset by server's reset stream.
2586 EXPECT_EQ(stream, nullptr);
2587 }
2588
2589 TEST_P(EndToEndTest, Trailers) { 2558 TEST_P(EndToEndTest, Trailers) {
2590 // Test sending and receiving HTTP/2 Trailers (trailing HEADERS frames). 2559 // Test sending and receiving HTTP/2 Trailers (trailing HEADERS frames).
2591 ASSERT_TRUE(Initialize()); 2560 ASSERT_TRUE(Initialize());
2592 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); 2561 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed());
2593 2562
2594 // Set reordering to ensure that Trailers arriving before body is ok. 2563 // Set reordering to ensure that Trailers arriving before body is ok.
2595 SetPacketSendDelay(QuicTime::Delta::FromMilliseconds(2)); 2564 SetPacketSendDelay(QuicTime::Delta::FromMilliseconds(2));
2596 SetReorderPercentage(30); 2565 SetReorderPercentage(30);
2597 2566
2598 // Add a response with headers, body, and trailers. 2567 // Add a response with headers, body, and trailers.
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
3123 client_->WaitForResponse(); 3092 client_->WaitForResponse();
3124 EXPECT_EQ(kBarResponseBody, client_->response_body()); 3093 EXPECT_EQ(kBarResponseBody, client_->response_body());
3125 QuicConnectionStats client_stats = 3094 QuicConnectionStats client_stats =
3126 client_->client()->session()->connection()->GetStats(); 3095 client_->client()->session()->connection()->GetStats();
3127 EXPECT_EQ(0u, client_stats.packets_lost); 3096 EXPECT_EQ(0u, client_stats.packets_lost);
3128 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); 3097 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos());
3129 } 3098 }
3130 } // namespace 3099 } // namespace
3131 } // namespace test 3100 } // namespace test
3132 } // namespace net 3101 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quartc/quartc_packet_writer.cc ('k') | net/tools/quic/quic_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698