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

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

Issue 355573007: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added NET_EXPORT_PRIVATE for ContainsQuicTag Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | net/tools/quic/quic_client_session_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 <string> 6 #include <string>
7 #include <sys/epoll.h> 7 #include <sys/epoll.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 all_supported_versions[0], 110 all_supported_versions[0],
111 use_pacing != 0)); 111 use_pacing != 0));
112 112
113 // Test client supporting all versions and server supporting 1 version. 113 // Test client supporting all versions and server supporting 1 version.
114 // Simulate an old server and exercise version downgrade in the client. 114 // Simulate an old server and exercise version downgrade in the client.
115 // Protocol negotiation should occur. Skip the i = 0 case because it is 115 // Protocol negotiation should occur. Skip the i = 0 case because it is
116 // essentially the same as the default case. 116 // essentially the same as the default case.
117 for (size_t i = 1; i < all_supported_versions.size(); ++i) { 117 for (size_t i = 1; i < all_supported_versions.size(); ++i) {
118 QuicVersionVector server_supported_versions; 118 QuicVersionVector server_supported_versions;
119 server_supported_versions.push_back(all_supported_versions[i]); 119 server_supported_versions.push_back(all_supported_versions[i]);
120 if (all_supported_versions[i] >= QUIC_VERSION_17) { 120 if (all_supported_versions[i] >= QUIC_VERSION_18) {
121 // Until flow control is globally rolled out and we remove 121 // Until flow control is globally rolled out and we remove
122 // QUIC_VERSION_16, the server MUST support at least one QUIC version 122 // QUIC_VERSION_16, the server MUST support at least one QUIC version
123 // that does not use flow control. 123 // that does not use flow control.
124 server_supported_versions.push_back(QUIC_VERSION_16); 124 server_supported_versions.push_back(QUIC_VERSION_16);
125 } 125 }
126 params.push_back(TestParams(all_supported_versions, 126 params.push_back(TestParams(all_supported_versions,
127 server_supported_versions, 127 server_supported_versions,
128 server_supported_versions[0], 128 server_supported_versions[0],
129 use_pacing != 0)); 129 use_pacing != 0));
130 } 130 }
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 HttpConstants::POST, "/foo"); 626 HttpConstants::POST, "/foo");
627 request.AddBody(body, true); 627 request.AddBody(body, true);
628 628
629 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); 629 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
630 EXPECT_EQ(2, client_->client()->session()->GetNumSentClientHellos()); 630 EXPECT_EQ(2, client_->client()->session()->GetNumSentClientHellos());
631 631
632 client_->Disconnect(); 632 client_->Disconnect();
633 633
634 // The 0-RTT handshake should succeed. 634 // The 0-RTT handshake should succeed.
635 client_->Connect(); 635 client_->Connect();
636 if (client_supported_versions_[0] >= QUIC_VERSION_17 && 636 if (client_supported_versions_[0] >= QUIC_VERSION_18 &&
637 negotiated_version_ < QUIC_VERSION_17) { 637 negotiated_version_ <= QUIC_VERSION_16) {
638 // If the version negotiation has resulted in a downgrade, then the client 638 // If the version negotiation has resulted in a downgrade, then the client
639 // must wait for the handshake to complete before sending any data. 639 // must wait for the handshake to complete before sending any data.
640 // Otherwise it may have queued QUIC_VERSION_17 frames which will trigger a 640 // Otherwise it may have queued frames which will trigger a
641 // DFATAL when they are serialized after the downgrade. 641 // DFATAL when they are serialized after the downgrade.
642 client_->client()->WaitForCryptoHandshakeConfirmed(); 642 client_->client()->WaitForCryptoHandshakeConfirmed();
643 } 643 }
644 client_->WaitForResponseForMs(-1); 644 client_->WaitForResponseForMs(-1);
645 ASSERT_TRUE(client_->client()->connected()); 645 ASSERT_TRUE(client_->client()->connected());
646 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); 646 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
647 EXPECT_EQ(1, client_->client()->session()->GetNumSentClientHellos()); 647 EXPECT_EQ(1, client_->client()->session()->GetNumSentClientHellos());
648 648
649 client_->Disconnect(); 649 client_->Disconnect();
650 650
651 // Restart the server so that the 0-RTT handshake will take 1 RTT. 651 // Restart the server so that the 0-RTT handshake will take 1 RTT.
652 StopServer(); 652 StopServer();
653 server_writer_ = new PacketDroppingTestWriter(); 653 server_writer_ = new PacketDroppingTestWriter();
654 StartServer(); 654 StartServer();
655 655
656 client_->Connect(); 656 client_->Connect();
657 if (client_supported_versions_[0] >= QUIC_VERSION_17 && 657 if (client_supported_versions_[0] >= QUIC_VERSION_18 &&
658 negotiated_version_ < QUIC_VERSION_17) { 658 negotiated_version_ <= QUIC_VERSION_16) {
659 // If the version negotiation has resulted in a downgrade, then the client 659 // If the version negotiation has resulted in a downgrade, then the client
660 // must wait for the handshake to complete before sending any data. 660 // must wait for the handshake to complete before sending any data.
661 // Otherwise it may have queued QUIC_VERSION_17 frames which will trigger a 661 // Otherwise it may have queued frames which will trigger a
662 // DFATAL when they are serialized after the downgrade. 662 // DFATAL when they are serialized after the downgrade.
663 client_->client()->WaitForCryptoHandshakeConfirmed(); 663 client_->client()->WaitForCryptoHandshakeConfirmed();
664 } 664 }
665 ASSERT_TRUE(client_->client()->connected()); 665 ASSERT_TRUE(client_->client()->connected());
666 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); 666 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
667 EXPECT_EQ(2, client_->client()->session()->GetNumSentClientHellos()); 667 EXPECT_EQ(2, client_->client()->session()->GetNumSentClientHellos());
668 VerifyCleanConnection(false); 668 VerifyCleanConnection(false);
669 } 669 }
670 670
671 TEST_P(EndToEndTest, LargePostFEC) { 671 TEST_P(EndToEndTest, LargePostFec) {
672 ValueRestore<bool> old_flag(&FLAGS_enable_quic_fec, true);
673
672 // Connect without packet loss to avoid issues with losing handshake packets, 674 // Connect without packet loss to avoid issues with losing handshake packets,
673 // and then up the packet loss rate (b/10126687). 675 // and then up the packet loss rate (b/10126687).
674 ASSERT_TRUE(Initialize()); 676 ASSERT_TRUE(Initialize());
675 677
676 // Wait for the server SHLO before upping the packet loss. 678 // Wait for the server SHLO before upping the packet loss.
677 client_->client()->WaitForCryptoHandshakeConfirmed(); 679 client_->client()->WaitForCryptoHandshakeConfirmed();
678 SetPacketLossPercentage(30); 680 SetPacketLossPercentage(30);
679 681
680 // Enable FEC protection. 682 // Verify that FEC is enabled.
681 QuicPacketCreator* creator = QuicConnectionPeer::GetPacketCreator( 683 QuicPacketCreator* creator = QuicConnectionPeer::GetPacketCreator(
682 client_->client()->session()->connection()); 684 client_->client()->session()->connection());
683 creator->set_max_packets_per_fec_group(3); 685 EXPECT_TRUE(creator->IsFecEnabled());
686 EXPECT_EQ(kMaxPacketsPerFecGroup, creator->max_packets_per_fec_group());
687
684 // Set FecPolicy to always protect data on all streams. 688 // Set FecPolicy to always protect data on all streams.
685 client_->SetFecPolicy(FEC_PROTECT_ALWAYS); 689 client_->SetFecPolicy(FEC_PROTECT_ALWAYS);
686 690
687 string body; 691 string body;
688 GenerateBody(&body, 10240); 692 GenerateBody(&body, 10240);
689 693
690 HTTPMessage request(HttpConstants::HTTP_1_1, 694 HTTPMessage request(HttpConstants::HTTP_1_1,
691 HttpConstants::POST, "/foo"); 695 HttpConstants::POST, "/foo");
692 request.AddBody(body, true); 696 request.AddBody(body, true);
693 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); 697 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request));
694 VerifyCleanConnection(true); 698 VerifyCleanConnection(true);
695 } 699 }
696 700
701 TEST_P(EndToEndTest, ClientSpecifiedFecProtectionForHeaders) {
702 ValueRestore<bool> old_flag(&FLAGS_enable_quic_fec, true);
703
704 // Set FEC config in client's connection options and in client session.
705 QuicTagVector copt;
706 copt.push_back(kFHDR);
707 client_config_.SetConnectionOptionsToSend(copt);
708
709 // Connect without packet loss to avoid issues with losing handshake packets,
710 // and then up the packet loss rate (b/10126687).
711 ASSERT_TRUE(Initialize());
712 client_->client()->WaitForCryptoHandshakeConfirmed();
713 server_thread_->WaitForCryptoHandshakeConfirmed();
714
715 // Verify that FEC is enabled.
716 QuicPacketCreator* creator = QuicConnectionPeer::GetPacketCreator(
717 client_->client()->session()->connection());
718 EXPECT_TRUE(creator->IsFecEnabled());
719 EXPECT_EQ(kMaxPacketsPerFecGroup, creator->max_packets_per_fec_group());
720
721 // Verify that server headers stream is FEC protected.
722 server_thread_->Pause();
723 QuicDispatcher* dispatcher =
724 QuicServerPeer::GetDispatcher(server_thread_->server());
725 ASSERT_EQ(1u, dispatcher->session_map().size());
726 QuicSession* session = dispatcher->session_map().begin()->second;
727 EXPECT_EQ(FEC_PROTECT_ALWAYS,
728 QuicSessionPeer::GetHeadersStream(session)->fec_policy());
729 server_thread_->Resume();
730
731 // Verify that at the client, headers stream is protected and other data
732 // streams are optionally protected.
733 EXPECT_EQ(FEC_PROTECT_ALWAYS, QuicSessionPeer::GetHeadersStream(
734 client_->client()->session())->fec_policy());
735 EXPECT_EQ(FEC_PROTECT_OPTIONAL, client_->GetOrCreateStream()->fec_policy());
736 }
737
697 // TODO(shess): This is flaky on ChromiumOS bots. 738 // TODO(shess): This is flaky on ChromiumOS bots.
698 // http://crbug.com/374871 739 // http://crbug.com/374871
699 TEST_P(EndToEndTest, DISABLED_LargePostSmallBandwidthLargeBuffer) { 740 TEST_P(EndToEndTest, DISABLED_LargePostSmallBandwidthLargeBuffer) {
700 ASSERT_TRUE(Initialize()); 741 ASSERT_TRUE(Initialize());
701 SetPacketSendDelay(QuicTime::Delta::FromMicroseconds(1)); 742 SetPacketSendDelay(QuicTime::Delta::FromMicroseconds(1));
702 // 256KB per second with a 256KB buffer from server to client. Wireless 743 // 256KB per second with a 256KB buffer from server to client. Wireless
703 // clients commonly have larger buffers, but our max CWND is 200. 744 // clients commonly have larger buffers, but our max CWND is 200.
704 server_writer_->set_max_bandwidth_and_buffer_size( 745 server_writer_->set_max_bandwidth_and_buffer_size(
705 QuicBandwidth::FromBytesPerSecond(256 * 1024), 256 * 1024); 746 QuicBandwidth::FromBytesPerSecond(256 * 1024), 256 * 1024);
706 747
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 session->config()->ReceivedInitialSessionFlowControlWindowBytes()); 1272 session->config()->ReceivedInitialSessionFlowControlWindowBytes());
1232 EXPECT_EQ(kClientSessionIFCW, QuicFlowControllerPeer::SendWindowOffset( 1273 EXPECT_EQ(kClientSessionIFCW, QuicFlowControllerPeer::SendWindowOffset(
1233 session->flow_controller())); 1274 session->flow_controller()));
1234 server_thread_->Resume(); 1275 server_thread_->Resume();
1235 } 1276 }
1236 1277
1237 } // namespace 1278 } // namespace
1238 } // namespace test 1279 } // namespace test
1239 } // namespace tools 1280 } // namespace tools
1240 } // namespace net 1281 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | net/tools/quic/quic_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698