| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "net/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 9141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9152 true, | 9152 true, |
| 9153 }, | 9153 }, |
| 9154 { | 9154 { |
| 9155 "", // unused | 9155 "", // unused |
| 9156 "http://host.with.alternate/direct", | 9156 "http://host.with.alternate/direct", |
| 9157 "ssl/host.with.alternate:443", | 9157 "ssl/host.with.alternate:443", |
| 9158 true, | 9158 true, |
| 9159 }, | 9159 }, |
| 9160 }; | 9160 }; |
| 9161 | 9161 |
| 9162 session_deps_.enable_alternative_service_with_different_host = false; | |
| 9163 | |
| 9164 for (size_t i = 0; i < arraysize(tests); ++i) { | 9162 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 9165 session_deps_.proxy_service = | 9163 session_deps_.proxy_service = |
| 9166 ProxyService::CreateFixed(tests[i].proxy_server); | 9164 ProxyService::CreateFixed(tests[i].proxy_server); |
| 9167 std::unique_ptr<HttpNetworkSession> session( | 9165 std::unique_ptr<HttpNetworkSession> session( |
| 9168 SetupSessionForGroupNameTests(GetProtocol(), &session_deps_)); | 9166 SetupSessionForGroupNameTests(GetProtocol(), &session_deps_)); |
| 9169 | 9167 |
| 9170 HttpNetworkSessionPeer peer(session.get()); | 9168 HttpNetworkSessionPeer peer(session.get()); |
| 9171 CaptureGroupNameTransportSocketPool* transport_conn_pool = | 9169 CaptureGroupNameTransportSocketPool* transport_conn_pool = |
| 9172 new CaptureGroupNameTransportSocketPool(NULL, NULL); | 9170 new CaptureGroupNameTransportSocketPool(NULL, NULL); |
| 9173 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 9171 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9214 }, | 9212 }, |
| 9215 | 9213 |
| 9216 { | 9214 { |
| 9217 "http_proxy", | 9215 "http_proxy", |
| 9218 "ftp://ftp.google.com/http_proxy_normal", | 9216 "ftp://ftp.google.com/http_proxy_normal", |
| 9219 "ftp/ftp.google.com:21", | 9217 "ftp/ftp.google.com:21", |
| 9220 false, | 9218 false, |
| 9221 }, | 9219 }, |
| 9222 }; | 9220 }; |
| 9223 | 9221 |
| 9224 session_deps_.enable_alternative_service_with_different_host = false; | |
| 9225 | |
| 9226 for (size_t i = 0; i < arraysize(tests); ++i) { | 9222 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 9227 session_deps_.proxy_service = | 9223 session_deps_.proxy_service = |
| 9228 ProxyService::CreateFixed(tests[i].proxy_server); | 9224 ProxyService::CreateFixed(tests[i].proxy_server); |
| 9229 std::unique_ptr<HttpNetworkSession> session( | 9225 std::unique_ptr<HttpNetworkSession> session( |
| 9230 SetupSessionForGroupNameTests(GetProtocol(), &session_deps_)); | 9226 SetupSessionForGroupNameTests(GetProtocol(), &session_deps_)); |
| 9231 | 9227 |
| 9232 HttpNetworkSessionPeer peer(session.get()); | 9228 HttpNetworkSessionPeer peer(session.get()); |
| 9233 | 9229 |
| 9234 HostPortPair proxy_host("http_proxy", 80); | 9230 HostPortPair proxy_host("http_proxy", 80); |
| 9235 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = | 9231 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9284 }, | 9280 }, |
| 9285 | 9281 |
| 9286 { | 9282 { |
| 9287 "socks4://socks_proxy:1080", | 9283 "socks4://socks_proxy:1080", |
| 9288 "http://host.with.alternate/direct", | 9284 "http://host.with.alternate/direct", |
| 9289 "socks4/ssl/host.with.alternate:443", | 9285 "socks4/ssl/host.with.alternate:443", |
| 9290 true, | 9286 true, |
| 9291 }, | 9287 }, |
| 9292 }; | 9288 }; |
| 9293 | 9289 |
| 9294 session_deps_.enable_alternative_service_with_different_host = false; | |
| 9295 | |
| 9296 for (size_t i = 0; i < arraysize(tests); ++i) { | 9290 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 9297 session_deps_.proxy_service = | 9291 session_deps_.proxy_service = |
| 9298 ProxyService::CreateFixed(tests[i].proxy_server); | 9292 ProxyService::CreateFixed(tests[i].proxy_server); |
| 9299 std::unique_ptr<HttpNetworkSession> session( | 9293 std::unique_ptr<HttpNetworkSession> session( |
| 9300 SetupSessionForGroupNameTests(GetProtocol(), &session_deps_)); | 9294 SetupSessionForGroupNameTests(GetProtocol(), &session_deps_)); |
| 9301 | 9295 |
| 9302 HttpNetworkSessionPeer peer(session.get()); | 9296 HttpNetworkSessionPeer peer(session.get()); |
| 9303 | 9297 |
| 9304 HostPortPair proxy_host("socks_proxy", 1080); | 9298 HostPortPair proxy_host("socks_proxy", 1080); |
| 9305 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = | 9299 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9945 AuthCredentials(kFirst, kBar), callback4.callback()); | 9939 AuthCredentials(kFirst, kBar), callback4.callback()); |
| 9946 EXPECT_EQ(ERR_IO_PENDING, rv); | 9940 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9947 rv = callback4.WaitForResult(); | 9941 rv = callback4.WaitForResult(); |
| 9948 EXPECT_EQ(OK, rv); | 9942 EXPECT_EQ(OK, rv); |
| 9949 response = trans->GetResponseInfo(); | 9943 response = trans->GetResponseInfo(); |
| 9950 ASSERT_TRUE(response); | 9944 ASSERT_TRUE(response); |
| 9951 EXPECT_FALSE(response->auth_challenge); | 9945 EXPECT_FALSE(response->auth_challenge); |
| 9952 } | 9946 } |
| 9953 | 9947 |
| 9954 TEST_P(HttpNetworkTransactionTest, HonorAlternativeServiceHeader) { | 9948 TEST_P(HttpNetworkTransactionTest, HonorAlternativeServiceHeader) { |
| 9955 session_deps_.enable_alternative_service_with_different_host = false; | |
| 9956 | |
| 9957 std::string alternative_service_http_header = | 9949 std::string alternative_service_http_header = |
| 9958 GetAlternativeServiceHttpHeader(); | 9950 GetAlternativeServiceHttpHeader(); |
| 9959 | 9951 |
| 9960 MockRead data_reads[] = { | 9952 MockRead data_reads[] = { |
| 9961 MockRead("HTTP/1.1 200 OK\r\n"), | 9953 MockRead("HTTP/1.1 200 OK\r\n"), |
| 9962 MockRead(alternative_service_http_header.c_str()), | 9954 MockRead(alternative_service_http_header.c_str()), |
| 9963 MockRead("\r\n"), | 9955 MockRead("\r\n"), |
| 9964 MockRead("hello world"), | 9956 MockRead("hello world"), |
| 9965 MockRead(SYNCHRONOUS, OK), | 9957 MockRead(SYNCHRONOUS, OK), |
| 9966 }; | 9958 }; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10067 alternative_service_vector = | 10059 alternative_service_vector = |
| 10068 http_server_properties->GetAlternativeServices(test_server); | 10060 http_server_properties->GetAlternativeServices(test_server); |
| 10069 EXPECT_TRUE(alternative_service_vector.empty()); | 10061 EXPECT_TRUE(alternative_service_vector.empty()); |
| 10070 } | 10062 } |
| 10071 | 10063 |
| 10072 // HTTP/2 Alternative Services should be disabled if alternative service | 10064 // HTTP/2 Alternative Services should be disabled if alternative service |
| 10073 // hostname is different from that of origin. | 10065 // hostname is different from that of origin. |
| 10074 // TODO(bnc): Remove when https://crbug.com/615413 is fixed. | 10066 // TODO(bnc): Remove when https://crbug.com/615413 is fixed. |
| 10075 TEST_P(HttpNetworkTransactionTest, | 10067 TEST_P(HttpNetworkTransactionTest, |
| 10076 DisableHTTP2AlternativeServicesWithDifferentHost) { | 10068 DisableHTTP2AlternativeServicesWithDifferentHost) { |
| 10077 session_deps_.enable_alternative_service_with_different_host = true; | |
| 10078 | |
| 10079 HttpRequestInfo request; | 10069 HttpRequestInfo request; |
| 10080 request.method = "GET"; | 10070 request.method = "GET"; |
| 10081 request.url = GURL("http://www.example.org/"); | 10071 request.url = GURL("http://www.example.org/"); |
| 10082 request.load_flags = 0; | 10072 request.load_flags = 0; |
| 10083 | 10073 |
| 10084 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); | 10074 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
| 10085 StaticSocketDataProvider first_data; | 10075 StaticSocketDataProvider first_data; |
| 10086 first_data.set_connect_data(mock_connect); | 10076 first_data.set_connect_data(mock_connect); |
| 10087 session_deps_.socket_factory->AddSocketDataProvider(&first_data); | 10077 session_deps_.socket_factory->AddSocketDataProvider(&first_data); |
| 10088 | 10078 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10151 std::unique_ptr<HttpTransaction> trans( | 10141 std::unique_ptr<HttpTransaction> trans( |
| 10152 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 10142 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 10153 TestCompletionCallback callback; | 10143 TestCompletionCallback callback; |
| 10154 | 10144 |
| 10155 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 10145 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 10156 // Alternative service is not used, request fails. | 10146 // Alternative service is not used, request fails. |
| 10157 EXPECT_EQ(ERR_CONNECTION_REFUSED, callback.GetResult(rv)); | 10147 EXPECT_EQ(ERR_CONNECTION_REFUSED, callback.GetResult(rv)); |
| 10158 } | 10148 } |
| 10159 | 10149 |
| 10160 TEST_P(HttpNetworkTransactionTest, ClearAlternativeServices) { | 10150 TEST_P(HttpNetworkTransactionTest, ClearAlternativeServices) { |
| 10161 session_deps_.enable_alternative_service_with_different_host = false; | |
| 10162 | |
| 10163 // Set an alternative service for origin. | 10151 // Set an alternative service for origin. |
| 10164 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10152 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10165 HttpServerProperties* http_server_properties = | 10153 HttpServerProperties* http_server_properties = |
| 10166 session->http_server_properties(); | 10154 session->http_server_properties(); |
| 10167 url::SchemeHostPort test_server("http", "www.example.org", 80); | 10155 url::SchemeHostPort test_server("http", "www.example.org", 80); |
| 10168 AlternativeService alternative_service(QUIC, "", 80); | 10156 AlternativeService alternative_service(QUIC, "", 80); |
| 10169 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 10157 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 10170 http_server_properties->SetAlternativeService( | 10158 http_server_properties->SetAlternativeService( |
| 10171 test_server, alternative_service, expiration); | 10159 test_server, alternative_service, expiration); |
| 10172 AlternativeServiceVector alternative_service_vector = | 10160 AlternativeServiceVector alternative_service_vector = |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10207 std::string response_data; | 10195 std::string response_data; |
| 10208 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 10196 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 10209 EXPECT_EQ("hello world", response_data); | 10197 EXPECT_EQ("hello world", response_data); |
| 10210 | 10198 |
| 10211 alternative_service_vector = | 10199 alternative_service_vector = |
| 10212 http_server_properties->GetAlternativeServices(test_server); | 10200 http_server_properties->GetAlternativeServices(test_server); |
| 10213 EXPECT_TRUE(alternative_service_vector.empty()); | 10201 EXPECT_TRUE(alternative_service_vector.empty()); |
| 10214 } | 10202 } |
| 10215 | 10203 |
| 10216 TEST_P(HttpNetworkTransactionTest, HonorMultipleAlternativeServiceHeader) { | 10204 TEST_P(HttpNetworkTransactionTest, HonorMultipleAlternativeServiceHeader) { |
| 10217 session_deps_.enable_alternative_service_with_different_host = false; | |
| 10218 | |
| 10219 MockRead data_reads[] = { | 10205 MockRead data_reads[] = { |
| 10220 MockRead("HTTP/1.1 200 OK\r\n"), | 10206 MockRead("HTTP/1.1 200 OK\r\n"), |
| 10221 MockRead("Alt-Svc: "), | 10207 MockRead("Alt-Svc: "), |
| 10222 MockRead(GetAlternateProtocolFromParam()), | 10208 MockRead(GetAlternateProtocolFromParam()), |
| 10223 MockRead("=\"www.example.com:443\";p=\"1.0\","), | 10209 MockRead("=\"www.example.com:443\";p=\"1.0\","), |
| 10224 MockRead(GetAlternateProtocolFromParam()), | 10210 MockRead(GetAlternateProtocolFromParam()), |
| 10225 MockRead("=\":1234\"\r\n\r\n"), | 10211 MockRead("=\":1234\"\r\n\r\n"), |
| 10226 MockRead("hello world"), | 10212 MockRead("hello world"), |
| 10227 MockRead(SYNCHRONOUS, OK), | 10213 MockRead(SYNCHRONOUS, OK), |
| 10228 }; | 10214 }; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10271 EXPECT_EQ(AlternateProtocolFromNextProto(GetProtocol()), | 10257 EXPECT_EQ(AlternateProtocolFromNextProto(GetProtocol()), |
| 10272 alternative_service_vector[0].protocol); | 10258 alternative_service_vector[0].protocol); |
| 10273 EXPECT_EQ("www.example.com", alternative_service_vector[0].host); | 10259 EXPECT_EQ("www.example.com", alternative_service_vector[0].host); |
| 10274 EXPECT_EQ(443, alternative_service_vector[0].port); | 10260 EXPECT_EQ(443, alternative_service_vector[0].port); |
| 10275 EXPECT_EQ(AlternateProtocolFromNextProto(GetProtocol()), | 10261 EXPECT_EQ(AlternateProtocolFromNextProto(GetProtocol()), |
| 10276 alternative_service_vector[1].protocol); | 10262 alternative_service_vector[1].protocol); |
| 10277 EXPECT_EQ("www.example.org", alternative_service_vector[1].host); | 10263 EXPECT_EQ("www.example.org", alternative_service_vector[1].host); |
| 10278 EXPECT_EQ(1234, alternative_service_vector[1].port); | 10264 EXPECT_EQ(1234, alternative_service_vector[1].port); |
| 10279 } | 10265 } |
| 10280 | 10266 |
| 10281 // When |enable_alternative_service_with_different_host| is false, do not | 10267 // When |enable_http2_alternative_service_with_different_host| is false, do not |
| 10282 // observe alternative service entries that point to a different host. | 10268 // observe alternative service entries that point to a different host. |
| 10283 TEST_P(HttpNetworkTransactionTest, DisableAlternativeServiceToDifferentHost) { | 10269 TEST_P(HttpNetworkTransactionTest, DisableAlternativeServiceToDifferentHost) { |
| 10284 session_deps_.enable_alternative_service_with_different_host = false; | 10270 session_deps_.enable_http2_alternative_service_with_different_host = false; |
| 10285 | 10271 |
| 10286 HttpRequestInfo request; | 10272 HttpRequestInfo request; |
| 10287 request.method = "GET"; | 10273 request.method = "GET"; |
| 10288 request.url = GURL("http://www.example.org/"); | 10274 request.url = GURL("http://www.example.org/"); |
| 10289 request.load_flags = 0; | 10275 request.load_flags = 0; |
| 10290 | 10276 |
| 10291 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); | 10277 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
| 10292 StaticSocketDataProvider first_data; | 10278 StaticSocketDataProvider first_data; |
| 10293 first_data.set_connect_data(mock_connect); | 10279 first_data.set_connect_data(mock_connect); |
| 10294 session_deps_.socket_factory->AddSocketDataProvider(&first_data); | 10280 session_deps_.socket_factory->AddSocketDataProvider(&first_data); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10349 }; | 10335 }; |
| 10350 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), | 10336 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), |
| 10351 http_writes, arraysize(http_writes)); | 10337 http_writes, arraysize(http_writes)); |
| 10352 session_deps_.socket_factory->AddSocketDataProvider(&http_data); | 10338 session_deps_.socket_factory->AddSocketDataProvider(&http_data); |
| 10353 | 10339 |
| 10354 StaticSocketDataProvider data_refused; | 10340 StaticSocketDataProvider data_refused; |
| 10355 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); | 10341 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); |
| 10356 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); | 10342 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); |
| 10357 | 10343 |
| 10358 // Set up a QUIC alternative service for server. | 10344 // Set up a QUIC alternative service for server. |
| 10359 session_deps_.enable_alternative_service_with_different_host = false; | |
| 10360 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10345 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10361 HttpServerProperties* http_server_properties = | 10346 HttpServerProperties* http_server_properties = |
| 10362 session->http_server_properties(); | 10347 session->http_server_properties(); |
| 10363 AlternativeService alternative_service(QUIC, alternative); | 10348 AlternativeService alternative_service(QUIC, alternative); |
| 10364 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 10349 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 10365 http_server_properties->SetAlternativeService(server, alternative_service, | 10350 http_server_properties->SetAlternativeService(server, alternative_service, |
| 10366 expiration); | 10351 expiration); |
| 10367 // Mark the QUIC alternative service as broken. | 10352 // Mark the QUIC alternative service as broken. |
| 10368 http_server_properties->MarkAlternativeServiceBroken(alternative_service); | 10353 http_server_properties->MarkAlternativeServiceBroken(alternative_service); |
| 10369 | 10354 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10409 "first HTTP/1.1 response from alternative1"), | 10394 "first HTTP/1.1 response from alternative1"), |
| 10410 }; | 10395 }; |
| 10411 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), | 10396 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), |
| 10412 http_writes, arraysize(http_writes)); | 10397 http_writes, arraysize(http_writes)); |
| 10413 session_deps_.socket_factory->AddSocketDataProvider(&http_data); | 10398 session_deps_.socket_factory->AddSocketDataProvider(&http_data); |
| 10414 | 10399 |
| 10415 StaticSocketDataProvider data_refused; | 10400 StaticSocketDataProvider data_refused; |
| 10416 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); | 10401 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); |
| 10417 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); | 10402 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); |
| 10418 | 10403 |
| 10419 session_deps_.enable_alternative_service_with_different_host = true; | |
| 10420 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10404 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10421 HttpServerProperties* http_server_properties = | 10405 HttpServerProperties* http_server_properties = |
| 10422 session->http_server_properties(); | 10406 session->http_server_properties(); |
| 10423 | 10407 |
| 10424 // Set up two QUIC alternative services for server. | 10408 // Set up two QUIC alternative services for server. |
| 10425 AlternativeServiceInfoVector alternative_service_info_vector; | 10409 AlternativeServiceInfoVector alternative_service_info_vector; |
| 10426 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 10410 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 10427 | 10411 |
| 10428 AlternativeService alternative_service1(QUIC, alternative1); | 10412 AlternativeService alternative_service1(QUIC, alternative1); |
| 10429 AlternativeServiceInfo alternative_service_info1(alternative_service1, | 10413 AlternativeServiceInfo alternative_service_info1(alternative_service1, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 10453 NetErrorDetails details; | 10437 NetErrorDetails details; |
| 10454 EXPECT_FALSE(details.quic_broken); | 10438 EXPECT_FALSE(details.quic_broken); |
| 10455 | 10439 |
| 10456 trans->Start(&request, callback.callback(), BoundNetLog()); | 10440 trans->Start(&request, callback.callback(), BoundNetLog()); |
| 10457 trans->PopulateNetErrorDetails(&details); | 10441 trans->PopulateNetErrorDetails(&details); |
| 10458 EXPECT_FALSE(details.quic_broken); | 10442 EXPECT_FALSE(details.quic_broken); |
| 10459 } | 10443 } |
| 10460 | 10444 |
| 10461 TEST_P(HttpNetworkTransactionTest, | 10445 TEST_P(HttpNetworkTransactionTest, |
| 10462 MarkBrokenAlternateProtocolAndFallback) { | 10446 MarkBrokenAlternateProtocolAndFallback) { |
| 10463 session_deps_.enable_alternative_service_with_different_host = false; | |
| 10464 | |
| 10465 HttpRequestInfo request; | 10447 HttpRequestInfo request; |
| 10466 request.method = "GET"; | 10448 request.method = "GET"; |
| 10467 request.url = GURL("http://www.example.org/"); | 10449 request.url = GURL("http://www.example.org/"); |
| 10468 request.load_flags = 0; | 10450 request.load_flags = 0; |
| 10469 | 10451 |
| 10470 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); | 10452 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
| 10471 StaticSocketDataProvider first_data; | 10453 StaticSocketDataProvider first_data; |
| 10472 first_data.set_connect_data(mock_connect); | 10454 first_data.set_connect_data(mock_connect); |
| 10473 session_deps_.socket_factory->AddSocketDataProvider(&first_data); | 10455 session_deps_.socket_factory->AddSocketDataProvider(&first_data); |
| 10474 | 10456 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10519 EXPECT_TRUE(http_server_properties->IsAlternativeServiceBroken( | 10501 EXPECT_TRUE(http_server_properties->IsAlternativeServiceBroken( |
| 10520 alternative_service_vector[0])); | 10502 alternative_service_vector[0])); |
| 10521 } | 10503 } |
| 10522 | 10504 |
| 10523 // Ensure that we are not allowed to redirect traffic via an alternate protocol | 10505 // Ensure that we are not allowed to redirect traffic via an alternate protocol |
| 10524 // to an unrestricted (port >= 1024) when the original traffic was on a | 10506 // to an unrestricted (port >= 1024) when the original traffic was on a |
| 10525 // restricted port (port < 1024). Ensure that we can redirect in all other | 10507 // restricted port (port < 1024). Ensure that we can redirect in all other |
| 10526 // cases. | 10508 // cases. |
| 10527 TEST_P(HttpNetworkTransactionTest, | 10509 TEST_P(HttpNetworkTransactionTest, |
| 10528 AlternateProtocolPortRestrictedBlocked) { | 10510 AlternateProtocolPortRestrictedBlocked) { |
| 10529 session_deps_.enable_alternative_service_with_different_host = false; | |
| 10530 | |
| 10531 HttpRequestInfo restricted_port_request; | 10511 HttpRequestInfo restricted_port_request; |
| 10532 restricted_port_request.method = "GET"; | 10512 restricted_port_request.method = "GET"; |
| 10533 restricted_port_request.url = GURL("http://www.example.org:1023/"); | 10513 restricted_port_request.url = GURL("http://www.example.org:1023/"); |
| 10534 restricted_port_request.load_flags = 0; | 10514 restricted_port_request.load_flags = 0; |
| 10535 | 10515 |
| 10536 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); | 10516 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
| 10537 StaticSocketDataProvider first_data; | 10517 StaticSocketDataProvider first_data; |
| 10538 first_data.set_connect_data(mock_connect); | 10518 first_data.set_connect_data(mock_connect); |
| 10539 session_deps_.socket_factory->AddSocketDataProvider(&first_data); | 10519 session_deps_.socket_factory->AddSocketDataProvider(&first_data); |
| 10540 | 10520 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 10570 EXPECT_EQ(ERR_IO_PENDING, rv); | 10550 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 10571 // Invalid change to unrestricted port should fail. | 10551 // Invalid change to unrestricted port should fail. |
| 10572 EXPECT_EQ(ERR_CONNECTION_REFUSED, callback.WaitForResult()); | 10552 EXPECT_EQ(ERR_CONNECTION_REFUSED, callback.WaitForResult()); |
| 10573 } | 10553 } |
| 10574 | 10554 |
| 10575 // Ensure that we are allowed to redirect traffic via an alternate protocol to | 10555 // Ensure that we are allowed to redirect traffic via an alternate protocol to |
| 10576 // an unrestricted (port >= 1024) when the original traffic was on a restricted | 10556 // an unrestricted (port >= 1024) when the original traffic was on a restricted |
| 10577 // port (port < 1024) if we set |enable_user_alternate_protocol_ports|. | 10557 // port (port < 1024) if we set |enable_user_alternate_protocol_ports|. |
| 10578 TEST_P(HttpNetworkTransactionTest, | 10558 TEST_P(HttpNetworkTransactionTest, |
| 10579 AlternateProtocolPortRestrictedPermitted) { | 10559 AlternateProtocolPortRestrictedPermitted) { |
| 10580 session_deps_.enable_alternative_service_with_different_host = false; | |
| 10581 session_deps_.enable_user_alternate_protocol_ports = true; | 10560 session_deps_.enable_user_alternate_protocol_ports = true; |
| 10582 | 10561 |
| 10583 HttpRequestInfo restricted_port_request; | 10562 HttpRequestInfo restricted_port_request; |
| 10584 restricted_port_request.method = "GET"; | 10563 restricted_port_request.method = "GET"; |
| 10585 restricted_port_request.url = GURL("http://www.example.org:1023/"); | 10564 restricted_port_request.url = GURL("http://www.example.org:1023/"); |
| 10586 restricted_port_request.load_flags = 0; | 10565 restricted_port_request.load_flags = 0; |
| 10587 | 10566 |
| 10588 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); | 10567 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
| 10589 StaticSocketDataProvider first_data; | 10568 StaticSocketDataProvider first_data; |
| 10590 first_data.set_connect_data(mock_connect); | 10569 first_data.set_connect_data(mock_connect); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10622 // Change to unrestricted port should succeed. | 10601 // Change to unrestricted port should succeed. |
| 10623 EXPECT_EQ(OK, callback.WaitForResult()); | 10602 EXPECT_EQ(OK, callback.WaitForResult()); |
| 10624 } | 10603 } |
| 10625 | 10604 |
| 10626 // Ensure that we are not allowed to redirect traffic via an alternate protocol | 10605 // Ensure that we are not allowed to redirect traffic via an alternate protocol |
| 10627 // to an unrestricted (port >= 1024) when the original traffic was on a | 10606 // to an unrestricted (port >= 1024) when the original traffic was on a |
| 10628 // restricted port (port < 1024). Ensure that we can redirect in all other | 10607 // restricted port (port < 1024). Ensure that we can redirect in all other |
| 10629 // cases. | 10608 // cases. |
| 10630 TEST_P(HttpNetworkTransactionTest, | 10609 TEST_P(HttpNetworkTransactionTest, |
| 10631 AlternateProtocolPortRestrictedAllowed) { | 10610 AlternateProtocolPortRestrictedAllowed) { |
| 10632 session_deps_.enable_alternative_service_with_different_host = false; | |
| 10633 | |
| 10634 HttpRequestInfo restricted_port_request; | 10611 HttpRequestInfo restricted_port_request; |
| 10635 restricted_port_request.method = "GET"; | 10612 restricted_port_request.method = "GET"; |
| 10636 restricted_port_request.url = GURL("http://www.example.org:1023/"); | 10613 restricted_port_request.url = GURL("http://www.example.org:1023/"); |
| 10637 restricted_port_request.load_flags = 0; | 10614 restricted_port_request.load_flags = 0; |
| 10638 | 10615 |
| 10639 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); | 10616 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
| 10640 StaticSocketDataProvider first_data; | 10617 StaticSocketDataProvider first_data; |
| 10641 first_data.set_connect_data(mock_connect); | 10618 first_data.set_connect_data(mock_connect); |
| 10642 session_deps_.socket_factory->AddSocketDataProvider(&first_data); | 10619 session_deps_.socket_factory->AddSocketDataProvider(&first_data); |
| 10643 | 10620 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 10674 // Valid change to restricted port should pass. | 10651 // Valid change to restricted port should pass. |
| 10675 EXPECT_EQ(OK, callback.WaitForResult()); | 10652 EXPECT_EQ(OK, callback.WaitForResult()); |
| 10676 } | 10653 } |
| 10677 | 10654 |
| 10678 // Ensure that we are not allowed to redirect traffic via an alternate protocol | 10655 // Ensure that we are not allowed to redirect traffic via an alternate protocol |
| 10679 // to an unrestricted (port >= 1024) when the original traffic was on a | 10656 // to an unrestricted (port >= 1024) when the original traffic was on a |
| 10680 // restricted port (port < 1024). Ensure that we can redirect in all other | 10657 // restricted port (port < 1024). Ensure that we can redirect in all other |
| 10681 // cases. | 10658 // cases. |
| 10682 TEST_P(HttpNetworkTransactionTest, | 10659 TEST_P(HttpNetworkTransactionTest, |
| 10683 AlternateProtocolPortUnrestrictedAllowed1) { | 10660 AlternateProtocolPortUnrestrictedAllowed1) { |
| 10684 session_deps_.enable_alternative_service_with_different_host = false; | |
| 10685 | |
| 10686 HttpRequestInfo unrestricted_port_request; | 10661 HttpRequestInfo unrestricted_port_request; |
| 10687 unrestricted_port_request.method = "GET"; | 10662 unrestricted_port_request.method = "GET"; |
| 10688 unrestricted_port_request.url = GURL("http://www.example.org:1024/"); | 10663 unrestricted_port_request.url = GURL("http://www.example.org:1024/"); |
| 10689 unrestricted_port_request.load_flags = 0; | 10664 unrestricted_port_request.load_flags = 0; |
| 10690 | 10665 |
| 10691 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); | 10666 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
| 10692 StaticSocketDataProvider first_data; | 10667 StaticSocketDataProvider first_data; |
| 10693 first_data.set_connect_data(mock_connect); | 10668 first_data.set_connect_data(mock_connect); |
| 10694 session_deps_.socket_factory->AddSocketDataProvider(&first_data); | 10669 session_deps_.socket_factory->AddSocketDataProvider(&first_data); |
| 10695 | 10670 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 10725 // Valid change to restricted port should pass. | 10700 // Valid change to restricted port should pass. |
| 10726 EXPECT_EQ(OK, callback.WaitForResult()); | 10701 EXPECT_EQ(OK, callback.WaitForResult()); |
| 10727 } | 10702 } |
| 10728 | 10703 |
| 10729 // Ensure that we are not allowed to redirect traffic via an alternate protocol | 10704 // Ensure that we are not allowed to redirect traffic via an alternate protocol |
| 10730 // to an unrestricted (port >= 1024) when the original traffic was on a | 10705 // to an unrestricted (port >= 1024) when the original traffic was on a |
| 10731 // restricted port (port < 1024). Ensure that we can redirect in all other | 10706 // restricted port (port < 1024). Ensure that we can redirect in all other |
| 10732 // cases. | 10707 // cases. |
| 10733 TEST_P(HttpNetworkTransactionTest, | 10708 TEST_P(HttpNetworkTransactionTest, |
| 10734 AlternateProtocolPortUnrestrictedAllowed2) { | 10709 AlternateProtocolPortUnrestrictedAllowed2) { |
| 10735 session_deps_.enable_alternative_service_with_different_host = false; | |
| 10736 | |
| 10737 HttpRequestInfo unrestricted_port_request; | 10710 HttpRequestInfo unrestricted_port_request; |
| 10738 unrestricted_port_request.method = "GET"; | 10711 unrestricted_port_request.method = "GET"; |
| 10739 unrestricted_port_request.url = GURL("http://www.example.org:1024/"); | 10712 unrestricted_port_request.url = GURL("http://www.example.org:1024/"); |
| 10740 unrestricted_port_request.load_flags = 0; | 10713 unrestricted_port_request.load_flags = 0; |
| 10741 | 10714 |
| 10742 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); | 10715 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
| 10743 StaticSocketDataProvider first_data; | 10716 StaticSocketDataProvider first_data; |
| 10744 first_data.set_connect_data(mock_connect); | 10717 first_data.set_connect_data(mock_connect); |
| 10745 session_deps_.socket_factory->AddSocketDataProvider(&first_data); | 10718 session_deps_.socket_factory->AddSocketDataProvider(&first_data); |
| 10746 | 10719 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 10774 &unrestricted_port_request, callback.callback(), BoundNetLog()); | 10747 &unrestricted_port_request, callback.callback(), BoundNetLog()); |
| 10775 EXPECT_EQ(ERR_IO_PENDING, rv); | 10748 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 10776 // Valid change to an unrestricted port should pass. | 10749 // Valid change to an unrestricted port should pass. |
| 10777 EXPECT_EQ(OK, callback.WaitForResult()); | 10750 EXPECT_EQ(OK, callback.WaitForResult()); |
| 10778 } | 10751 } |
| 10779 | 10752 |
| 10780 // Ensure that we are not allowed to redirect traffic via an alternate protocol | 10753 // Ensure that we are not allowed to redirect traffic via an alternate protocol |
| 10781 // to an unsafe port, and that we resume the second HttpStreamFactoryImpl::Job | 10754 // to an unsafe port, and that we resume the second HttpStreamFactoryImpl::Job |
| 10782 // once the alternate protocol request fails. | 10755 // once the alternate protocol request fails. |
| 10783 TEST_P(HttpNetworkTransactionTest, AlternateProtocolUnsafeBlocked) { | 10756 TEST_P(HttpNetworkTransactionTest, AlternateProtocolUnsafeBlocked) { |
| 10784 session_deps_.enable_alternative_service_with_different_host = false; | |
| 10785 | |
| 10786 HttpRequestInfo request; | 10757 HttpRequestInfo request; |
| 10787 request.method = "GET"; | 10758 request.method = "GET"; |
| 10788 request.url = GURL("http://www.example.org/"); | 10759 request.url = GURL("http://www.example.org/"); |
| 10789 request.load_flags = 0; | 10760 request.load_flags = 0; |
| 10790 | 10761 |
| 10791 // The alternate protocol request will error out before we attempt to connect, | 10762 // The alternate protocol request will error out before we attempt to connect, |
| 10792 // so only the standard HTTP request will try to connect. | 10763 // so only the standard HTTP request will try to connect. |
| 10793 MockRead data_reads[] = { | 10764 MockRead data_reads[] = { |
| 10794 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 10765 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 10795 MockRead("hello world"), | 10766 MockRead("hello world"), |
| (...skipping 28 matching lines...) Expand all Loading... |
| 10824 ASSERT_TRUE(response); | 10795 ASSERT_TRUE(response); |
| 10825 ASSERT_TRUE(response->headers); | 10796 ASSERT_TRUE(response->headers); |
| 10826 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 10797 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 10827 | 10798 |
| 10828 std::string response_data; | 10799 std::string response_data; |
| 10829 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 10800 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 10830 EXPECT_EQ("hello world", response_data); | 10801 EXPECT_EQ("hello world", response_data); |
| 10831 } | 10802 } |
| 10832 | 10803 |
| 10833 TEST_P(HttpNetworkTransactionTest, UseAlternateProtocolForNpnSpdy) { | 10804 TEST_P(HttpNetworkTransactionTest, UseAlternateProtocolForNpnSpdy) { |
| 10834 session_deps_.enable_alternative_service_with_different_host = true; | |
| 10835 | |
| 10836 HttpRequestInfo request; | 10805 HttpRequestInfo request; |
| 10837 request.method = "GET"; | 10806 request.method = "GET"; |
| 10838 request.url = GURL("http://www.example.org/"); | 10807 request.url = GURL("http://www.example.org/"); |
| 10839 request.load_flags = 0; | 10808 request.load_flags = 0; |
| 10840 | 10809 |
| 10841 std::string alternative_service_http_header = | 10810 std::string alternative_service_http_header = |
| 10842 GetAlternativeServiceHttpHeader(); | 10811 GetAlternativeServiceHttpHeader(); |
| 10843 | 10812 |
| 10844 MockRead data_reads[] = { | 10813 MockRead data_reads[] = { |
| 10845 MockRead("HTTP/1.1 200 OK\r\n"), | 10814 MockRead("HTTP/1.1 200 OK\r\n"), |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10913 ASSERT_TRUE(response->headers); | 10882 ASSERT_TRUE(response->headers); |
| 10914 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); | 10883 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); |
| 10915 EXPECT_TRUE(response->was_fetched_via_spdy); | 10884 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 10916 EXPECT_TRUE(response->was_npn_negotiated); | 10885 EXPECT_TRUE(response->was_npn_negotiated); |
| 10917 | 10886 |
| 10918 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 10887 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 10919 EXPECT_EQ("hello!", response_data); | 10888 EXPECT_EQ("hello!", response_data); |
| 10920 } | 10889 } |
| 10921 | 10890 |
| 10922 TEST_P(HttpNetworkTransactionTest, AlternateProtocolWithSpdyLateBinding) { | 10891 TEST_P(HttpNetworkTransactionTest, AlternateProtocolWithSpdyLateBinding) { |
| 10923 session_deps_.enable_alternative_service_with_different_host = true; | |
| 10924 | |
| 10925 HttpRequestInfo request; | 10892 HttpRequestInfo request; |
| 10926 request.method = "GET"; | 10893 request.method = "GET"; |
| 10927 request.url = GURL("http://www.example.org/"); | 10894 request.url = GURL("http://www.example.org/"); |
| 10928 request.load_flags = 0; | 10895 request.load_flags = 0; |
| 10929 | 10896 |
| 10930 std::string alternative_service_http_header = | 10897 std::string alternative_service_http_header = |
| 10931 GetAlternativeServiceHttpHeader(); | 10898 GetAlternativeServiceHttpHeader(); |
| 10932 | 10899 |
| 10933 MockRead data_reads[] = { | 10900 MockRead data_reads[] = { |
| 10934 MockRead("HTTP/1.1 200 OK\r\n"), | 10901 MockRead("HTTP/1.1 200 OK\r\n"), |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11037 ASSERT_TRUE(response); | 11004 ASSERT_TRUE(response); |
| 11038 ASSERT_TRUE(response->headers); | 11005 ASSERT_TRUE(response->headers); |
| 11039 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); | 11006 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); |
| 11040 EXPECT_TRUE(response->was_fetched_via_spdy); | 11007 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 11041 EXPECT_TRUE(response->was_npn_negotiated); | 11008 EXPECT_TRUE(response->was_npn_negotiated); |
| 11042 ASSERT_EQ(OK, ReadTransaction(&trans3, &response_data)); | 11009 ASSERT_EQ(OK, ReadTransaction(&trans3, &response_data)); |
| 11043 EXPECT_EQ("hello!", response_data); | 11010 EXPECT_EQ("hello!", response_data); |
| 11044 } | 11011 } |
| 11045 | 11012 |
| 11046 TEST_P(HttpNetworkTransactionTest, StallAlternativeServiceForNpnSpdy) { | 11013 TEST_P(HttpNetworkTransactionTest, StallAlternativeServiceForNpnSpdy) { |
| 11047 session_deps_.enable_alternative_service_with_different_host = true; | |
| 11048 | |
| 11049 HttpRequestInfo request; | 11014 HttpRequestInfo request; |
| 11050 request.method = "GET"; | 11015 request.method = "GET"; |
| 11051 request.url = GURL("http://www.example.org/"); | 11016 request.url = GURL("http://www.example.org/"); |
| 11052 request.load_flags = 0; | 11017 request.load_flags = 0; |
| 11053 | 11018 |
| 11054 std::string alternative_service_http_header = | 11019 std::string alternative_service_http_header = |
| 11055 GetAlternativeServiceHttpHeader(); | 11020 GetAlternativeServiceHttpHeader(); |
| 11056 | 11021 |
| 11057 MockRead data_reads[] = { | 11022 MockRead data_reads[] = { |
| 11058 MockRead("HTTP/1.1 200 OK\r\n"), | 11023 MockRead("HTTP/1.1 200 OK\r\n"), |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11164 std::unique_ptr<Request>* request) override { | 11129 std::unique_ptr<Request>* request) override { |
| 11165 resolver->reset(new ForwardingProxyResolver(resolver_)); | 11130 resolver->reset(new ForwardingProxyResolver(resolver_)); |
| 11166 return OK; | 11131 return OK; |
| 11167 } | 11132 } |
| 11168 | 11133 |
| 11169 private: | 11134 private: |
| 11170 ProxyResolver* resolver_; | 11135 ProxyResolver* resolver_; |
| 11171 }; | 11136 }; |
| 11172 | 11137 |
| 11173 TEST_P(HttpNetworkTransactionTest, UseAlternativeServiceForTunneledNpnSpdy) { | 11138 TEST_P(HttpNetworkTransactionTest, UseAlternativeServiceForTunneledNpnSpdy) { |
| 11174 session_deps_.enable_alternative_service_with_different_host = true; | |
| 11175 | |
| 11176 ProxyConfig proxy_config; | 11139 ProxyConfig proxy_config; |
| 11177 proxy_config.set_auto_detect(true); | 11140 proxy_config.set_auto_detect(true); |
| 11178 proxy_config.set_pac_url(GURL("http://fooproxyurl")); | 11141 proxy_config.set_pac_url(GURL("http://fooproxyurl")); |
| 11179 | 11142 |
| 11180 CapturingProxyResolver capturing_proxy_resolver; | 11143 CapturingProxyResolver capturing_proxy_resolver; |
| 11181 session_deps_.proxy_service.reset(new ProxyService( | 11144 session_deps_.proxy_service.reset(new ProxyService( |
| 11182 base::WrapUnique(new ProxyConfigServiceFixed(proxy_config)), | 11145 base::WrapUnique(new ProxyConfigServiceFixed(proxy_config)), |
| 11183 base::WrapUnique( | 11146 base::WrapUnique( |
| 11184 new CapturingProxyResolverFactory(&capturing_proxy_resolver)), | 11147 new CapturingProxyResolverFactory(&capturing_proxy_resolver)), |
| 11185 NULL)); | 11148 NULL)); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11289 capturing_proxy_resolver.resolved()[1].spec()); | 11252 capturing_proxy_resolver.resolved()[1].spec()); |
| 11290 | 11253 |
| 11291 LoadTimingInfo load_timing_info; | 11254 LoadTimingInfo load_timing_info; |
| 11292 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); | 11255 EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info)); |
| 11293 TestLoadTimingNotReusedWithPac(load_timing_info, | 11256 TestLoadTimingNotReusedWithPac(load_timing_info, |
| 11294 CONNECT_TIMING_HAS_SSL_TIMES); | 11257 CONNECT_TIMING_HAS_SSL_TIMES); |
| 11295 } | 11258 } |
| 11296 | 11259 |
| 11297 TEST_P(HttpNetworkTransactionTest, | 11260 TEST_P(HttpNetworkTransactionTest, |
| 11298 UseAlternativeServiceForNpnSpdyWithExistingSpdySession) { | 11261 UseAlternativeServiceForNpnSpdyWithExistingSpdySession) { |
| 11299 session_deps_.enable_alternative_service_with_different_host = true; | |
| 11300 | |
| 11301 HttpRequestInfo request; | 11262 HttpRequestInfo request; |
| 11302 request.method = "GET"; | 11263 request.method = "GET"; |
| 11303 request.url = GURL("http://www.example.org/"); | 11264 request.url = GURL("http://www.example.org/"); |
| 11304 request.load_flags = 0; | 11265 request.load_flags = 0; |
| 11305 | 11266 |
| 11306 std::string alternative_service_http_header = | 11267 std::string alternative_service_http_header = |
| 11307 GetAlternativeServiceHttpHeader(); | 11268 GetAlternativeServiceHttpHeader(); |
| 11308 | 11269 |
| 11309 MockRead data_reads[] = { | 11270 MockRead data_reads[] = { |
| 11310 MockRead("HTTP/1.1 200 OK\r\n"), | 11271 MockRead("HTTP/1.1 200 OK\r\n"), |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11991 rv = trans_compete->Read(io_buf.get(), io_buf->size(), callback.callback()); | 11952 rv = trans_compete->Read(io_buf.get(), io_buf->size(), callback.callback()); |
| 11992 EXPECT_EQ(0, rv); | 11953 EXPECT_EQ(0, rv); |
| 11993 | 11954 |
| 11994 // Finally, the socket is released to the group. | 11955 // Finally, the socket is released to the group. |
| 11995 EXPECT_EQ(1, transport_pool->IdleSocketCountInGroup(kSocketGroup)); | 11956 EXPECT_EQ(1, transport_pool->IdleSocketCountInGroup(kSocketGroup)); |
| 11996 } | 11957 } |
| 11997 | 11958 |
| 11998 // This tests the case that a request is issued via http instead of spdy after | 11959 // This tests the case that a request is issued via http instead of spdy after |
| 11999 // npn is negotiated. | 11960 // npn is negotiated. |
| 12000 TEST_P(HttpNetworkTransactionTest, NpnWithHttpOverSSL) { | 11961 TEST_P(HttpNetworkTransactionTest, NpnWithHttpOverSSL) { |
| 12001 session_deps_.enable_alternative_service_with_different_host = false; | |
| 12002 | |
| 12003 HttpRequestInfo request; | 11962 HttpRequestInfo request; |
| 12004 request.method = "GET"; | 11963 request.method = "GET"; |
| 12005 request.url = GURL("https://www.example.org/"); | 11964 request.url = GURL("https://www.example.org/"); |
| 12006 request.load_flags = 0; | 11965 request.load_flags = 0; |
| 12007 | 11966 |
| 12008 MockWrite data_writes[] = { | 11967 MockWrite data_writes[] = { |
| 12009 MockWrite( | 11968 MockWrite( |
| 12010 "GET / HTTP/1.1\r\n" | 11969 "GET / HTTP/1.1\r\n" |
| 12011 "Host: www.example.org\r\n" | 11970 "Host: www.example.org\r\n" |
| 12012 "Connection: keep-alive\r\n\r\n"), | 11971 "Connection: keep-alive\r\n\r\n"), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12053 EXPECT_EQ("hello world", response_data); | 12012 EXPECT_EQ("hello world", response_data); |
| 12054 | 12013 |
| 12055 EXPECT_FALSE(response->was_fetched_via_spdy); | 12014 EXPECT_FALSE(response->was_fetched_via_spdy); |
| 12056 EXPECT_TRUE(response->was_npn_negotiated); | 12015 EXPECT_TRUE(response->was_npn_negotiated); |
| 12057 } | 12016 } |
| 12058 | 12017 |
| 12059 // Simulate the SSL handshake completing with an NPN negotiation followed by an | 12018 // Simulate the SSL handshake completing with an NPN negotiation followed by an |
| 12060 // immediate server closing of the socket. | 12019 // immediate server closing of the socket. |
| 12061 // Regression test for https://crbug.com/46369. | 12020 // Regression test for https://crbug.com/46369. |
| 12062 TEST_P(HttpNetworkTransactionTest, SpdyPostNPNServerHangup) { | 12021 TEST_P(HttpNetworkTransactionTest, SpdyPostNPNServerHangup) { |
| 12063 session_deps_.enable_alternative_service_with_different_host = false; | |
| 12064 | |
| 12065 HttpRequestInfo request; | 12022 HttpRequestInfo request; |
| 12066 request.method = "GET"; | 12023 request.method = "GET"; |
| 12067 request.url = GURL("https://www.example.org/"); | 12024 request.url = GURL("https://www.example.org/"); |
| 12068 request.load_flags = 0; | 12025 request.load_flags = 0; |
| 12069 | 12026 |
| 12070 SSLSocketDataProvider ssl(ASYNC, OK); | 12027 SSLSocketDataProvider ssl(ASYNC, OK); |
| 12071 ssl.SetNextProto(GetProtocol()); | 12028 ssl.SetNextProto(GetProtocol()); |
| 12072 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 12029 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 12073 | 12030 |
| 12074 std::unique_ptr<SpdySerializedFrame> req( | 12031 std::unique_ptr<SpdySerializedFrame> req( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12113 credentials, request, callback, auth_token); | 12070 credentials, request, callback, auth_token); |
| 12114 } | 12071 } |
| 12115 | 12072 |
| 12116 private: | 12073 private: |
| 12117 GURL* url_; | 12074 GURL* url_; |
| 12118 }; | 12075 }; |
| 12119 | 12076 |
| 12120 // This test ensures that the URL passed into the proxy is upgraded to https | 12077 // This test ensures that the URL passed into the proxy is upgraded to https |
| 12121 // when doing an Alternate Protocol upgrade. | 12078 // when doing an Alternate Protocol upgrade. |
| 12122 TEST_P(HttpNetworkTransactionTest, SpdyAlternativeServiceThroughProxy) { | 12079 TEST_P(HttpNetworkTransactionTest, SpdyAlternativeServiceThroughProxy) { |
| 12123 session_deps_.enable_alternative_service_with_different_host = false; | |
| 12124 | |
| 12125 session_deps_.proxy_service = | 12080 session_deps_.proxy_service = |
| 12126 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); | 12081 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 12127 TestNetLog net_log; | 12082 TestNetLog net_log; |
| 12128 session_deps_.net_log = &net_log; | 12083 session_deps_.net_log = &net_log; |
| 12129 GURL request_url; | 12084 GURL request_url; |
| 12130 { | 12085 { |
| 12131 HttpAuthHandlerMock::Factory* auth_factory = | 12086 HttpAuthHandlerMock::Factory* auth_factory = |
| 12132 new HttpAuthHandlerMock::Factory(); | 12087 new HttpAuthHandlerMock::Factory(); |
| 12133 UrlRecordingHttpAuthHandlerMock* auth_handler = | 12088 UrlRecordingHttpAuthHandlerMock* auth_handler = |
| 12134 new UrlRecordingHttpAuthHandlerMock(&request_url); | 12089 new UrlRecordingHttpAuthHandlerMock(&request_url); |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13053 // certificate was removed from the client auth cache. | 13008 // certificate was removed from the client auth cache. |
| 13054 ASSERT_FALSE(session->ssl_client_auth_cache()->Lookup( | 13009 ASSERT_FALSE(session->ssl_client_auth_cache()->Lookup( |
| 13055 HostPortPair("proxy", 70), &client_cert, &client_private_key)); | 13010 HostPortPair("proxy", 70), &client_cert, &client_private_key)); |
| 13056 ASSERT_FALSE(session->ssl_client_auth_cache()->Lookup( | 13011 ASSERT_FALSE(session->ssl_client_auth_cache()->Lookup( |
| 13057 HostPortPair("www.example.com", 443), &client_cert, | 13012 HostPortPair("www.example.com", 443), &client_cert, |
| 13058 &client_private_key)); | 13013 &client_private_key)); |
| 13059 } | 13014 } |
| 13060 } | 13015 } |
| 13061 | 13016 |
| 13062 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPooling) { | 13017 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPooling) { |
| 13063 session_deps_.enable_alternative_service_with_different_host = false; | |
| 13064 | |
| 13065 // Set up a special HttpNetworkSession with a MockCachingHostResolver. | 13018 // Set up a special HttpNetworkSession with a MockCachingHostResolver. |
| 13066 session_deps_.host_resolver.reset(new MockCachingHostResolver()); | 13019 session_deps_.host_resolver.reset(new MockCachingHostResolver()); |
| 13067 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13020 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13068 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 13021 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
| 13069 pool_peer.DisableDomainAuthenticationVerification(); | 13022 pool_peer.DisableDomainAuthenticationVerification(); |
| 13070 | 13023 |
| 13071 SSLSocketDataProvider ssl(ASYNC, OK); | 13024 SSLSocketDataProvider ssl(ASYNC, OK); |
| 13072 ssl.SetNextProto(GetProtocol()); | 13025 ssl.SetNextProto(GetProtocol()); |
| 13073 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 13026 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 13074 | 13027 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13150 ASSERT_TRUE(response); | 13103 ASSERT_TRUE(response); |
| 13151 ASSERT_TRUE(response->headers); | 13104 ASSERT_TRUE(response->headers); |
| 13152 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); | 13105 EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine()); |
| 13153 EXPECT_TRUE(response->was_fetched_via_spdy); | 13106 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 13154 EXPECT_TRUE(response->was_npn_negotiated); | 13107 EXPECT_TRUE(response->was_npn_negotiated); |
| 13155 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); | 13108 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); |
| 13156 EXPECT_EQ("hello!", response_data); | 13109 EXPECT_EQ("hello!", response_data); |
| 13157 } | 13110 } |
| 13158 | 13111 |
| 13159 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPoolingAfterResolution) { | 13112 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPoolingAfterResolution) { |
| 13160 session_deps_.enable_alternative_service_with_different_host = false; | |
| 13161 | |
| 13162 // Set up a special HttpNetworkSession with a MockCachingHostResolver. | 13113 // Set up a special HttpNetworkSession with a MockCachingHostResolver. |
| 13163 session_deps_.host_resolver.reset(new MockCachingHostResolver()); | 13114 session_deps_.host_resolver.reset(new MockCachingHostResolver()); |
| 13164 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13115 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13165 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 13116 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
| 13166 pool_peer.DisableDomainAuthenticationVerification(); | 13117 pool_peer.DisableDomainAuthenticationVerification(); |
| 13167 | 13118 |
| 13168 SSLSocketDataProvider ssl(ASYNC, OK); | 13119 SSLSocketDataProvider ssl(ASYNC, OK); |
| 13169 ssl.SetNextProto(GetProtocol()); | 13120 ssl.SetNextProto(GetProtocol()); |
| 13170 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 13121 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 13171 | 13122 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13275 return &host_resolver_; | 13226 return &host_resolver_; |
| 13276 } | 13227 } |
| 13277 | 13228 |
| 13278 private: | 13229 private: |
| 13279 MockCachingHostResolver host_resolver_; | 13230 MockCachingHostResolver host_resolver_; |
| 13280 const HostPortPair host_port_; | 13231 const HostPortPair host_port_; |
| 13281 }; | 13232 }; |
| 13282 | 13233 |
| 13283 TEST_P(HttpNetworkTransactionTest, | 13234 TEST_P(HttpNetworkTransactionTest, |
| 13284 UseIPConnectionPoolingWithHostCacheExpiration) { | 13235 UseIPConnectionPoolingWithHostCacheExpiration) { |
| 13285 session_deps_.enable_alternative_service_with_different_host = false; | |
| 13286 | |
| 13287 // Set up a special HttpNetworkSession with a OneTimeCachingHostResolver. | 13236 // Set up a special HttpNetworkSession with a OneTimeCachingHostResolver. |
| 13288 OneTimeCachingHostResolver host_resolver(HostPortPair("www.gmail.com", 443)); | 13237 OneTimeCachingHostResolver host_resolver(HostPortPair("www.gmail.com", 443)); |
| 13289 HttpNetworkSession::Params params = | 13238 HttpNetworkSession::Params params = |
| 13290 SpdySessionDependencies::CreateSessionParams(&session_deps_); | 13239 SpdySessionDependencies::CreateSessionParams(&session_deps_); |
| 13291 params.host_resolver = &host_resolver; | 13240 params.host_resolver = &host_resolver; |
| 13292 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13241 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13293 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 13242 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
| 13294 pool_peer.DisableDomainAuthenticationVerification(); | 13243 pool_peer.DisableDomainAuthenticationVerification(); |
| 13295 | 13244 |
| 13296 SSLSocketDataProvider ssl(ASYNC, OK); | 13245 SSLSocketDataProvider ssl(ASYNC, OK); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13532 SequencedSocketData data(reads.data(), reads.size(), writes.data(), | 13481 SequencedSocketData data(reads.data(), reads.size(), writes.data(), |
| 13533 writes.size()); | 13482 writes.size()); |
| 13534 session_deps_.socket_factory->AddSocketDataProvider(&data); | 13483 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 13535 | 13484 |
| 13536 // Connection to the server fails. | 13485 // Connection to the server fails. |
| 13537 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); | 13486 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
| 13538 StaticSocketDataProvider data_refused; | 13487 StaticSocketDataProvider data_refused; |
| 13539 data_refused.set_connect_data(mock_connect); | 13488 data_refused.set_connect_data(mock_connect); |
| 13540 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); | 13489 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); |
| 13541 | 13490 |
| 13542 session_deps_.enable_alternative_service_with_different_host = true; | |
| 13543 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13491 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13544 HttpServerProperties* http_server_properties = | 13492 HttpServerProperties* http_server_properties = |
| 13545 session->http_server_properties(); | 13493 session->http_server_properties(); |
| 13546 AlternativeService alternative_service( | 13494 AlternativeService alternative_service( |
| 13547 AlternateProtocolFromNextProto(GetProtocol()), alternative); | 13495 AlternateProtocolFromNextProto(GetProtocol()), alternative); |
| 13548 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 13496 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 13549 http_server_properties->SetAlternativeService(server, alternative_service, | 13497 http_server_properties->SetAlternativeService(server, alternative_service, |
| 13550 expiration); | 13498 expiration); |
| 13551 | 13499 |
| 13552 // First request to alternative. | 13500 // First request to alternative. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13637 session_deps_.socket_factory->AddSocketDataProvider(&data); | 13585 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 13638 | 13586 |
| 13639 // This test documents that an alternate Job should not be used if HTTP/1.1 is | 13587 // This test documents that an alternate Job should not be used if HTTP/1.1 is |
| 13640 // negotiated. In order to test this, a failed connection to the server is | 13588 // negotiated. In order to test this, a failed connection to the server is |
| 13641 // mocked. This way the request relies on the alternate Job. | 13589 // mocked. This way the request relies on the alternate Job. |
| 13642 StaticSocketDataProvider data_refused; | 13590 StaticSocketDataProvider data_refused; |
| 13643 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); | 13591 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); |
| 13644 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); | 13592 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); |
| 13645 | 13593 |
| 13646 // Set up alternative service for server. | 13594 // Set up alternative service for server. |
| 13647 session_deps_.enable_alternative_service_with_different_host = true; | |
| 13648 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13595 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13649 HttpServerProperties* http_server_properties = | 13596 HttpServerProperties* http_server_properties = |
| 13650 session->http_server_properties(); | 13597 session->http_server_properties(); |
| 13651 AlternativeService alternative_service( | 13598 AlternativeService alternative_service( |
| 13652 AlternateProtocolFromNextProto(GetProtocol()), alternative); | 13599 AlternateProtocolFromNextProto(GetProtocol()), alternative); |
| 13653 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 13600 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 13654 http_server_properties->SetAlternativeService(server, alternative_service, | 13601 http_server_properties->SetAlternativeService(server, alternative_service, |
| 13655 expiration); | 13602 expiration); |
| 13656 | 13603 |
| 13657 std::unique_ptr<HttpTransaction> trans( | 13604 std::unique_ptr<HttpTransaction> trans( |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13708 MockRead("HTTP/1.1 200 OK\r\n"), | 13655 MockRead("HTTP/1.1 200 OK\r\n"), |
| 13709 MockRead("Content-Type: text/html\r\n"), | 13656 MockRead("Content-Type: text/html\r\n"), |
| 13710 MockRead("Content-Length: 7\r\n\r\n"), | 13657 MockRead("Content-Length: 7\r\n\r\n"), |
| 13711 MockRead("another"), | 13658 MockRead("another"), |
| 13712 }; | 13659 }; |
| 13713 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), | 13660 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), |
| 13714 http_writes, arraysize(http_writes)); | 13661 http_writes, arraysize(http_writes)); |
| 13715 session_deps_.socket_factory->AddSocketDataProvider(&http_data); | 13662 session_deps_.socket_factory->AddSocketDataProvider(&http_data); |
| 13716 | 13663 |
| 13717 // Set up alternative service for server. | 13664 // Set up alternative service for server. |
| 13718 session_deps_.enable_alternative_service_with_different_host = true; | |
| 13719 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13665 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13720 HttpServerProperties* http_server_properties = | 13666 HttpServerProperties* http_server_properties = |
| 13721 session->http_server_properties(); | 13667 session->http_server_properties(); |
| 13722 AlternativeService alternative_service( | 13668 AlternativeService alternative_service( |
| 13723 AlternateProtocolFromNextProto(GetProtocol()), alternative); | 13669 AlternateProtocolFromNextProto(GetProtocol()), alternative); |
| 13724 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 13670 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 13725 http_server_properties->SetAlternativeService(server, alternative_service, | 13671 http_server_properties->SetAlternativeService(server, alternative_service, |
| 13726 expiration); | 13672 expiration); |
| 13727 | 13673 |
| 13728 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, session.get()); | 13674 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, session.get()); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13817 session_deps_.socket_factory->AddSocketDataProvider(&http_data); | 13763 session_deps_.socket_factory->AddSocketDataProvider(&http_data); |
| 13818 | 13764 |
| 13819 // This test documents that an alternate Job should not pool to an already | 13765 // This test documents that an alternate Job should not pool to an already |
| 13820 // existing HTTP/1.1 connection. In order to test this, a failed connection | 13766 // existing HTTP/1.1 connection. In order to test this, a failed connection |
| 13821 // to the server is mocked. This way |request2| relies on the alternate Job. | 13767 // to the server is mocked. This way |request2| relies on the alternate Job. |
| 13822 StaticSocketDataProvider data_refused; | 13768 StaticSocketDataProvider data_refused; |
| 13823 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); | 13769 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); |
| 13824 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); | 13770 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); |
| 13825 | 13771 |
| 13826 // Set up alternative service for server. | 13772 // Set up alternative service for server. |
| 13827 session_deps_.enable_alternative_service_with_different_host = false; | |
| 13828 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13773 std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13829 HttpServerProperties* http_server_properties = | 13774 HttpServerProperties* http_server_properties = |
| 13830 session->http_server_properties(); | 13775 session->http_server_properties(); |
| 13831 AlternativeService alternative_service( | 13776 AlternativeService alternative_service( |
| 13832 AlternateProtocolFromNextProto(GetProtocol()), alternative); | 13777 AlternateProtocolFromNextProto(GetProtocol()), alternative); |
| 13833 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 13778 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 13834 http_server_properties->SetAlternativeService(server, alternative_service, | 13779 http_server_properties->SetAlternativeService(server, alternative_service, |
| 13835 expiration); | 13780 expiration); |
| 13836 | 13781 |
| 13837 // First transaction to alternative to open an HTTP/1.1 socket. | 13782 // First transaction to alternative to open an HTTP/1.1 socket. |
| (...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16144 base::RunLoop().RunUntilIdle(); | 16089 base::RunLoop().RunUntilIdle(); |
| 16145 | 16090 |
| 16146 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy); | 16091 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy); |
| 16147 HttpRequestHeaders headers; | 16092 HttpRequestHeaders headers; |
| 16148 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers)); | 16093 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers)); |
| 16149 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding)); | 16094 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding)); |
| 16150 } | 16095 } |
| 16151 #endif // !defined(OS_IOS) | 16096 #endif // !defined(OS_IOS) |
| 16152 | 16097 |
| 16153 } // namespace net | 16098 } // namespace net |
| OLD | NEW |