| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 // The HTTP transaction will complete. | 816 // The HTTP transaction will complete. |
| 817 DeterministicSocketData http_data2(http_reads, arraysize(http_reads), | 817 DeterministicSocketData http_data2(http_reads, arraysize(http_reads), |
| 818 http_writes, arraysize(http_writes)); | 818 http_writes, arraysize(http_writes)); |
| 819 socket_factory.AddSocketDataProvider(&http_data2); | 819 socket_factory.AddSocketDataProvider(&http_data2); |
| 820 | 820 |
| 821 CreateSessionWithFactory(&socket_factory, true); | 821 CreateSessionWithFactory(&socket_factory, true); |
| 822 | 822 |
| 823 // Run the first request. | 823 // Run the first request. |
| 824 http_data.StopAfter(arraysize(http_reads) + arraysize(http_writes)); | 824 http_data.StopAfter(arraysize(http_reads) + arraysize(http_writes)); |
| 825 SendRequestAndExpectHttpResponse("hello world"); | 825 SendRequestAndExpectHttpResponse("hello world"); |
| 826 ASSERT_TRUE(http_data.at_read_eof()); | 826 ASSERT_TRUE(http_data.AllReadDataConsumed()); |
| 827 ASSERT_TRUE(http_data.at_write_eof()); | 827 ASSERT_TRUE(http_data.AllWriteDataConsumed()); |
| 828 | 828 |
| 829 // Now run the second request in which the QUIC socket hangs, | 829 // Now run the second request in which the QUIC socket hangs, |
| 830 // and verify the the transaction continues over HTTP. | 830 // and verify the the transaction continues over HTTP. |
| 831 http_data2.StopAfter(arraysize(http_reads) + arraysize(http_writes)); | 831 http_data2.StopAfter(arraysize(http_reads) + arraysize(http_writes)); |
| 832 SendRequestAndExpectHttpResponse("hello world"); | 832 SendRequestAndExpectHttpResponse("hello world"); |
| 833 | 833 |
| 834 ASSERT_TRUE(http_data2.at_read_eof()); | 834 ASSERT_TRUE(http_data2.AllReadDataConsumed()); |
| 835 ASSERT_TRUE(http_data2.at_write_eof()); | 835 ASSERT_TRUE(http_data2.AllWriteDataConsumed()); |
| 836 ASSERT_TRUE(!quic_data.at_read_eof()); | 836 ASSERT_TRUE(!quic_data.AllReadDataConsumed()); |
| 837 ASSERT_TRUE(!quic_data.at_write_eof()); | 837 ASSERT_TRUE(!quic_data.AllWriteDataConsumed()); |
| 838 } | 838 } |
| 839 | 839 |
| 840 TEST_P(QuicNetworkTransactionTest, ZeroRTTWithHttpRace) { | 840 TEST_P(QuicNetworkTransactionTest, ZeroRTTWithHttpRace) { |
| 841 MockQuicData mock_quic_data; | 841 MockQuicData mock_quic_data; |
| 842 mock_quic_data.AddWrite( | 842 mock_quic_data.AddWrite( |
| 843 ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true, | 843 ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true, |
| 844 GetRequestHeaders("GET", "http", "/"))); | 844 GetRequestHeaders("GET", "http", "/"))); |
| 845 mock_quic_data.AddRead( | 845 mock_quic_data.AddRead( |
| 846 ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false, | 846 ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false, |
| 847 GetResponseHeaders("200 OK"))); | 847 GetResponseHeaders("200 OK"))); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 socket_factory_.AddSocketDataProvider(&http_data); | 1097 socket_factory_.AddSocketDataProvider(&http_data); |
| 1098 | 1098 |
| 1099 CreateSessionWithNextProtos(); | 1099 CreateSessionWithNextProtos(); |
| 1100 | 1100 |
| 1101 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); | 1101 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); |
| 1102 | 1102 |
| 1103 SendRequestAndExpectHttpResponse("hello from http"); | 1103 SendRequestAndExpectHttpResponse("hello from http"); |
| 1104 | 1104 |
| 1105 ExpectBrokenAlternateProtocolMapping(); | 1105 ExpectBrokenAlternateProtocolMapping(); |
| 1106 | 1106 |
| 1107 EXPECT_TRUE(quic_data.at_read_eof()); | 1107 EXPECT_TRUE(quic_data.AllReadDataConsumed()); |
| 1108 EXPECT_TRUE(quic_data.at_write_eof()); | 1108 EXPECT_TRUE(quic_data.AllWriteDataConsumed()); |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 TEST_P(QuicNetworkTransactionTest, DISABLED_HangingZeroRttFallback) { | 1111 TEST_P(QuicNetworkTransactionTest, DISABLED_HangingZeroRttFallback) { |
| 1112 // Alternate-protocol job | 1112 // Alternate-protocol job |
| 1113 MockRead quic_reads[] = { | 1113 MockRead quic_reads[] = { |
| 1114 MockRead(ASYNC, ERR_IO_PENDING), | 1114 MockRead(ASYNC, ERR_IO_PENDING), |
| 1115 }; | 1115 }; |
| 1116 StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads), | 1116 StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads), |
| 1117 nullptr, 0); | 1117 nullptr, 0); |
| 1118 socket_factory_.AddSocketDataProvider(&quic_data); | 1118 socket_factory_.AddSocketDataProvider(&quic_data); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 | 1258 |
| 1259 request_.url = GURL("https://www.example.org:443"); | 1259 request_.url = GURL("https://www.example.org:443"); |
| 1260 AddHangingNonAlternateProtocolSocketData(); | 1260 AddHangingNonAlternateProtocolSocketData(); |
| 1261 CreateSessionWithNextProtos(); | 1261 CreateSessionWithNextProtos(); |
| 1262 AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE); | 1262 AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE); |
| 1263 SendRequestAndExpectQuicResponse("hello!"); | 1263 SendRequestAndExpectQuicResponse("hello!"); |
| 1264 } | 1264 } |
| 1265 | 1265 |
| 1266 } // namespace test | 1266 } // namespace test |
| 1267 } // namespace net | 1267 } // namespace net |
| OLD | NEW |