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

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

Issue 185203003: Killing off QUICv12, including cleaning out all of the code for handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Deleted unused StripUint32 Created 6 years, 9 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.cc ('k') | net/tools/quic/quic_server_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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 QuicVersionVector server_supported_versions; 95 QuicVersionVector server_supported_versions;
96 QuicVersion negotiated_version; 96 QuicVersion negotiated_version;
97 bool use_pacing; 97 bool use_pacing;
98 }; 98 };
99 99
100 // Constructs various test permutations. 100 // Constructs various test permutations.
101 vector<TestParams> GetTestParams() { 101 vector<TestParams> GetTestParams() {
102 vector<TestParams> params; 102 vector<TestParams> params;
103 QuicVersionVector all_supported_versions = QuicSupportedVersions(); 103 QuicVersionVector all_supported_versions = QuicSupportedVersions();
104 for (int use_pacing = 0; use_pacing < 2; ++use_pacing) { 104 for (int use_pacing = 0; use_pacing < 2; ++use_pacing) {
105 // TODO(rch): since 13 is not 0-RTT compatible with 12, we can not
106 // have the client support both at the same time.
107 #if 0
108 // Add an entry for server and client supporting all versions. 105 // Add an entry for server and client supporting all versions.
109 params.push_back(TestParams(all_supported_versions, 106 params.push_back(TestParams(all_supported_versions,
110 all_supported_versions, 107 all_supported_versions,
111 all_supported_versions[0], 108 all_supported_versions[0],
112 use_pacing != 0)); 109 use_pacing != 0));
113 #endif
114 110
115 // Test client supporting 1 version and server supporting all versions.
116 // Simulate an old client and exercise version downgrade in the server.
117 // No protocol negotiation should occur. Skip the i = 0 case because it
118 // is essentially the same as the default case.
119 // TODO(rch): When QUIC_VERSION_12 is removed, change the intialization
120 // of i from 0 back to 1.
121 for (size_t i = 0; i < all_supported_versions.size(); ++i) {
122 QuicVersionVector client_supported_versions;
123 client_supported_versions.push_back(all_supported_versions[i]);
124 params.push_back(TestParams(client_supported_versions,
125 all_supported_versions,
126 client_supported_versions[0],
127 use_pacing != 0));
128 }
129
130 // TODO(rch): since 13 is not 0-RTT compatible with 12, we can not
131 // have the client support both at the same time.
132 #if 0
133 // Test client supporting all versions and server supporting 1 version. 111 // Test client supporting all versions and server supporting 1 version.
134 // Simulate an old server and exercise version downgrade in the client. 112 // Simulate an old server and exercise version downgrade in the client.
135 // Protocol negotiation should occur. Skip the i = 0 case because it is 113 // Protocol negotiation should occur. Skip the i = 0 case because it is
136 // essentially the same as the default case. 114 // essentially the same as the default case.
137 for (size_t i = 1; i < all_supported_versions.size(); ++i) { 115 for (size_t i = 1; i < all_supported_versions.size(); ++i) {
138 QuicVersionVector server_supported_versions; 116 QuicVersionVector server_supported_versions;
139 server_supported_versions.push_back(all_supported_versions[i]); 117 server_supported_versions.push_back(all_supported_versions[i]);
140 params.push_back(TestParams(all_supported_versions, 118 params.push_back(TestParams(all_supported_versions,
141 server_supported_versions, 119 server_supported_versions,
142 server_supported_versions[0], 120 server_supported_versions[0],
143 use_pacing != 0)); 121 use_pacing != 0));
144 } 122 }
145 #endif
146 } 123 }
147 return params; 124 return params;
148 } 125 }
149 126
150 class ServerDelegate : public PacketDroppingTestWriter::Delegate { 127 class ServerDelegate : public PacketDroppingTestWriter::Delegate {
151 public: 128 public:
152 explicit ServerDelegate(QuicDispatcher* dispatcher) 129 explicit ServerDelegate(QuicDispatcher* dispatcher)
153 : dispatcher_(dispatcher) {} 130 : dispatcher_(dispatcher) {}
154 virtual ~ServerDelegate() {} 131 virtual ~ServerDelegate() {}
155 virtual void OnCanWrite() OVERRIDE { dispatcher_->OnCanWrite(); } 132 virtual void OnCanWrite() OVERRIDE { dispatcher_->OnCanWrite(); }
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 802
826 client_->client()->WaitForCryptoHandshakeConfirmed(); 803 client_->client()->WaitForCryptoHandshakeConfirmed();
827 804
828 QuicSession* session = client_->client()->session(); 805 QuicSession* session = client_->client()->session();
829 // Lose the request. 806 // Lose the request.
830 SetPacketLossPercentage(100); 807 SetPacketLossPercentage(100);
831 EXPECT_LT(0, client_->SendRequest("/small_response")); 808 EXPECT_LT(0, client_->SendRequest("/small_response"));
832 client_->client()->WaitForEvents(); 809 client_->client()->WaitForEvents();
833 // Transmit the cancel, and ensure the connection is torn down properly. 810 // Transmit the cancel, and ensure the connection is torn down properly.
834 SetPacketLossPercentage(0); 811 SetPacketLossPercentage(0);
835 QuicStreamId stream_id = negotiated_version_ > QUIC_VERSION_12 ? 5 : 3; 812 QuicStreamId stream_id = 5;
836 session->SendRstStream(stream_id, QUIC_STREAM_CANCELLED, 0); 813 session->SendRstStream(stream_id, QUIC_STREAM_CANCELLED, 0);
837 814
838 // WaitForEvents waits 50ms and returns true if there are outstanding 815 // WaitForEvents waits 50ms and returns true if there are outstanding
839 // requests. 816 // requests.
840 while (client_->client()->WaitForEvents() == true) { 817 while (client_->client()->WaitForEvents() == true) {
841 } 818 }
842 if (negotiated_version_ > QUIC_VERSION_12) { 819 // It should be completely fine to RST a stream before any data has been
843 // It should be completely fine to RST a stream before any data has bee 820 // received for that stream.
844 // received for that stream. 821 EXPECT_EQ(QUIC_NO_ERROR, client_->connection_error());
845 EXPECT_EQ(QUIC_NO_ERROR, client_->connection_error());
846 } else {
847 // Check that the connection is always properly closed
848 // from a stream being RST before headers are decompressed.
849 EXPECT_EQ(QUIC_STREAM_RST_BEFORE_HEADERS_DECOMPRESSED,
850 client_->connection_error());
851 }
852 } 822 }
853 823
854 class WrongAddressWriter : public QuicPacketWriterWrapper { 824 class WrongAddressWriter : public QuicPacketWriterWrapper {
855 public: 825 public:
856 WrongAddressWriter() { 826 WrongAddressWriter() {
857 IPAddressNumber ip; 827 IPAddressNumber ip;
858 CHECK(net::ParseIPLiteralToNumber("127.0.0.2", &ip)); 828 CHECK(net::ParseIPLiteralToNumber("127.0.0.2", &ip));
859 self_address_ = IPEndPoint(ip, 0); 829 self_address_ = IPEndPoint(ip, 0);
860 } 830 }
861 831
(...skipping 30 matching lines...) Expand all
892 client_->SendSynchronousRequest("/bar"); 862 client_->SendSynchronousRequest("/bar");
893 863
894 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); 864 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error());
895 EXPECT_EQ(QUIC_ERROR_MIGRATING_ADDRESS, client_->connection_error()); 865 EXPECT_EQ(QUIC_ERROR_MIGRATING_ADDRESS, client_->connection_error());
896 } 866 }
897 867
898 } // namespace 868 } // namespace
899 } // namespace test 869 } // namespace test
900 } // namespace tools 870 } // namespace tools
901 } // namespace net 871 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.cc ('k') | net/tools/quic/quic_server_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698