#include "services/network/proxy_resolving_client_socket.h"
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/compiler_specific.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "net/base/features.h"
#include "net/base/network_isolation_key.h"
#include "net/base/proxy_server.h"
#include "net/base/proxy_string_util.h"
#include "net/base/test_completion_callback.h"
#include "net/dns/mock_host_resolver.h"
#include "net/http/http_proxy_connect_job.h"
#include "net/proxy_resolution/configured_proxy_resolution_service.h"
#include "net/proxy_resolution/mock_proxy_resolver.h"
#include "net/proxy_resolution/proxy_config_service_fixed.h"
#include "net/proxy_resolution/proxy_config_with_annotation.h"
#include "net/socket/client_socket_pool_manager.h"
#include "net/socket/connect_job_factory.h"
#include "net/socket/socket_test_util.h"
#include "net/spdy/spdy_test_util_common.h"
#include "net/test/gtest_util.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_test_util.h"
#include "services/network/proxy_resolving_client_socket_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/scheme_host_port.h"
namespace network {
namespace {
std::unique_ptr<net::ConfiguredProxyResolutionService>
CreateProxyResolutionService(std::string_view pac_result) { … }
}
class ProxyResolvingClientSocketTest
: public testing::Test,
public testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(ProxyResolvingClientSocketTest, NetworkIsolationKeyDirect) { … }
TEST_P(ProxyResolvingClientSocketTest, NetworkIsolationKeyWithH2Proxy) { … }
TEST_P(ProxyResolvingClientSocketTest, SocketLimitNotApply) { … }
TEST_P(ProxyResolvingClientSocketTest, ConnectError) { … }
TEST_P(ProxyResolvingClientSocketTest, ConnectToProxy) { … }
TEST_P(ProxyResolvingClientSocketTest, SocketDestroyedBeforeConnectComplete) { … }
TEST_P(ProxyResolvingClientSocketTest, ReadWriteErrors) { … }
TEST_P(ProxyResolvingClientSocketTest, ReportsBadProxies) { … }
TEST_P(ProxyResolvingClientSocketTest, ResetSocketAfterTunnelAuth) { … }
TEST_P(ProxyResolvingClientSocketTest, MultiroundAuth) { … }
TEST_P(ProxyResolvingClientSocketTest, ReusesHTTPAuthCache_Lookup) { … }
TEST_P(ProxyResolvingClientSocketTest, FactoryUsesLatestHTTPAuthCache) { … }
TEST_P(ProxyResolvingClientSocketTest, ReusesHTTPAuthCache_Preemptive) { … }
TEST_P(ProxyResolvingClientSocketTest, ReusesHTTPAuthCache_NoCredentials) { … }
TEST_P(ProxyResolvingClientSocketTest, URLSanitized) { … }
TEST_P(ProxyResolvingClientSocketTest,
SocketDestroyedBeforeProxyResolutionCompletes) { … }
TEST_P(ProxyResolvingClientSocketTest, NoSupportedProxies) { … }
class ReconsiderProxyAfterErrorTest
: public testing::Test,
public testing::WithParamInterface<::testing::tuple<bool, bool, int>> { … };
const int kProxyTestMockErrors[] = …;
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(ReconsiderProxyAfterErrorTest, ReconsiderProxyAfterError) { … }
}