#include "services/cert_verifier/cert_net_url_loader/cert_net_fetcher_url_loader.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 "mojo/public/cpp/bindings/pending_remote.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/test/embedded_test_server/embedded_test_server.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.h"
#include "net/url_request/url_request_filter.h"
#include "net/url_request/url_request_interceptor.h"
#include "net/url_request/url_request_job.h"
#include "services/cert_verifier/cert_net_url_loader/cert_net_fetcher_test.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
#include "services/network/url_loader.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
IsOk;
namespace cert_verifier {
namespace {
const base::FilePath::CharType kDocRoot[] = …);
const char kMockURL[] = …;
const char kMockSecureDnsHostname[] = …;
void VerifySuccess(const std::string& expected_body,
net::CertNetFetcher::Request* request) { … }
void VerifyFailure(net::Error expected_error,
net::CertNetFetcher::Request* request) { … }
class CertNetFetcherURLLoaderTest : public PlatformTest { … };
class SecureDnsInterceptor : public net::URLRequestInterceptor { … };
class CertNetFetcherURLLoaderTestWithSecureDnsInterceptor
: public CertNetFetcherURLLoaderTest,
public net::WithTaskEnvironment { … };
[[nodiscard]] std::unique_ptr<net::CertNetFetcher::Request> StartRequest(
net::CertNetFetcher* fetcher,
const GURL& url) { … }
TEST_F(CertNetFetcherURLLoaderTest, ParallelFetchNoDuplicates) { … }
TEST_F(CertNetFetcherURLLoaderTest, ContentTypeDoesntMatter) { … }
TEST_F(CertNetFetcherURLLoaderTest, HttpStatusCode) { … }
TEST_F(CertNetFetcherURLLoaderTest, ContentDisposition) { … }
TEST_F(CertNetFetcherURLLoaderTest, Cache) { … }
TEST_F(CertNetFetcherURLLoaderTest, TooLarge) { … }
TEST_F(CertNetFetcherURLLoaderTest, Hang) { … }
TEST_F(CertNetFetcherURLLoaderTest, Gzip) { … }
TEST_F(CertNetFetcherURLLoaderTest, HttpsNotAllowed) { … }
TEST_F(CertNetFetcherURLLoaderTest, RedirectToHttpsNotAllowed) { … }
TEST_F(CertNetFetcherURLLoaderTest, CancelHttpsNotAllowed) { … }
TEST_F(CertNetFetcherURLLoaderTest,
ReconnectsAfterURLLoaderFactoryDisconnection) { … }
TEST_F(CertNetFetcherURLLoaderTest, CancelBeforeRunningMessageLoop) { … }
TEST_F(CertNetFetcherURLLoaderTest, CancelAfterRunningMessageLoop) { … }
TEST_F(CertNetFetcherURLLoaderTest, ParallelFetchDuplicates) { … }
TEST_F(CertNetFetcherURLLoaderTest, CancelThenStart) { … }
TEST_F(CertNetFetcherURLLoaderTest, CancelAll) { … }
TEST_F(CertNetFetcherURLLoaderTest, RequestsAfterShutdown) { … }
TEST_F(CertNetFetcherURLLoaderTest,
RequestAfterShutdownAndNetworkThreadStopped) { … }
TEST_F(CertNetFetcherURLLoaderTest, ShutdownCancelsRequests) { … }
TEST_F(CertNetFetcherURLLoaderTestWithSecureDnsInterceptor, SecureDnsDisabled) { … }
}
}