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 <cmath> | 5 #include <cmath> |
6 #include <memory> | 6 #include <memory> |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 } | 152 } |
153 | 153 |
154 // Verify responses. | 154 // Verify responses. |
155 const HttpResponseInfo* response = trans_->GetResponseInfo(); | 155 const HttpResponseInfo* response = trans_->GetResponseInfo(); |
156 ASSERT_TRUE(response); | 156 ASSERT_TRUE(response); |
157 ASSERT_TRUE(response->headers); | 157 ASSERT_TRUE(response->headers); |
158 EXPECT_EQ(HttpResponseInfo::ConnectionInfoFromNextProto(kProtoHTTP2), | 158 EXPECT_EQ(HttpResponseInfo::ConnectionInfoFromNextProto(kProtoHTTP2), |
159 response->connection_info); | 159 response->connection_info); |
160 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); | 160 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); |
161 EXPECT_TRUE(response->was_fetched_via_spdy); | 161 EXPECT_TRUE(response->was_fetched_via_spdy); |
162 EXPECT_TRUE(response->was_npn_negotiated); | 162 EXPECT_TRUE(response->was_alpn_negotiated); |
163 EXPECT_EQ("127.0.0.1", response->socket_address.host()); | 163 EXPECT_EQ("127.0.0.1", response->socket_address.host()); |
164 EXPECT_EQ(443, response->socket_address.port()); | 164 EXPECT_EQ(443, response->socket_address.port()); |
165 output_.status_line = response->headers->GetStatusLine(); | 165 output_.status_line = response->headers->GetStatusLine(); |
166 output_.response_info = *response; // Make a copy so we can verify. | 166 output_.response_info = *response; // Make a copy so we can verify. |
167 output_.rv = ReadTransaction(trans_.get(), &output_.response_data); | 167 output_.rv = ReadTransaction(trans_.get(), &output_.response_data); |
168 } | 168 } |
169 | 169 |
170 void FinishDefaultTestWithoutVerification() { | 170 void FinishDefaultTestWithoutVerification() { |
171 output_.rv = callback_.WaitForResult(); | 171 output_.rv = callback_.WaitForResult(); |
172 if (output_.rv != OK) | 172 if (output_.rv != OK) |
(...skipping 3779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3952 helper.VerifyDataConsumed(); | 3952 helper.VerifyDataConsumed(); |
3953 EXPECT_TRUE(http_server_properties->RequiresHTTP11(host_port_pair_)); | 3953 EXPECT_TRUE(http_server_properties->RequiresHTTP11(host_port_pair_)); |
3954 | 3954 |
3955 const HttpResponseInfo* response = helper.trans()->GetResponseInfo(); | 3955 const HttpResponseInfo* response = helper.trans()->GetResponseInfo(); |
3956 ASSERT_TRUE(response); | 3956 ASSERT_TRUE(response); |
3957 ASSERT_TRUE(response->headers); | 3957 ASSERT_TRUE(response->headers); |
3958 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 3958 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
3959 EXPECT_FALSE(response->was_fetched_via_spdy); | 3959 EXPECT_FALSE(response->was_fetched_via_spdy); |
3960 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1_1, | 3960 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1_1, |
3961 response->connection_info); | 3961 response->connection_info); |
3962 EXPECT_TRUE(response->was_npn_negotiated); | 3962 EXPECT_TRUE(response->was_alpn_negotiated); |
3963 EXPECT_TRUE(request.url.SchemeIs("https")); | 3963 EXPECT_TRUE(request.url.SchemeIs("https")); |
3964 EXPECT_EQ("127.0.0.1", response->socket_address.host()); | 3964 EXPECT_EQ("127.0.0.1", response->socket_address.host()); |
3965 EXPECT_EQ(443, response->socket_address.port()); | 3965 EXPECT_EQ(443, response->socket_address.port()); |
3966 std::string response_data; | 3966 std::string response_data; |
3967 ASSERT_THAT(ReadTransaction(helper.trans(), &response_data), IsOk()); | 3967 ASSERT_THAT(ReadTransaction(helper.trans(), &response_data), IsOk()); |
3968 EXPECT_EQ("hello", response_data); | 3968 EXPECT_EQ("hello", response_data); |
3969 } | 3969 } |
3970 | 3970 |
3971 // Retry with HTTP/1.1 to the proxy when receiving HTTP_1_1_REQUIRED from the | 3971 // Retry with HTTP/1.1 to the proxy when receiving HTTP_1_1_REQUIRED from the |
3972 // proxy. Note that no actual protocol negotiation happens, instead this test | 3972 // proxy. Note that no actual protocol negotiation happens, instead this test |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4047 helper.VerifyDataConsumed(); | 4047 helper.VerifyDataConsumed(); |
4048 EXPECT_TRUE(http_server_properties->RequiresHTTP11(proxy_host_port_pair)); | 4048 EXPECT_TRUE(http_server_properties->RequiresHTTP11(proxy_host_port_pair)); |
4049 | 4049 |
4050 const HttpResponseInfo* response = helper.trans()->GetResponseInfo(); | 4050 const HttpResponseInfo* response = helper.trans()->GetResponseInfo(); |
4051 ASSERT_TRUE(response); | 4051 ASSERT_TRUE(response); |
4052 ASSERT_TRUE(response->headers); | 4052 ASSERT_TRUE(response->headers); |
4053 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 4053 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
4054 EXPECT_FALSE(response->was_fetched_via_spdy); | 4054 EXPECT_FALSE(response->was_fetched_via_spdy); |
4055 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1_1, | 4055 EXPECT_EQ(HttpResponseInfo::CONNECTION_INFO_HTTP1_1, |
4056 response->connection_info); | 4056 response->connection_info); |
4057 EXPECT_FALSE(response->was_npn_negotiated); | 4057 EXPECT_FALSE(response->was_alpn_negotiated); |
4058 EXPECT_TRUE(request.url.SchemeIs("https")); | 4058 EXPECT_TRUE(request.url.SchemeIs("https")); |
4059 EXPECT_EQ("127.0.0.1", response->socket_address.host()); | 4059 EXPECT_EQ("127.0.0.1", response->socket_address.host()); |
4060 EXPECT_EQ(70, response->socket_address.port()); | 4060 EXPECT_EQ(70, response->socket_address.port()); |
4061 std::string response_data; | 4061 std::string response_data; |
4062 ASSERT_THAT(ReadTransaction(helper.trans(), &response_data), IsOk()); | 4062 ASSERT_THAT(ReadTransaction(helper.trans(), &response_data), IsOk()); |
4063 EXPECT_EQ("hello", response_data); | 4063 EXPECT_EQ("hello", response_data); |
4064 } | 4064 } |
4065 | 4065 |
4066 // Test to make sure we can correctly connect through a proxy. | 4066 // Test to make sure we can correctly connect through a proxy. |
4067 TEST_F(SpdyNetworkTransactionTest, ProxyConnect) { | 4067 TEST_F(SpdyNetworkTransactionTest, ProxyConnect) { |
(...skipping 2282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6350 TEST_F(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6350 TEST_F(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
6351 std::unique_ptr<SSLSocketDataProvider> ssl_provider( | 6351 std::unique_ptr<SSLSocketDataProvider> ssl_provider( |
6352 new SSLSocketDataProvider(ASYNC, OK)); | 6352 new SSLSocketDataProvider(ASYNC, OK)); |
6353 // Set to TLS_RSA_WITH_NULL_MD5 | 6353 // Set to TLS_RSA_WITH_NULL_MD5 |
6354 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6354 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
6355 | 6355 |
6356 RunTLSUsageCheckTest(std::move(ssl_provider)); | 6356 RunTLSUsageCheckTest(std::move(ssl_provider)); |
6357 } | 6357 } |
6358 | 6358 |
6359 } // namespace net | 6359 } // namespace net |
OLD | NEW |