| 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 "net/http/http_proxy_client_socket_pool.h" | 5 #include "net/http/http_proxy_client_socket_pool.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "net/base/auth.h" | 12 #include "net/base/auth.h" |
| 13 #include "net/base/load_timing_info.h" | 13 #include "net/base/load_timing_info.h" |
| 14 #include "net/base/load_timing_info_test_util.h" | 14 #include "net/base/load_timing_info_test_util.h" |
| 15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 16 #include "net/base/test_completion_callback.h" | 16 #include "net/base/test_completion_callback.h" |
| 17 #include "net/cert/ct_policy_enforcer.h" | 17 #include "net/cert/ct_policy_enforcer.h" |
| 18 #include "net/cert/mock_cert_verifier.h" | 18 #include "net/cert/mock_cert_verifier.h" |
| 19 #include "net/cert/multi_log_ct_verifier.h" | 19 #include "net/cert/multi_log_ct_verifier.h" |
| 20 #include "net/dns/mock_host_resolver.h" | 20 #include "net/dns/mock_host_resolver.h" |
| 21 #include "net/http/http_auth_handler_factory.h" | 21 #include "net/http/http_auth_handler_factory.h" |
| 22 #include "net/http/http_network_session.h" | 22 #include "net/http/http_network_session.h" |
| 23 #include "net/http/http_request_headers.h" | 23 #include "net/http/http_request_headers.h" |
| 24 #include "net/http/http_response_headers.h" | 24 #include "net/http/http_response_headers.h" |
| 25 #include "net/http/http_server_properties_impl.h" | 25 #include "net/http/http_server_properties_impl.h" |
| 26 #include "net/http/transport_security_state.h" | 26 #include "net/http/transport_security_state.h" |
| 27 #include "net/log/net_log_source.h" |
| 28 #include "net/log/net_log_with_source.h" |
| 27 #include "net/proxy/proxy_service.h" | 29 #include "net/proxy/proxy_service.h" |
| 28 #include "net/socket/client_socket_handle.h" | 30 #include "net/socket/client_socket_handle.h" |
| 29 #include "net/socket/next_proto.h" | 31 #include "net/socket/next_proto.h" |
| 30 #include "net/socket/socket_test_util.h" | 32 #include "net/socket/socket_test_util.h" |
| 31 #include "net/spdy/spdy_session.h" | 33 #include "net/spdy/spdy_session.h" |
| 32 #include "net/spdy/spdy_session_pool.h" | 34 #include "net/spdy/spdy_session_pool.h" |
| 33 #include "net/spdy/spdy_test_util_common.h" | 35 #include "net/spdy/spdy_test_util_common.h" |
| 34 #include "net/ssl/ssl_config_service_defaults.h" | 36 #include "net/ssl/ssl_config_service_defaults.h" |
| 35 #include "net/test/gtest_util.h" | 37 #include "net/test/gtest_util.h" |
| 36 #include "net/test/test_certificate_data.h" | 38 #include "net/test/test_certificate_data.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 49 | 51 |
| 50 // Make sure |handle|'s load times are set correctly. DNS and connect start | 52 // Make sure |handle|'s load times are set correctly. DNS and connect start |
| 51 // times comes from mock client sockets in these tests, so primarily serves to | 53 // times comes from mock client sockets in these tests, so primarily serves to |
| 52 // check those times were copied, and ssl times / connect end are set correctly. | 54 // check those times were copied, and ssl times / connect end are set correctly. |
| 53 void TestLoadTimingInfo(const ClientSocketHandle& handle) { | 55 void TestLoadTimingInfo(const ClientSocketHandle& handle) { |
| 54 LoadTimingInfo load_timing_info; | 56 LoadTimingInfo load_timing_info; |
| 55 EXPECT_TRUE(handle.GetLoadTimingInfo(false, &load_timing_info)); | 57 EXPECT_TRUE(handle.GetLoadTimingInfo(false, &load_timing_info)); |
| 56 | 58 |
| 57 EXPECT_FALSE(load_timing_info.socket_reused); | 59 EXPECT_FALSE(load_timing_info.socket_reused); |
| 58 // None of these tests use a NetLog. | 60 // None of these tests use a NetLog. |
| 59 EXPECT_EQ(NetLog::Source::kInvalidId, load_timing_info.socket_log_id); | 61 EXPECT_EQ(NetLogSource::kInvalidId, load_timing_info.socket_log_id); |
| 60 | 62 |
| 61 ExpectConnectTimingHasTimes( | 63 ExpectConnectTimingHasTimes( |
| 62 load_timing_info.connect_timing, | 64 load_timing_info.connect_timing, |
| 63 CONNECT_TIMING_HAS_SSL_TIMES | CONNECT_TIMING_HAS_DNS_TIMES); | 65 CONNECT_TIMING_HAS_SSL_TIMES | CONNECT_TIMING_HAS_DNS_TIMES); |
| 64 ExpectLoadTimingHasOnlyConnectionTimes(load_timing_info); | 66 ExpectLoadTimingHasOnlyConnectionTimes(load_timing_info); |
| 65 } | 67 } |
| 66 | 68 |
| 67 // Just like TestLoadTimingInfo, except DNS times are expected to be null, for | 69 // Just like TestLoadTimingInfo, except DNS times are expected to be null, for |
| 68 // tests over proxies that do DNS lookups themselves. | 70 // tests over proxies that do DNS lookups themselves. |
| 69 void TestLoadTimingInfoNoDns(const ClientSocketHandle& handle) { | 71 void TestLoadTimingInfoNoDns(const ClientSocketHandle& handle) { |
| 70 LoadTimingInfo load_timing_info; | 72 LoadTimingInfo load_timing_info; |
| 71 EXPECT_TRUE(handle.GetLoadTimingInfo(false, &load_timing_info)); | 73 EXPECT_TRUE(handle.GetLoadTimingInfo(false, &load_timing_info)); |
| 72 | 74 |
| 73 // None of these tests use a NetLog. | 75 // None of these tests use a NetLog. |
| 74 EXPECT_EQ(NetLog::Source::kInvalidId, load_timing_info.socket_log_id); | 76 EXPECT_EQ(NetLogSource::kInvalidId, load_timing_info.socket_log_id); |
| 75 | 77 |
| 76 EXPECT_FALSE(load_timing_info.socket_reused); | 78 EXPECT_FALSE(load_timing_info.socket_reused); |
| 77 | 79 |
| 78 ExpectConnectTimingHasTimes(load_timing_info.connect_timing, | 80 ExpectConnectTimingHasTimes(load_timing_info.connect_timing, |
| 79 CONNECT_TIMING_HAS_SSL_TIMES); | 81 CONNECT_TIMING_HAS_SSL_TIMES); |
| 80 ExpectLoadTimingHasOnlyConnectionTimes(load_timing_info); | 82 ExpectLoadTimingHasOnlyConnectionTimes(load_timing_info); |
| 81 } | 83 } |
| 82 | 84 |
| 83 class SSLClientSocketPoolTest : public testing::Test { | 85 class SSLClientSocketPoolTest : public testing::Test { |
| 84 protected: | 86 protected: |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 ssl.channel_id_sent = true; | 933 ssl.channel_id_sent = true; |
| 932 ssl.next_proto = kProtoHTTP2; | 934 ssl.next_proto = kProtoHTTP2; |
| 933 TestIPPoolingDisabled(&ssl); | 935 TestIPPoolingDisabled(&ssl); |
| 934 } | 936 } |
| 935 | 937 |
| 936 // It would be nice to also test the timeouts in SSLClientSocketPool. | 938 // It would be nice to also test the timeouts in SSLClientSocketPool. |
| 937 | 939 |
| 938 } // namespace | 940 } // namespace |
| 939 | 941 |
| 940 } // namespace net | 942 } // namespace net |
| OLD | NEW |