#include "net/cert_net/cert_net_fetcher_url_request.h"
#include <memory>
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/message_loop/message_pump_type.h"
#include "base/run_loop.h"
#include "base/synchronization/lock.h"
#include "net/cert/cert_net_fetcher.h"
#include "net/cert/mock_cert_verifier.h"
#include "net/cert/multi_log_ct_verifier.h"
#include "net/dns/mock_host_resolver.h"
#include "net/dns/public/secure_dns_policy.h"
#include "net/http/http_server_properties.h"
#include "net/http/transport_security_state.h"
#include "net/proxy_resolution/configured_proxy_resolution_service.h"
#include "net/quic/quic_context.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/gtest_util.h"
#include "net/test/test_with_task_environment.h"
#include "net/test/url_request/url_request_hanging_read_job.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_filter.h"
#include "net/url_request/url_request_interceptor.h"
#include "net/url_request/url_request_job_factory.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
IsOk;
namespace net {
namespace {
const base::FilePath::CharType kDocRoot[] = …);
const char kMockSecureDnsHostname[] = …;
void VerifySuccess(const std::string& expected_body,
CertNetFetcher::Request* request) { … }
void VerifyFailure(Error expected_error, CertNetFetcher::Request* request) { … }
struct NetworkThreadState { … };
class CertNetFetcherURLRequestTest : public PlatformTest { … };
class CertNetFetcherURLRequestTestWithHangingReadHandler
: public CertNetFetcherURLRequestTest,
public WithTaskEnvironment { … };
class SecureDnsInterceptor : public net::URLRequestInterceptor { … };
class CertNetFetcherURLRequestTestWithSecureDnsInterceptor
: public CertNetFetcherURLRequestTest,
public WithTaskEnvironment { … };
[[nodiscard]] std::unique_ptr<CertNetFetcher::Request> StartRequest(
CertNetFetcher* fetcher,
const GURL& url) { … }
TEST_F(CertNetFetcherURLRequestTest, ParallelFetchNoDuplicates) { … }
TEST_F(CertNetFetcherURLRequestTest, ContentTypeDoesntMatter) { … }
TEST_F(CertNetFetcherURLRequestTest, HttpStatusCode) { … }
TEST_F(CertNetFetcherURLRequestTest, ContentDisposition) { … }
TEST_F(CertNetFetcherURLRequestTest, Cache) { … }
TEST_F(CertNetFetcherURLRequestTest, TooLarge) { … }
TEST_F(CertNetFetcherURLRequestTest, Hang) { … }
TEST_F(CertNetFetcherURLRequestTest, Gzip) { … }
TEST_F(CertNetFetcherURLRequestTest, HttpsNotAllowed) { … }
TEST_F(CertNetFetcherURLRequestTest, RedirectToHttpsNotAllowed) { … }
TEST_F(CertNetFetcherURLRequestTest, CancelHttpsNotAllowed) { … }
TEST_F(CertNetFetcherURLRequestTest, CancelBeforeRunningMessageLoop) { … }
TEST_F(CertNetFetcherURLRequestTest, CancelAfterRunningMessageLoop) { … }
TEST_F(CertNetFetcherURLRequestTest, ParallelFetchDuplicates) { … }
TEST_F(CertNetFetcherURLRequestTest, CancelThenStart) { … }
TEST_F(CertNetFetcherURLRequestTest, CancelAll) { … }
TEST_F(CertNetFetcherURLRequestTest, RequestsAfterShutdown) { … }
TEST_F(CertNetFetcherURLRequestTest,
RequestAfterShutdownAndNetworkThreadStopped) { … }
TEST_F(CertNetFetcherURLRequestTestWithHangingReadHandler,
ShutdownCancelsRequests) { … }
TEST_F(CertNetFetcherURLRequestTestWithSecureDnsInterceptor,
SecureDnsDisabled) { … }
}
}