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