#include "services/network/network_service_proxy_delegate.h"
#include <optional>
#include <string>
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/proxy_chain.h"
#include "net/base/proxy_string_util.h"
#include "net/proxy_resolution/proxy_info.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_test_util.h"
#include "services/network/public/cpp/features.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace network {
namespace {
constexpr char kHttpUrl[] = …;
constexpr char kLocalhost[] = …;
constexpr char kHttpsUrl[] = …;
constexpr char kWebsocketUrl[] = …;
}
MATCHER_P2(Contain,
expected_name,
expected_value,
std::string("headers ") + (negation ? "don't " : "") + "contain '" +
expected_name + ": " + expected_value + "'") { … }
struct HeadersReceived { … };
class TestCustomProxyConnectionObserver
: public mojom::CustomProxyConnectionObserver { … };
class NetworkServiceProxyDelegateTest : public testing::Test { … };
TEST_F(NetworkServiceProxyDelegateTest, NullConfigDoesNotCrash) { … }
TEST_F(NetworkServiceProxyDelegateTest, AddsHeadersToTunnelRequest) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnResolveProxySuccessHttpProxy) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnResolveProxySuccessHttpsUrl) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnResolveProxySuccessWebSocketUrl) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnResolveProxyNoRuleForHttpsUrl) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnResolveProxyLocalhost) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnResolveProxyEmptyConfig) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnResolveProxyNonIdempotentMethod) { … }
TEST_F(NetworkServiceProxyDelegateTest,
OnResolveProxyNonIdempotentMethodAllowed) { … }
TEST_F(NetworkServiceProxyDelegateTest,
OnResolveProxyBypassForWebSocketScheme) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnResolveProxyDoesNotOverrideExisting) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnResolveProxyOverridesExisting) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnResolveProxyDoesNotMergeDirect) { … }
TEST_F(NetworkServiceProxyDelegateTest,
OnResolveProxyDoesNotMergeWhenOverrideExistingConfigFlagIsEnabled) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnResolveProxyDeprioritizesBadProxies) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnResolveProxyAllProxiesBad) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnResolveProxyNothingMatching) { … }
TEST_F(NetworkServiceProxyDelegateTest, InitialConfigUsedForProxy) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnFallbackObserved) { … }
TEST_F(NetworkServiceProxyDelegateTest, OnTunnelHeadersReceivedObserved) { … }
}