#include "net/socket/ssl_connect_job.h"
#include <memory>
#include <string>
#include "base/compiler_specific.h"
#include "base/functional/callback.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "net/base/auth.h"
#include "net/base/features.h"
#include "net/base/host_port_pair.h"
#include "net/base/load_timing_info.h"
#include "net/base/net_errors.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/network_isolation_key.h"
#include "net/base/proxy_chain.h"
#include "net/base/proxy_server.h"
#include "net/base/proxy_string_util.h"
#include "net/cert/mock_cert_verifier.h"
#include "net/dns/mock_host_resolver.h"
#include "net/dns/public/secure_dns_policy.h"
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_network_session.h"
#include "net/http/http_proxy_connect_job.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_server_properties.h"
#include "net/http/transport_security_state.h"
#include "net/log/net_log_source.h"
#include "net/log/net_log_with_source.h"
#include "net/proxy_resolution/configured_proxy_resolution_service.h"
#include "net/quic/quic_context.h"
#include "net/socket/connect_job_test_util.h"
#include "net/socket/connection_attempts.h"
#include "net/socket/next_proto.h"
#include "net/socket/socket_tag.h"
#include "net/socket/socket_test_util.h"
#include "net/socket/socks_connect_job.h"
#include "net/socket/transport_connect_job.h"
#include "net/ssl/ssl_config_service_defaults.h"
#include "net/ssl/ssl_connection_status_flags.h"
#include "net/ssl/test_ssl_config_service.h"
#include "net/test/cert_test_util.h"
#include "net/test/gtest_util.h"
#include "net/test/ssl_test_util.h"
#include "net/test/test_certificate_data.h"
#include "net/test/test_data_directory.h"
#include "net/test/test_with_task_environment.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/static_http_user_agent_settings.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/boringssl/src/include/openssl/ssl.h"
#include "url/gurl.h"
#include "url/scheme_host_port.h"
#include "url/url_constants.h"
namespace net {
namespace {
IPAddress ParseIP(const std::string& ip) { … }
void CheckConnectTimesSet(const LoadTimingInfo::ConnectTiming& connect_timing) { … }
void CheckConnectTimesExceptDnsSet(
const LoadTimingInfo::ConnectTiming& connect_timing) { … }
const url::SchemeHostPort kHostHttps{ … };
const HostPortPair kHostHttp{ … };
const ProxyServer kSocksProxyServer{ … };
const ProxyServer kHttpProxyServer{ … };
const ProxyChain kHttpProxyChain{ … };
class SSLConnectJobTest : public WithTaskEnvironment, public testing::Test { … };
TEST_F(SSLConnectJobTest, TCPFail) { … }
TEST_F(SSLConnectJobTest, TCPTimeout) { … }
TEST_F(SSLConnectJobTest, SSLTimeoutSyncConnect) { … }
TEST_F(SSLConnectJobTest, SSLTimeoutAsyncTcpConnect) { … }
TEST_F(SSLConnectJobTest, BasicDirectSync) { … }
TEST_F(SSLConnectJobTest, BasicDirectAsync) { … }
TEST_F(SSLConnectJobTest, DirectHasEstablishedConnection) { … }
TEST_F(SSLConnectJobTest, RequestPriority) { … }
TEST_F(SSLConnectJobTest, SecureDnsPolicy) { … }
TEST_F(SSLConnectJobTest, DirectHostResolutionFailure) { … }
TEST_F(SSLConnectJobTest, DirectCertError) { … }
TEST_F(SSLConnectJobTest, DirectIgnoreCertErrors) { … }
TEST_F(SSLConnectJobTest, DirectSSLError) { … }
TEST_F(SSLConnectJobTest, DirectWithNPN) { … }
TEST_F(SSLConnectJobTest, DirectGotHTTP2) { … }
TEST_F(SSLConnectJobTest, SOCKSFail) { … }
TEST_F(SSLConnectJobTest, SOCKSHostResolutionFailure) { … }
TEST_F(SSLConnectJobTest, SOCKSBasic) { … }
TEST_F(SSLConnectJobTest, SOCKSHasEstablishedConnection) { … }
TEST_F(SSLConnectJobTest, SOCKSRequestPriority) { … }
TEST_F(SSLConnectJobTest, HttpProxyFail) { … }
TEST_F(SSLConnectJobTest, HttpProxyHostResolutionFailure) { … }
TEST_F(SSLConnectJobTest, HttpProxyAuthChallenge) { … }
TEST_F(SSLConnectJobTest, HttpProxyAuthWithCachedCredentials) { … }
TEST_F(SSLConnectJobTest, HttpProxyRequestPriority) { … }
TEST_F(SSLConnectJobTest, HttpProxyAuthHasEstablishedConnection) { … }
TEST_F(SSLConnectJobTest,
HttpProxyAuthHasEstablishedConnectionWithProxyConnectionClose) { … }
TEST_F(SSLConnectJobTest, DnsAliases) { … }
TEST_F(SSLConnectJobTest, NoAdditionalDnsAliases) { … }
TEST_F(SSLConnectJobTest, EncryptedClientHello) { … }
TEST_F(SSLConnectJobTest, ECHStaleConfig) { … }
TEST_F(SSLConnectJobTest, ECHRollback) { … }
TEST_F(SSLConnectJobTest, ECHTooManyRetries) { … }
TEST_F(SSLConnectJobTest, ECHWrongRetryError) { … }
TEST_F(SSLConnectJobTest, ECHRecoveryThenLegacyCrypto) { … }
TEST_F(SSLConnectJobTest, LegacyCryptoThenECHRecovery) { … }
}
}