#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/proxy_resolution/proxy_bypass_rules.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "net/proxy_resolution/proxy_config_service_common_unittest.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_WIN)
#define BYPASS_LOOPBACK
#endif
namespace net {
namespace {
void ExpectRulesMatch(const ProxyBypassRules& rules,
const char* hosts[],
size_t num_hosts,
bool bypasses,
const std::set<std::string>& inverted_hosts) { … }
void ExpectBypassLocalhost(
const ProxyBypassRules& rules,
bool bypasses,
const std::set<std::string>& inverted_hosts = std::set<std::string>()) { … }
void ExpectBypassLinkLocal(const ProxyBypassRules& rules, bool bypasses) { … }
void ExpectBypassMisc(
const ProxyBypassRules& rules,
bool bypasses,
const std::set<std::string>& inverted_hosts = std::set<std::string>()) { … }
TEST(ProxyBypassRulesTest, ParseAndMatchBasicHost) { … }
TEST(ProxyBypassRulesTest, ParseAndMatchBasicDomain) { … }
TEST(ProxyBypassRulesTest, ParseAndMatchBasicDomainWithPort) { … }
TEST(ProxyBypassRulesTest, MatchAll) { … }
TEST(ProxyBypassRulesTest, WildcardAtStart) { … }
TEST(ProxyBypassRulesTest, ParseInvalidPort) { … }
TEST(ProxyBypassRulesTest, IPV4Address) { … }
TEST(ProxyBypassRulesTest, IPV4AddressWithPort) { … }
TEST(ProxyBypassRulesTest, IPV6Address) { … }
TEST(ProxyBypassRulesTest, IPV6AddressWithPort) { … }
TEST(ProxyBypassRulesTest, HTTPOnly) { … }
TEST(ProxyBypassRulesTest, HTTPOnlyWithWildcard) { … }
TEST(ProxyBypassRulesTest, DoesNotUseSuffixMatching) { … }
TEST(ProxyBypassRulesTest, MultipleRules) { … }
TEST(ProxyBypassRulesTest, BadInputs) { … }
TEST(ProxyBypassRulesTest, Equals) { … }
TEST(ProxyBypassRulesTest, BypassSimpleHostnames) { … }
TEST(ProxyBypassRulesTest, ParseAndMatchCIDR_IPv4) { … }
TEST(ProxyBypassRulesTest, ParseAndMatchCIDR_IPv6) { … }
TEST(ProxyBypassRulesTest, ParseBracketedIPv6Range) { … }
TEST(ProxyBypassRulesTest, DefaultImplicitRules) { … }
TEST(ProxyBypassRulesTest, NegativeWinLoopback) { … }
TEST(ProxyBypassRulesTest, RemoveImplicitAndAddLocalhost) { … }
TEST(ProxyBypassRulesTest, AddLocalhostThenRemoveImplicit) { … }
TEST(ProxyBypassRulesTest, AddRulesToSubtractImplicit) { … }
TEST(ProxyBypassRulesTest, GetRulesToSubtractImplicit) { … }
TEST(ProxyBypassRulesTest, LoopbackAndLocalCaseInsensitive) { … }
}
}