OLD | NEW |
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 use_fec != 0, | 132 use_fec != 0, |
133 congestion_control_tag)); | 133 congestion_control_tag)); |
134 | 134 |
135 // Test client supporting all versions and server supporting 1 version. | 135 // Test client supporting all versions and server supporting 1 version. |
136 // Simulate an old server and exercise version downgrade in the client. | 136 // Simulate an old server and exercise version downgrade in the client. |
137 // Protocol negotiation should occur. Skip the i = 0 case because it is | 137 // Protocol negotiation should occur. Skip the i = 0 case because it is |
138 // essentially the same as the default case. | 138 // essentially the same as the default case. |
139 for (size_t i = 1; i < all_supported_versions.size(); ++i) { | 139 for (size_t i = 1; i < all_supported_versions.size(); ++i) { |
140 QuicVersionVector server_supported_versions; | 140 QuicVersionVector server_supported_versions; |
141 server_supported_versions.push_back(all_supported_versions[i]); | 141 server_supported_versions.push_back(all_supported_versions[i]); |
142 if (all_supported_versions[i] >= QUIC_VERSION_18) { | |
143 // Until flow control is globally rolled out and we remove | |
144 // QUIC_VERSION_16, the server MUST support at least one QUIC | |
145 // version that does not use flow control. | |
146 server_supported_versions.push_back(QUIC_VERSION_16); | |
147 } | |
148 params.push_back(TestParams(all_supported_versions, | 142 params.push_back(TestParams(all_supported_versions, |
149 server_supported_versions, | 143 server_supported_versions, |
150 server_supported_versions[0], | 144 server_supported_versions[0], |
151 use_pacing != 0, | 145 use_pacing != 0, |
152 use_fec != 0, | 146 use_fec != 0, |
153 congestion_control_tag)); | 147 congestion_control_tag)); |
154 } | 148 } |
155 } | 149 } |
156 } | 150 } |
157 } | 151 } |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 HttpConstants::POST, "/foo"); | 680 HttpConstants::POST, "/foo"); |
687 request.AddBody(body, true); | 681 request.AddBody(body, true); |
688 | 682 |
689 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | 683 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
690 EXPECT_EQ(2, client_->client()->session()->GetNumSentClientHellos()); | 684 EXPECT_EQ(2, client_->client()->session()->GetNumSentClientHellos()); |
691 | 685 |
692 client_->Disconnect(); | 686 client_->Disconnect(); |
693 | 687 |
694 // The 0-RTT handshake should succeed. | 688 // The 0-RTT handshake should succeed. |
695 client_->Connect(); | 689 client_->Connect(); |
696 if (client_supported_versions_[0] >= QUIC_VERSION_18 && | |
697 negotiated_version_ <= QUIC_VERSION_16) { | |
698 // If the version negotiation has resulted in a downgrade, then the client | |
699 // must wait for the handshake to complete before sending any data. | |
700 // Otherwise it may have queued frames which will trigger a | |
701 // DFATAL when they are serialized after the downgrade. | |
702 client_->client()->WaitForCryptoHandshakeConfirmed(); | |
703 } | |
704 client_->WaitForResponseForMs(-1); | 690 client_->WaitForResponseForMs(-1); |
705 ASSERT_TRUE(client_->client()->connected()); | 691 ASSERT_TRUE(client_->client()->connected()); |
706 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | 692 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
707 EXPECT_EQ(1, client_->client()->session()->GetNumSentClientHellos()); | 693 EXPECT_EQ(1, client_->client()->session()->GetNumSentClientHellos()); |
708 | 694 |
709 client_->Disconnect(); | 695 client_->Disconnect(); |
710 | 696 |
711 // Restart the server so that the 0-RTT handshake will take 1 RTT. | 697 // Restart the server so that the 0-RTT handshake will take 1 RTT. |
712 StopServer(); | 698 StopServer(); |
713 server_writer_ = new PacketDroppingTestWriter(); | 699 server_writer_ = new PacketDroppingTestWriter(); |
714 StartServer(); | 700 StartServer(); |
715 | 701 |
716 client_->Connect(); | 702 client_->Connect(); |
717 if (client_supported_versions_[0] >= QUIC_VERSION_18 && | |
718 negotiated_version_ <= QUIC_VERSION_16) { | |
719 // If the version negotiation has resulted in a downgrade, then the client | |
720 // must wait for the handshake to complete before sending any data. | |
721 // Otherwise it may have queued frames which will trigger a | |
722 // DFATAL when they are serialized after the downgrade. | |
723 client_->client()->WaitForCryptoHandshakeConfirmed(); | |
724 } | |
725 ASSERT_TRUE(client_->client()->connected()); | 703 ASSERT_TRUE(client_->client()->connected()); |
726 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); | 704 EXPECT_EQ(kFooResponseBody, client_->SendCustomSynchronousRequest(request)); |
727 EXPECT_EQ(2, client_->client()->session()->GetNumSentClientHellos()); | 705 EXPECT_EQ(2, client_->client()->session()->GetNumSentClientHellos()); |
728 VerifyCleanConnection(false); | 706 VerifyCleanConnection(false); |
729 } | 707 } |
730 | 708 |
731 TEST_P(EndToEndTest, CorrectlyConfiguredFec) { | 709 TEST_P(EndToEndTest, CorrectlyConfiguredFec) { |
732 ASSERT_TRUE(Initialize()); | 710 ASSERT_TRUE(Initialize()); |
733 client_->client()->WaitForCryptoHandshakeConfirmed(); | 711 client_->client()->WaitForCryptoHandshakeConfirmed(); |
734 server_thread_->WaitForCryptoHandshakeConfirmed(); | 712 server_thread_->WaitForCryptoHandshakeConfirmed(); |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 QuicSession* session = dispatcher->session_map().begin()->second; | 1363 QuicSession* session = dispatcher->session_map().begin()->second; |
1386 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( | 1364 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( |
1387 session).size()); | 1365 session).size()); |
1388 server_thread_->Resume(); | 1366 server_thread_->Resume(); |
1389 } | 1367 } |
1390 | 1368 |
1391 } // namespace | 1369 } // namespace |
1392 } // namespace test | 1370 } // namespace test |
1393 } // namespace tools | 1371 } // namespace tools |
1394 } // namespace net | 1372 } // namespace net |
OLD | NEW |