| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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) { |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 session->config()->ReceivedInitialSessionFlowControlWindowBytes()); | 1272 session->config()->ReceivedInitialSessionFlowControlWindowBytes()); |
| 1273 EXPECT_EQ(kClientSessionIFCW, QuicFlowControllerPeer::SendWindowOffset( | 1273 EXPECT_EQ(kClientSessionIFCW, QuicFlowControllerPeer::SendWindowOffset( |
| 1274 session->flow_controller())); | 1274 session->flow_controller())); |
| 1275 server_thread_->Resume(); | 1275 server_thread_->Resume(); |
| 1276 } | 1276 } |
| 1277 | 1277 |
| 1278 } // namespace | 1278 } // namespace |
| 1279 } // namespace test | 1279 } // namespace test |
| 1280 } // namespace tools | 1280 } // namespace tools |
| 1281 } // namespace net | 1281 } // namespace net |
| OLD | NEW |