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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_group_sockets_); | 391 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_group_sockets_); |
392 } | 392 } |
393 | 393 |
394 protected: | 394 protected: |
395 HttpNetworkTransactionTest() | 395 HttpNetworkTransactionTest() |
396 : ssl_(ASYNC, OK), | 396 : ssl_(ASYNC, OK), |
397 old_max_group_sockets_(ClientSocketPoolManager::max_sockets_per_group( | 397 old_max_group_sockets_(ClientSocketPoolManager::max_sockets_per_group( |
398 HttpNetworkSession::NORMAL_SOCKET_POOL)), | 398 HttpNetworkSession::NORMAL_SOCKET_POOL)), |
399 old_max_pool_sockets_(ClientSocketPoolManager::max_sockets_per_pool( | 399 old_max_pool_sockets_(ClientSocketPoolManager::max_sockets_per_pool( |
400 HttpNetworkSession::NORMAL_SOCKET_POOL)) { | 400 HttpNetworkSession::NORMAL_SOCKET_POOL)) { |
401 session_deps_.enable_http2_alternative_service_with_different_host = true; | 401 session_deps_.enable_http2_alternative_service = true; |
402 } | 402 } |
403 | 403 |
404 struct SimpleGetHelperResult { | 404 struct SimpleGetHelperResult { |
405 int rv; | 405 int rv; |
406 std::string status_line; | 406 std::string status_line; |
407 std::string response_data; | 407 std::string response_data; |
408 int64_t total_received_bytes; | 408 int64_t total_received_bytes; |
409 int64_t total_sent_bytes; | 409 int64_t total_sent_bytes; |
410 LoadTimingInfo load_timing_info; | 410 LoadTimingInfo load_timing_info; |
411 ConnectionAttempts connection_attempts; | 411 ConnectionAttempts connection_attempts; |
(...skipping 9743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10155 | 10155 |
10156 std::string response_data; | 10156 std::string response_data; |
10157 ASSERT_THAT(ReadTransaction(&trans, &response_data), IsOk()); | 10157 ASSERT_THAT(ReadTransaction(&trans, &response_data), IsOk()); |
10158 EXPECT_EQ("hello world", response_data); | 10158 EXPECT_EQ("hello world", response_data); |
10159 | 10159 |
10160 alternative_service_vector = | 10160 alternative_service_vector = |
10161 http_server_properties->GetAlternativeServices(test_server); | 10161 http_server_properties->GetAlternativeServices(test_server); |
10162 EXPECT_TRUE(alternative_service_vector.empty()); | 10162 EXPECT_TRUE(alternative_service_vector.empty()); |
10163 } | 10163 } |
10164 | 10164 |
10165 // HTTP/2 Alternative Services should be disabled if alternative service | 10165 // HTTP/2 Alternative Services should be disabled by default. |
10166 // hostname is different from that of origin. | |
10167 // TODO(bnc): Remove when https://crbug.com/615413 is fixed. | 10166 // TODO(bnc): Remove when https://crbug.com/615413 is fixed. |
10168 TEST_F(HttpNetworkTransactionTest, | 10167 TEST_F(HttpNetworkTransactionTest, |
10169 DisableHTTP2AlternativeServicesWithDifferentHost) { | 10168 DisableHTTP2AlternativeServicesWithDifferentHost) { |
10170 session_deps_.enable_http2_alternative_service_with_different_host = false; | 10169 session_deps_.enable_http2_alternative_service = false; |
10171 | 10170 |
10172 HttpRequestInfo request; | 10171 HttpRequestInfo request; |
10173 request.method = "GET"; | 10172 request.method = "GET"; |
10174 request.url = GURL("https://www.example.org/"); | 10173 request.url = GURL("https://www.example.org/"); |
10175 request.load_flags = 0; | 10174 request.load_flags = 0; |
10176 | 10175 |
10177 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); | 10176 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
10178 StaticSocketDataProvider first_data; | 10177 StaticSocketDataProvider first_data; |
10179 first_data.set_connect_data(mock_connect); | 10178 first_data.set_connect_data(mock_connect); |
10180 session_deps_.socket_factory->AddSocketDataProvider(&first_data); | 10179 session_deps_.socket_factory->AddSocketDataProvider(&first_data); |
(...skipping 6544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16725 TEST_F(HttpNetworkTransactionTest, MatchContentEncoding2) { | 16724 TEST_F(HttpNetworkTransactionTest, MatchContentEncoding2) { |
16726 CheckContentEncodingMatching(&session_deps_, "identity;q=1, *;q=0", "", true); | 16725 CheckContentEncodingMatching(&session_deps_, "identity;q=1, *;q=0", "", true); |
16727 } | 16726 } |
16728 | 16727 |
16729 TEST_F(HttpNetworkTransactionTest, MatchContentEncoding3) { | 16728 TEST_F(HttpNetworkTransactionTest, MatchContentEncoding3) { |
16730 CheckContentEncodingMatching(&session_deps_, "identity;q=1, *;q=0", "gzip", | 16729 CheckContentEncodingMatching(&session_deps_, "identity;q=1, *;q=0", "gzip", |
16731 false); | 16730 false); |
16732 } | 16731 } |
16733 | 16732 |
16734 } // namespace net | 16733 } // namespace net |
OLD | NEW |