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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); | 853 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); |
854 | 854 |
855 SendRequestAndExpectHttpResponse("hello from http"); | 855 SendRequestAndExpectHttpResponse("hello from http"); |
856 | 856 |
857 ExpectBrokenAlternateProtocolMapping(); | 857 ExpectBrokenAlternateProtocolMapping(); |
858 | 858 |
859 EXPECT_TRUE(quic_data.at_read_eof()); | 859 EXPECT_TRUE(quic_data.at_read_eof()); |
860 EXPECT_TRUE(quic_data.at_write_eof()); | 860 EXPECT_TRUE(quic_data.at_write_eof()); |
861 } | 861 } |
862 | 862 |
| 863 TEST_P(QuicNetworkTransactionTest, HangingZeroRttFallback) { |
| 864 // Alternate-protocol job |
| 865 MockRead quic_reads[] = { |
| 866 MockRead(ASYNC, ERR_IO_PENDING), |
| 867 }; |
| 868 StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads), |
| 869 NULL, 0); |
| 870 socket_factory_.AddSocketDataProvider(&quic_data); |
| 871 |
| 872 // Main job that will proceed when the QUIC job fails. |
| 873 MockRead http_reads[] = { |
| 874 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 875 MockRead("hello from http"), |
| 876 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), |
| 877 MockRead(ASYNC, OK) |
| 878 }; |
| 879 |
| 880 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), |
| 881 NULL, 0); |
| 882 socket_factory_.AddSocketDataProvider(&http_data); |
| 883 |
| 884 CreateSessionWithNextProtos(); |
| 885 |
| 886 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); |
| 887 |
| 888 SendRequestAndExpectHttpResponse("hello from http"); |
| 889 } |
| 890 |
863 TEST_P(QuicNetworkTransactionTest, BrokenAlternateProtocolOnConnectFailure) { | 891 TEST_P(QuicNetworkTransactionTest, BrokenAlternateProtocolOnConnectFailure) { |
864 // Alternate-protocol job will fail before creating a QUIC session. | 892 // Alternate-protocol job will fail before creating a QUIC session. |
865 StaticSocketDataProvider quic_data(NULL, 0, NULL, 0); | 893 StaticSocketDataProvider quic_data(NULL, 0, NULL, 0); |
866 quic_data.set_connect_data(MockConnect(SYNCHRONOUS, | 894 quic_data.set_connect_data(MockConnect(SYNCHRONOUS, |
867 ERR_INTERNET_DISCONNECTED)); | 895 ERR_INTERNET_DISCONNECTED)); |
868 socket_factory_.AddSocketDataProvider(&quic_data); | 896 socket_factory_.AddSocketDataProvider(&quic_data); |
869 | 897 |
870 // Main job which will succeed even though the alternate job fails. | 898 // Main job which will succeed even though the alternate job fails. |
871 MockRead http_reads[] = { | 899 MockRead http_reads[] = { |
872 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 900 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 NULL, | 950 NULL, |
923 net_log_.bound()); | 951 net_log_.bound()); |
924 | 952 |
925 CreateSessionWithNextProtos(); | 953 CreateSessionWithNextProtos(); |
926 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); | 954 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); |
927 SendRequestAndExpectHttpResponse("hello world"); | 955 SendRequestAndExpectHttpResponse("hello world"); |
928 } | 956 } |
929 | 957 |
930 } // namespace test | 958 } // namespace test |
931 } // namespace net | 959 } // namespace net |
OLD | NEW |