#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/proxy_resolution/multi_threaded_proxy_resolver.h"
#include <memory>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread_checker_impl.h"
#include "base/time/time.h"
#include "net/base/net_errors.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/schemeful_site.h"
#include "net/base/test_completion_callback.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_with_source.h"
#include "net/log/test_net_log.h"
#include "net/log/test_net_log_util.h"
#include "net/proxy_resolution/mock_proxy_resolver.h"
#include "net/proxy_resolution/proxy_info.h"
#include "net/proxy_resolution/proxy_resolver_factory.h"
#include "net/test/gtest_util.h"
#include "net/test/test_with_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
IsError;
IsOk;
ASCIIToUTF16;
namespace net {
namespace {
class MockProxyResolver : public ProxyResolver { … };
class BlockableProxyResolver : public MockProxyResolver { … };
class BlockableProxyResolverFactory : public ProxyResolverFactory { … };
class SingleShotMultiThreadedProxyResolverFactory
: public MultiThreadedProxyResolverFactory { … };
class MultiThreadedProxyResolverTest : public TestWithTaskEnvironment { … };
TEST_F(MultiThreadedProxyResolverTest, SingleThread_Basic) { … }
TEST_F(MultiThreadedProxyResolverTest,
SingleThread_UpdatesNetLogWithThreadWait) { … }
TEST_F(MultiThreadedProxyResolverTest, SingleThread_CancelRequest) { … }
TEST_F(MultiThreadedProxyResolverTest,
SingleThread_WithNetworkAnonymizationKey) { … }
TEST_F(MultiThreadedProxyResolverTest, SingleThread_CancelRequestByDeleting) { … }
TEST_F(MultiThreadedProxyResolverTest, ThreeThreads_Basic) { … }
TEST_F(MultiThreadedProxyResolverTest, OneThreadBlocked) { … }
class FailingProxyResolverFactory : public ProxyResolverFactory { … };
TEST_F(MultiThreadedProxyResolverTest, ProxyResolverFactoryError) { … }
void Fail(int error) { … }
TEST_F(MultiThreadedProxyResolverTest, CancelCreate) { … }
void DeleteRequest(CompletionOnceCallback callback,
std::unique_ptr<ProxyResolverFactory::Request>* request,
int result) { … }
TEST_F(MultiThreadedProxyResolverTest, DeleteRequestInFactoryCallback) { … }
TEST_F(MultiThreadedProxyResolverTest, DestroyFactoryWithRequestsInProgress) { … }
}
}