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

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

Issue 2569113002: relnote: Allow changing initial flow control window via connection options. Protected by --quic_lar… (Closed)
Patch Set: Created 4 years 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/core/quic_session_test.cc ('k') | no next file » | 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 GetSentPacketManagerFromFirstServerSession() const { 366 GetSentPacketManagerFromFirstServerSession() const {
367 QuicDispatcher* dispatcher = 367 QuicDispatcher* dispatcher =
368 QuicServerPeer::GetDispatcher(server_thread_->server()); 368 QuicServerPeer::GetDispatcher(server_thread_->server());
369 QuicSession* session = dispatcher->session_map().begin()->second.get(); 369 QuicSession* session = dispatcher->session_map().begin()->second.get();
370 return &session->connection()->sent_packet_manager(); 370 return &session->connection()->sent_packet_manager();
371 } 371 }
372 372
373 bool Initialize() { 373 bool Initialize() {
374 QuicTagVector copt; 374 QuicTagVector copt;
375 server_config_.SetConnectionOptionsToSend(copt); 375 server_config_.SetConnectionOptionsToSend(copt);
376 copt = client_extra_copts_;
376 377
377 // TODO(nimia): Consider setting the congestion control algorithm for the 378 // TODO(nimia): Consider setting the congestion control algorithm for the
378 // client as well according to the test parameter. 379 // client as well according to the test parameter.
379 copt.push_back(GetParam().congestion_control_tag); 380 copt.push_back(GetParam().congestion_control_tag);
380 if (GetParam().congestion_control_tag == kQBIC && 381 if (GetParam().congestion_control_tag == kQBIC &&
381 FLAGS_quic_fix_cubic_convex_mode) { 382 FLAGS_quic_fix_cubic_convex_mode) {
382 copt.push_back(kCCVX); 383 copt.push_back(kCCVX);
383 } 384 }
384 if (GetParam().congestion_control_tag == kQBIC && 385 if (GetParam().congestion_control_tag == kQBIC &&
385 FLAGS_quic_fix_cubic_bytes_quantization) { 386 FLAGS_quic_fix_cubic_bytes_quantization) {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 QuicHttpResponseCache response_cache_; 568 QuicHttpResponseCache response_cache_;
568 std::unique_ptr<ServerThread> server_thread_; 569 std::unique_ptr<ServerThread> server_thread_;
569 std::unique_ptr<QuicTestClient> client_; 570 std::unique_ptr<QuicTestClient> client_;
570 PacketDroppingTestWriter* client_writer_; 571 PacketDroppingTestWriter* client_writer_;
571 PacketDroppingTestWriter* server_writer_; 572 PacketDroppingTestWriter* server_writer_;
572 bool server_started_; 573 bool server_started_;
573 QuicConfig client_config_; 574 QuicConfig client_config_;
574 QuicConfig server_config_; 575 QuicConfig server_config_;
575 QuicVersionVector client_supported_versions_; 576 QuicVersionVector client_supported_versions_;
576 QuicVersionVector server_supported_versions_; 577 QuicVersionVector server_supported_versions_;
578 QuicTagVector client_extra_copts_;
577 QuicVersion negotiated_version_; 579 QuicVersion negotiated_version_;
578 size_t chlo_multiplier_; 580 size_t chlo_multiplier_;
579 QuicTestServer::StreamFactory* stream_factory_; 581 QuicTestServer::StreamFactory* stream_factory_;
580 bool support_server_push_; 582 bool support_server_push_;
581 bool force_hol_blocking_; 583 bool force_hol_blocking_;
582 }; 584 };
583 585
584 // Run all end to end tests with all supported versions. 586 // Run all end to end tests with all supported versions.
585 INSTANTIATE_TEST_CASE_P(EndToEndTests, 587 INSTANTIATE_TEST_CASE_P(EndToEndTests,
586 EndToEndTest, 588 EndToEndTest,
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 QuicSession* session = dispatcher->session_map().begin()->second.get(); 1702 QuicSession* session = dispatcher->session_map().begin()->second.get();
1701 EXPECT_EQ(kClientStreamIFCW, 1703 EXPECT_EQ(kClientStreamIFCW,
1702 session->config()->ReceivedInitialStreamFlowControlWindowBytes()); 1704 session->config()->ReceivedInitialStreamFlowControlWindowBytes());
1703 EXPECT_EQ(kClientSessionIFCW, 1705 EXPECT_EQ(kClientSessionIFCW,
1704 session->config()->ReceivedInitialSessionFlowControlWindowBytes()); 1706 session->config()->ReceivedInitialSessionFlowControlWindowBytes());
1705 EXPECT_EQ(kClientSessionIFCW, QuicFlowControllerPeer::SendWindowOffset( 1707 EXPECT_EQ(kClientSessionIFCW, QuicFlowControllerPeer::SendWindowOffset(
1706 session->flow_controller())); 1708 session->flow_controller()));
1707 server_thread_->Resume(); 1709 server_thread_->Resume();
1708 } 1710 }
1709 1711
1712 // Test negotiation of IFWA connection option.
1713 TEST_P(EndToEndTest, NegotiatedServerInitialFlowControlWindow) {
1714 FLAGS_quic_large_ifw_options = true;
1715
1716 const uint32_t kClientStreamIFCW = 123456;
1717 const uint32_t kClientSessionIFCW = 234567;
1718 set_client_initial_stream_flow_control_receive_window(kClientStreamIFCW);
1719 set_client_initial_session_flow_control_receive_window(kClientSessionIFCW);
1720
1721 uint32_t kServerStreamIFCW = 32 * 1024;
1722 uint32_t kServerSessionIFCW = 48 * 1024;
1723 set_server_initial_stream_flow_control_receive_window(kServerStreamIFCW);
1724 set_server_initial_session_flow_control_receive_window(kServerSessionIFCW);
1725
1726 // Bump the window.
1727 const uint32_t kExpectedStreamIFCW = 1024 * 1024;
1728 const uint32_t kExpectedSessionIFCW = 1.5 * 1024 * 1024;
1729 client_extra_copts_.push_back(kIFWA);
1730
1731 ASSERT_TRUE(Initialize());
1732
1733 // Values are exchanged during crypto handshake, so wait for that to finish.
1734 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed());
1735 server_thread_->WaitForCryptoHandshakeConfirmed();
1736
1737 // Open a data stream to make sure the stream level flow control is updated.
1738 QuicSpdyClientStream* stream = client_->GetOrCreateStream();
1739 stream->WriteOrBufferBody("hello", false, nullptr);
1740
1741 // Client should have the right values for server's receive window.
1742 EXPECT_EQ(kExpectedStreamIFCW,
1743 client_->client()
1744 ->session()
1745 ->config()
1746 ->ReceivedInitialStreamFlowControlWindowBytes());
1747 EXPECT_EQ(kExpectedSessionIFCW,
1748 client_->client()
1749 ->session()
1750 ->config()
1751 ->ReceivedInitialSessionFlowControlWindowBytes());
1752 EXPECT_EQ(kExpectedStreamIFCW, QuicFlowControllerPeer::SendWindowOffset(
1753 stream->flow_controller()));
1754 EXPECT_EQ(kExpectedSessionIFCW,
1755 QuicFlowControllerPeer::SendWindowOffset(
1756 client_->client()->session()->flow_controller()));
1757 }
1758
1710 TEST_P(EndToEndTest, HeadersAndCryptoStreamsNoConnectionFlowControl) { 1759 TEST_P(EndToEndTest, HeadersAndCryptoStreamsNoConnectionFlowControl) {
1711 // The special headers and crypto streams should be subject to per-stream flow 1760 // The special headers and crypto streams should be subject to per-stream flow
1712 // control limits, but should not be subject to connection level flow control 1761 // control limits, but should not be subject to connection level flow control
1713 const uint32_t kStreamIFCW = 32 * 1024; 1762 const uint32_t kStreamIFCW = 32 * 1024;
1714 const uint32_t kSessionIFCW = 48 * 1024; 1763 const uint32_t kSessionIFCW = 48 * 1024;
1715 set_client_initial_stream_flow_control_receive_window(kStreamIFCW); 1764 set_client_initial_stream_flow_control_receive_window(kStreamIFCW);
1716 set_client_initial_session_flow_control_receive_window(kSessionIFCW); 1765 set_client_initial_session_flow_control_receive_window(kSessionIFCW);
1717 set_server_initial_stream_flow_control_receive_window(kStreamIFCW); 1766 set_server_initial_stream_flow_control_receive_window(kStreamIFCW);
1718 set_server_initial_session_flow_control_receive_window(kSessionIFCW); 1767 set_server_initial_session_flow_control_receive_window(kSessionIFCW);
1719 1768
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2473 QuicDispatcher* dispatcher = 2522 QuicDispatcher* dispatcher =
2474 QuicServerPeer::GetDispatcher(server_thread_->server()); 2523 QuicServerPeer::GetDispatcher(server_thread_->server());
2475 QuicDispatcher::SessionMap const& map = 2524 QuicDispatcher::SessionMap const& map =
2476 QuicDispatcherPeer::session_map(dispatcher); 2525 QuicDispatcherPeer::session_map(dispatcher);
2477 QuicDispatcher::SessionMap::const_iterator it = map.begin(); 2526 QuicDispatcher::SessionMap::const_iterator it = map.begin();
2478 EXPECT_TRUE(it != map.end()); 2527 EXPECT_TRUE(it != map.end());
2479 QuicSession* server_session = it->second.get(); 2528 QuicSession* server_session = it->second.get();
2480 2529
2481 // The stream is not waiting for the arrival of the peer's final offset. 2530 // The stream is not waiting for the arrival of the peer's final offset.
2482 EXPECT_EQ( 2531 EXPECT_EQ(
2483 0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(server_session) 2532 0u,
2484 .size()); 2533 QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(server_session)
2534 .size());
2485 2535
2486 server_thread_->Resume(); 2536 server_thread_->Resume();
2487 } 2537 }
2488 2538
2489 TEST_P(EndToEndTest, LargePostEarlyResponse) { 2539 TEST_P(EndToEndTest, LargePostEarlyResponse) {
2490 const uint32_t kWindowSize = 65536; 2540 const uint32_t kWindowSize = 65536;
2491 set_client_initial_stream_flow_control_receive_window(kWindowSize); 2541 set_client_initial_stream_flow_control_receive_window(kWindowSize);
2492 set_client_initial_session_flow_control_receive_window(kWindowSize); 2542 set_client_initial_session_flow_control_receive_window(kWindowSize);
2493 set_server_initial_stream_flow_control_receive_window(kWindowSize); 2543 set_server_initial_stream_flow_control_receive_window(kWindowSize);
2494 set_server_initial_session_flow_control_receive_window(kWindowSize); 2544 set_server_initial_session_flow_control_receive_window(kWindowSize);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2621 "https://fonts.example.com/font.woff", 2671 "https://fonts.example.com/font.woff",
2622 "https://example.com/logo-hires.jpg"}; 2672 "https://example.com/logo-hires.jpg"};
2623 AddRequestAndResponseWithServerPush("example.com", "/push_example", kBody, 2673 AddRequestAndResponseWithServerPush("example.com", "/push_example", kBody,
2624 push_urls, kNumResources, 0); 2674 push_urls, kNumResources, 0);
2625 2675
2626 client_->client()->set_response_listener( 2676 client_->client()->set_response_listener(
2627 std::unique_ptr<QuicClientBase::ResponseListener>( 2677 std::unique_ptr<QuicClientBase::ResponseListener>(
2628 new TestResponseListener)); 2678 new TestResponseListener));
2629 2679
2630 DVLOG(1) << "send request for /push_example"; 2680 DVLOG(1) << "send request for /push_example";
2631 EXPECT_EQ(kBody, client_->SendSynchronousRequest( 2681 EXPECT_EQ(
2632 "https://example.com/push_example")); 2682 kBody,
2683 client_->SendSynchronousRequest("https://example.com/push_example"));
2633 QuicHeadersStream* headers_stream = 2684 QuicHeadersStream* headers_stream =
2634 QuicSpdySessionPeer::GetHeadersStream(client_->client()->session()); 2685 QuicSpdySessionPeer::GetHeadersStream(client_->client()->session());
2635 QuicStreamSequencer* sequencer = QuicStreamPeer::sequencer(headers_stream); 2686 QuicStreamSequencer* sequencer = QuicStreamPeer::sequencer(headers_stream);
2636 // Headers stream's sequencer buffer shouldn't be released because server push 2687 // Headers stream's sequencer buffer shouldn't be released because server push
2637 // hasn't finished yet. 2688 // hasn't finished yet.
2638 EXPECT_TRUE(QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); 2689 EXPECT_TRUE(QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer));
2639 2690
2640 for (const string& url : push_urls) { 2691 for (const string& url : push_urls) {
2641 DVLOG(1) << "send request for pushed stream on url " << url; 2692 DVLOG(1) << "send request for pushed stream on url " << url;
2642 string expected_body = "This is server push response body for " + url; 2693 string expected_body = "This is server push response body for " + url;
(...skipping 29 matching lines...) Expand all
2672 }; 2723 };
2673 AddRequestAndResponseWithServerPush("example.com", "/push_example", kBody, 2724 AddRequestAndResponseWithServerPush("example.com", "/push_example", kBody,
2674 push_urls, kNumResources, 0); 2725 push_urls, kNumResources, 0);
2675 client_->client()->set_response_listener( 2726 client_->client()->set_response_listener(
2676 std::unique_ptr<QuicClientBase::ResponseListener>( 2727 std::unique_ptr<QuicClientBase::ResponseListener>(
2677 new TestResponseListener)); 2728 new TestResponseListener));
2678 2729
2679 // Send the first request: this will trigger the server to send all the push 2730 // Send the first request: this will trigger the server to send all the push
2680 // resources associated with this request, and these will be cached by the 2731 // resources associated with this request, and these will be cached by the
2681 // client. 2732 // client.
2682 EXPECT_EQ(kBody, client_->SendSynchronousRequest( 2733 EXPECT_EQ(
2683 "https://example.com/push_example")); 2734 kBody,
2735 client_->SendSynchronousRequest("https://example.com/push_example"));
2684 2736
2685 for (const string& url : push_urls) { 2737 for (const string& url : push_urls) {
2686 // Sending subsequent requesets will not actually send anything on the wire, 2738 // Sending subsequent requesets will not actually send anything on the wire,
2687 // as the responses are already in the client's cache. 2739 // as the responses are already in the client's cache.
2688 DVLOG(1) << "send request for pushed stream on url " << url; 2740 DVLOG(1) << "send request for pushed stream on url " << url;
2689 string expected_body = "This is server push response body for " + url; 2741 string expected_body = "This is server push response body for " + url;
2690 string response_body = client_->SendSynchronousRequest(url); 2742 string response_body = client_->SendSynchronousRequest(url);
2691 DVLOG(1) << "response body " << response_body; 2743 DVLOG(1) << "response body " << response_body;
2692 EXPECT_EQ(expected_body, response_body); 2744 EXPECT_EQ(expected_body, response_body);
2693 } 2745 }
(...skipping 26 matching lines...) Expand all
2720 } 2772 }
2721 AddRequestAndResponseWithServerPush("example.com", "/push_example", kBody, 2773 AddRequestAndResponseWithServerPush("example.com", "/push_example", kBody,
2722 push_urls, kNumResources, 0); 2774 push_urls, kNumResources, 0);
2723 client_->client()->set_response_listener( 2775 client_->client()->set_response_listener(
2724 std::unique_ptr<QuicClientBase::ResponseListener>( 2776 std::unique_ptr<QuicClientBase::ResponseListener>(
2725 new TestResponseListener)); 2777 new TestResponseListener));
2726 2778
2727 // Send the first request: this will trigger the server to send all the push 2779 // Send the first request: this will trigger the server to send all the push
2728 // resources associated with this request, and these will be cached by the 2780 // resources associated with this request, and these will be cached by the
2729 // client. 2781 // client.
2730 EXPECT_EQ(kBody, client_->SendSynchronousRequest( 2782 EXPECT_EQ(
2731 "https://example.com/push_example")); 2783 kBody,
2784 client_->SendSynchronousRequest("https://example.com/push_example"));
2732 2785
2733 for (const string& url : push_urls) { 2786 for (const string& url : push_urls) {
2734 // Sending subsequent requesets will not actually send anything on the wire, 2787 // Sending subsequent requesets will not actually send anything on the wire,
2735 // as the responses are already in the client's cache. 2788 // as the responses are already in the client's cache.
2736 EXPECT_EQ("This is server push response body for " + url, 2789 EXPECT_EQ("This is server push response body for " + url,
2737 client_->SendSynchronousRequest(url)); 2790 client_->SendSynchronousRequest(url));
2738 } 2791 }
2739 2792
2740 // Only 1 request should have been sent. 2793 // Only 1 request should have been sent.
2741 EXPECT_EQ(1u, client_->num_requests()); 2794 EXPECT_EQ(1u, client_->num_requests());
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2840 string push_urls[] = { 2893 string push_urls[] = {
2841 "https://example.com/font.woff", "https://example.com/script.js", 2894 "https://example.com/font.woff", "https://example.com/script.js",
2842 "https://fonts.example.com/font.woff", 2895 "https://fonts.example.com/font.woff",
2843 "https://example.com/logo-hires.jpg", 2896 "https://example.com/logo-hires.jpg",
2844 }; 2897 };
2845 AddRequestAndResponseWithServerPush("example.com", "/push_example", kBody, 2898 AddRequestAndResponseWithServerPush("example.com", "/push_example", kBody,
2846 push_urls, kNumResources, 0); 2899 push_urls, kNumResources, 0);
2847 client_->client()->set_response_listener( 2900 client_->client()->set_response_listener(
2848 std::unique_ptr<QuicClientBase::ResponseListener>( 2901 std::unique_ptr<QuicClientBase::ResponseListener>(
2849 new TestResponseListener)); 2902 new TestResponseListener));
2850 EXPECT_EQ(kBody, client_->SendSynchronousRequest( 2903 EXPECT_EQ(
2851 "https://example.com/push_example")); 2904 kBody,
2905 client_->SendSynchronousRequest("https://example.com/push_example"));
2852 2906
2853 for (const string& url : push_urls) { 2907 for (const string& url : push_urls) {
2854 // Sending subsequent requests will trigger sending real requests because 2908 // Sending subsequent requests will trigger sending real requests because
2855 // client doesn't support server push. 2909 // client doesn't support server push.
2856 const string expected_body = "This is server push response body for " + url; 2910 const string expected_body = "This is server push response body for " + url;
2857 const string response_body = client_->SendSynchronousRequest(url); 2911 const string response_body = client_->SendSynchronousRequest(url);
2858 EXPECT_EQ(expected_body, response_body); 2912 EXPECT_EQ(expected_body, response_body);
2859 } 2913 }
2860 // Same number of requests are sent as that of responses received. 2914 // Same number of requests are sent as that of responses received.
2861 EXPECT_EQ(1 + kNumResources, client_->num_requests()); 2915 EXPECT_EQ(1 + kNumResources, client_->num_requests());
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 client_->WaitForResponse(); 3056 client_->WaitForResponse();
3003 EXPECT_EQ(kBarResponseBody, client_->response_body()); 3057 EXPECT_EQ(kBarResponseBody, client_->response_body());
3004 QuicConnectionStats client_stats = 3058 QuicConnectionStats client_stats =
3005 client_->client()->session()->connection()->GetStats(); 3059 client_->client()->session()->connection()->GetStats();
3006 EXPECT_EQ(0u, client_stats.packets_lost); 3060 EXPECT_EQ(0u, client_stats.packets_lost);
3007 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); 3061 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos());
3008 } 3062 }
3009 } // namespace 3063 } // namespace
3010 } // namespace test 3064 } // namespace test
3011 } // namespace net 3065 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_session_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698