#include <memory>
#include <vector>
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "net/base/address_family.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/dns/mock_host_resolver.h"
#include "net/log/net_log.h"
#include "net/log/net_log_event_type.h"
#include "net/log/test_net_log.h"
#include "net/log/test_net_log_util.h"
#include "net/proxy_resolution/dhcp_pac_file_fetcher.h"
#include "net/proxy_resolution/mock_pac_file_fetcher.h"
#include "net/proxy_resolution/pac_file_decider.h"
#include "net/proxy_resolution/pac_file_fetcher.h"
#include "net/proxy_resolution/proxy_config.h"
#include "net/proxy_resolution/proxy_resolver.h"
#include "net/test/gtest_util.h"
#include "net/test/test_with_task_environment.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 "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
IsError;
IsOk;
namespace net {
namespace {
enum Error { … };
class Rules { … };
class RuleBasedPacFileFetcher : public PacFileFetcher { … };
class MockDhcpPacFileFetcher : public DhcpPacFileFetcher { … };
MockDhcpPacFileFetcher::MockDhcpPacFileFetcher() = default;
MockDhcpPacFileFetcher::~MockDhcpPacFileFetcher() = default;
int MockDhcpPacFileFetcher::Fetch(
std::u16string* utf16_text,
CompletionOnceCallback callback,
const NetLogWithSource& net_log,
const NetworkTrafficAnnotationTag traffic_annotation) { … }
void MockDhcpPacFileFetcher::Cancel() { … }
void MockDhcpPacFileFetcher::OnShutdown() { … }
const GURL& MockDhcpPacFileFetcher::GetPacURL() const { … }
void MockDhcpPacFileFetcher::SetPacURL(const GURL& url) { … }
void MockDhcpPacFileFetcher::CompleteRequests(int result,
const std::u16string& script) { … }
TEST(PacFileDeciderTest, CustomPacSucceeds) { … }
TEST(PacFileDeciderTest, CustomPacFails1) { … }
TEST(PacFileDeciderTest, CustomPacFails2) { … }
TEST(PacFileDeciderTest, HasNullPacFileFetcher) { … }
TEST(PacFileDeciderTest, AutodetectSuccess) { … }
class PacFileDeciderQuickCheckTest : public ::testing::Test,
public WithTaskEnvironment { … };
TEST_F(PacFileDeciderQuickCheckTest, SyncSuccess) { … }
TEST_F(PacFileDeciderQuickCheckTest, AsyncSuccess) { … }
TEST_F(PacFileDeciderQuickCheckTest, AsyncFail) { … }
TEST_F(PacFileDeciderQuickCheckTest, AsyncTimeout) { … }
TEST_F(PacFileDeciderQuickCheckTest, QuickCheckInhibitsDhcp) { … }
TEST_F(PacFileDeciderQuickCheckTest, QuickCheckDisabled) { … }
TEST_F(PacFileDeciderQuickCheckTest, ExplicitPacUrl) { … }
TEST_F(PacFileDeciderQuickCheckTest, ShutdownDuringResolve) { … }
TEST_F(PacFileDeciderQuickCheckTest, CancelPartway) { … }
TEST(PacFileDeciderTest, AutodetectFailCustomSuccess1) { … }
TEST(PacFileDeciderTest, AutodetectFailCustomSuccess2) { … }
TEST(PacFileDeciderTest, AutodetectFailCustomFails1) { … }
TEST(PacFileDeciderTest, AutodetectFailCustomFails2) { … }
TEST(PacFileDeciderTest, CustomPacFails1_WithPositiveDelay) { … }
TEST(PacFileDeciderTest, CustomPacFails1_WithNegativeDelay) { … }
class SynchronousSuccessDhcpFetcher : public DhcpPacFileFetcher { … };
TEST(PacFileDeciderTest, AutodetectDhcpSuccess) { … }
TEST(PacFileDeciderTest, AutodetectDhcpFailParse) { … }
class AsyncFailDhcpFetcher final : public DhcpPacFileFetcher { … };
TEST(PacFileDeciderTest, DhcpCancelledByDestructor) { … }
}
}