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 <algorithm> | 5 #include <algorithm> |
6 #include <memory> | 6 #include <memory> |
7 #include <ostream> | 7 #include <ostream> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 MockQuicData mock_quic_data; | 1199 MockQuicData mock_quic_data; |
1200 QuicStreamOffset request_header_offset = 0; | 1200 QuicStreamOffset request_header_offset = 0; |
1201 mock_quic_data.AddWrite( | 1201 mock_quic_data.AddWrite( |
1202 ConstructInitialSettingsPacket(1, &request_header_offset)); | 1202 ConstructInitialSettingsPacket(1, &request_header_offset)); |
1203 mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket( | 1203 mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket( |
1204 2, GetNthClientInitiatedStreamId(0), true, true, | 1204 2, GetNthClientInitiatedStreamId(0), true, true, |
1205 GetRequestHeaders("GET", "https", "/"), &request_header_offset)); | 1205 GetRequestHeaders("GET", "https", "/"), &request_header_offset)); |
1206 mock_quic_data.AddRead(ConstructServerResponseHeadersPacket( | 1206 mock_quic_data.AddRead(ConstructServerResponseHeadersPacket( |
1207 1, GetNthClientInitiatedStreamId(0), false, true, | 1207 1, GetNthClientInitiatedStreamId(0), false, true, |
1208 GetResponseHeaders("421"), nullptr)); | 1208 GetResponseHeaders("421"), nullptr)); |
1209 mock_quic_data.AddWrite(ConstructClientAckAndRstPacket( | |
1210 3, GetNthClientInitiatedStreamId(0), QUIC_STREAM_CANCELLED, 1, 1, 1)); | |
1211 mock_quic_data.AddRead(ASYNC, OK); | 1209 mock_quic_data.AddRead(ASYNC, OK); |
1212 mock_quic_data.AddSocketDataToFactory(&socket_factory_); | 1210 mock_quic_data.AddSocketDataToFactory(&socket_factory_); |
1213 | 1211 |
1214 // Second try: The main job uses TCP, and there is no alternate job. Once the | 1212 // Second try: The main job uses TCP, and there is no alternate job. Once the |
1215 // Connect() is unblocked, |http_data| will leave the socket pool, binding to | 1213 // Connect() is unblocked, |http_data| will leave the socket pool, binding to |
1216 // the main job of the second request. It then succeeds over HTTP/1.1. | 1214 // the main job of the second request. It then succeeds over HTTP/1.1. |
1217 // Note that if there was an alternative QUIC Job created for the second try, | 1215 // Note that if there was an alternative QUIC Job created for the second try, |
1218 // that would read these data, and would fail with ERR_QUIC_PROTOCOL_ERROR. | 1216 // that would read these data, and would fail with ERR_QUIC_PROTOCOL_ERROR. |
1219 // Therefore this test ensures that no alternative Job is created on retry. | 1217 // Therefore this test ensures that no alternative Job is created on retry. |
1220 MockWrite writes[] = {MockWrite(ASYNC, 0, "GET / HTTP/1.1\r\n"), | 1218 MockWrite writes[] = {MockWrite(ASYNC, 0, "GET / HTTP/1.1\r\n"), |
(...skipping 3583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4804 | 4802 |
4805 request_.url = GURL("https://mail.example.org/pushed.jpg"); | 4803 request_.url = GURL("https://mail.example.org/pushed.jpg"); |
4806 ChunkedUploadDataStream upload_data(0); | 4804 ChunkedUploadDataStream upload_data(0); |
4807 upload_data.AppendData("1", 1, true); | 4805 upload_data.AppendData("1", 1, true); |
4808 request_.upload_data_stream = &upload_data; | 4806 request_.upload_data_stream = &upload_data; |
4809 SendRequestAndExpectQuicResponse("and hello!"); | 4807 SendRequestAndExpectQuicResponse("and hello!"); |
4810 } | 4808 } |
4811 | 4809 |
4812 } // namespace test | 4810 } // namespace test |
4813 } // namespace net | 4811 } // namespace net |
OLD | NEW |