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 <memory> | 5 #include <memory> |
6 #include <ostream> | 6 #include <ostream> |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2163 | 2163 |
2164 TEST_P(QuicNetworkTransactionTest, FailedZeroRttBrokenAlternateProtocol) { | 2164 TEST_P(QuicNetworkTransactionTest, FailedZeroRttBrokenAlternateProtocol) { |
2165 // Alternate-protocol job | 2165 // Alternate-protocol job |
2166 MockRead quic_reads[] = { | 2166 MockRead quic_reads[] = { |
2167 MockRead(ASYNC, ERR_SOCKET_NOT_CONNECTED), | 2167 MockRead(ASYNC, ERR_SOCKET_NOT_CONNECTED), |
2168 }; | 2168 }; |
2169 StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads), nullptr, | 2169 StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads), nullptr, |
2170 0); | 2170 0); |
2171 socket_factory_.AddSocketDataProvider(&quic_data); | 2171 socket_factory_.AddSocketDataProvider(&quic_data); |
2172 | 2172 |
2173 AddHangingNonAlternateProtocolSocketData(); | |
2174 | |
2175 // Second Alternate-protocol job which will race with the TCP job. | 2173 // Second Alternate-protocol job which will race with the TCP job. |
2176 StaticSocketDataProvider quic_data2(quic_reads, arraysize(quic_reads), | 2174 StaticSocketDataProvider quic_data2(quic_reads, arraysize(quic_reads), |
2177 nullptr, 0); | 2175 nullptr, 0); |
2178 socket_factory_.AddSocketDataProvider(&quic_data2); | 2176 socket_factory_.AddSocketDataProvider(&quic_data2); |
2179 | 2177 |
2180 // Final job that will proceed when the QUIC job fails. | 2178 // Final job that will proceed when the QUIC job fails. |
2181 MockRead http_reads[] = { | 2179 MockRead http_reads[] = { |
2182 MockRead("HTTP/1.1 200 OK\r\n\r\n"), MockRead("hello from http"), | 2180 MockRead("HTTP/1.1 200 OK\r\n\r\n"), MockRead("hello from http"), |
2183 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), | 2181 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), |
2184 MockRead(ASYNC, OK)}; | 2182 MockRead(ASYNC, OK)}; |
2185 | 2183 |
2186 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr, | 2184 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr, |
2187 0); | 2185 0); |
2188 socket_factory_.AddSocketDataProvider(&http_data); | 2186 socket_factory_.AddSocketDataProvider(&http_data); |
2189 socket_factory_.AddSSLSocketDataProvider(&ssl_data_); | 2187 socket_factory_.AddSSLSocketDataProvider(&ssl_data_); |
2190 | 2188 |
| 2189 AddHangingNonAlternateProtocolSocketData(); |
2191 CreateSession(); | 2190 CreateSession(); |
2192 | 2191 |
2193 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); | 2192 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); |
2194 | 2193 |
2195 SendRequestAndExpectHttpResponse("hello from http"); | 2194 SendRequestAndExpectHttpResponse("hello from http"); |
2196 | 2195 |
2197 ExpectBrokenAlternateProtocolMapping(); | 2196 ExpectBrokenAlternateProtocolMapping(); |
2198 | 2197 |
2199 EXPECT_TRUE(quic_data.AllReadDataConsumed()); | 2198 EXPECT_TRUE(quic_data.AllReadDataConsumed()); |
2200 EXPECT_TRUE(quic_data.AllWriteDataConsumed()); | 2199 EXPECT_TRUE(quic_data.AllWriteDataConsumed()); |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2757 AddHangingSocketData(); | 2756 AddHangingSocketData(); |
2758 | 2757 |
2759 SendRequestAndExpectQuicResponse(origin1_); | 2758 SendRequestAndExpectQuicResponse(origin1_); |
2760 SendRequestAndExpectQuicResponse(origin2_); | 2759 SendRequestAndExpectQuicResponse(origin2_); |
2761 | 2760 |
2762 EXPECT_TRUE(AllDataConsumed()); | 2761 EXPECT_TRUE(AllDataConsumed()); |
2763 } | 2762 } |
2764 | 2763 |
2765 } // namespace test | 2764 } // namespace test |
2766 } // namespace net | 2765 } // namespace net |
OLD | NEW |