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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 os << " }"; | 108 os << " }"; |
109 return os; | 109 return os; |
110 } | 110 } |
111 | 111 |
112 QuicVersion version; | 112 QuicVersion version; |
113 DestinationType destination_type; | 113 DestinationType destination_type; |
114 }; | 114 }; |
115 | 115 |
116 std::vector<PoolingTestParams> GetPoolingTestParams() { | 116 std::vector<PoolingTestParams> GetPoolingTestParams() { |
117 std::vector<PoolingTestParams> params; | 117 std::vector<PoolingTestParams> params; |
118 QuicVersionVector all_supported_versions = QuicSupportedVersions(); | 118 QuicVersionVector all_supported_versions = AllSupportedVersions(); |
119 for (const QuicVersion version : all_supported_versions) { | 119 for (const QuicVersion version : all_supported_versions) { |
120 params.push_back(PoolingTestParams{version, SAME_AS_FIRST}); | 120 params.push_back(PoolingTestParams{version, SAME_AS_FIRST}); |
121 params.push_back(PoolingTestParams{version, SAME_AS_SECOND}); | 121 params.push_back(PoolingTestParams{version, SAME_AS_SECOND}); |
122 params.push_back(PoolingTestParams{version, DIFFERENT}); | 122 params.push_back(PoolingTestParams{version, DIFFERENT}); |
123 } | 123 } |
124 return params; | 124 return params; |
125 } | 125 } |
126 | 126 |
127 } // namespace | 127 } // namespace |
128 | 128 |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 RunTransaction(trans); | 673 RunTransaction(trans); |
674 CheckWasQuicResponse(trans); | 674 CheckWasQuicResponse(trans); |
675 CheckResponsePort(trans, port); | 675 CheckResponsePort(trans, port); |
676 CheckResponseData(trans, expected); | 676 CheckResponseData(trans, expected); |
677 EXPECT_EQ(used_proxy, headers_handler.was_proxied()); | 677 EXPECT_EQ(used_proxy, headers_handler.was_proxied()); |
678 } | 678 } |
679 }; | 679 }; |
680 | 680 |
681 INSTANTIATE_TEST_CASE_P(Version, | 681 INSTANTIATE_TEST_CASE_P(Version, |
682 QuicNetworkTransactionTest, | 682 QuicNetworkTransactionTest, |
683 ::testing::ValuesIn(QuicSupportedVersions())); | 683 ::testing::ValuesIn(AllSupportedVersions())); |
684 | 684 |
685 TEST_P(QuicNetworkTransactionTest, ForceQuic) { | 685 TEST_P(QuicNetworkTransactionTest, ForceQuic) { |
686 params_.origins_to_force_quic_on.insert( | 686 params_.origins_to_force_quic_on.insert( |
687 HostPortPair::FromString("mail.example.org:443")); | 687 HostPortPair::FromString("mail.example.org:443")); |
688 | 688 |
689 MockQuicData mock_quic_data; | 689 MockQuicData mock_quic_data; |
690 mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket( | 690 mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket( |
691 1, kClientDataStreamId1, true, true, | 691 1, kClientDataStreamId1, true, true, |
692 GetRequestHeaders("GET", "https", "/"))); | 692 GetRequestHeaders("GET", "https", "/"))); |
693 mock_quic_data.AddRead(ConstructServerResponseHeadersPacket( | 693 mock_quic_data.AddRead(ConstructServerResponseHeadersPacket( |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 AlternativeServiceVector alternative_service_vector = | 1067 AlternativeServiceVector alternative_service_vector = |
1068 http_server_properties->GetAlternativeServices(https_server); | 1068 http_server_properties->GetAlternativeServices(https_server); |
1069 EXPECT_EQ(2u, alternative_service_vector.size()); | 1069 EXPECT_EQ(2u, alternative_service_vector.size()); |
1070 | 1070 |
1071 // Send http request to the same origin but with diffrent scheme, should not | 1071 // Send http request to the same origin but with diffrent scheme, should not |
1072 // use QUIC. | 1072 // use QUIC. |
1073 request_.url = GURL("http://mail.example.org:443"); | 1073 request_.url = GURL("http://mail.example.org:443"); |
1074 SendRequestAndExpectHttpResponse("hello world"); | 1074 SendRequestAndExpectHttpResponse("hello world"); |
1075 } | 1075 } |
1076 | 1076 |
1077 TEST_P(QuicNetworkTransactionTest, UseAlternativeServiceQuicSupportedVersion) { | 1077 TEST_P(QuicNetworkTransactionTest, UseAlternativeServiceAllSupportedVersion) { |
1078 std::string altsvc_header = base::StringPrintf( | 1078 std::string altsvc_header = base::StringPrintf( |
1079 "Alt-Svc: quic=\":443\"; v=\"%u\"\r\n\r\n", GetParam()); | 1079 "Alt-Svc: quic=\":443\"; v=\"%u\"\r\n\r\n", GetParam()); |
1080 MockRead http_reads[] = { | 1080 MockRead http_reads[] = { |
1081 MockRead("HTTP/1.1 200 OK\r\n"), MockRead(altsvc_header.c_str()), | 1081 MockRead("HTTP/1.1 200 OK\r\n"), MockRead(altsvc_header.c_str()), |
1082 MockRead("hello world"), | 1082 MockRead("hello world"), |
1083 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), | 1083 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), |
1084 MockRead(ASYNC, OK)}; | 1084 MockRead(ASYNC, OK)}; |
1085 | 1085 |
1086 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr, | 1086 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr, |
1087 0); | 1087 0); |
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2790 AddHangingSocketData(); | 2790 AddHangingSocketData(); |
2791 | 2791 |
2792 SendRequestAndExpectQuicResponse(origin1_); | 2792 SendRequestAndExpectQuicResponse(origin1_); |
2793 SendRequestAndExpectQuicResponse(origin2_); | 2793 SendRequestAndExpectQuicResponse(origin2_); |
2794 | 2794 |
2795 EXPECT_TRUE(AllDataConsumed()); | 2795 EXPECT_TRUE(AllDataConsumed()); |
2796 } | 2796 } |
2797 | 2797 |
2798 } // namespace test | 2798 } // namespace test |
2799 } // namespace net | 2799 } // namespace net |
OLD | NEW |