chromium/content/browser/web_package/signed_exchange_cert_fetcher_unittest.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/web_package/signed_exchange_cert_fetcher.h"

#include <optional>
#include <string_view>

#include "base/base64.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/test/task_environment.h"
#include "components/cbor/values.h"
#include "components/cbor/writer.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/data_pipe_utils.h"
#include "net/base/isolation_info.h"
#include "net/base/load_flags.h"
#include "net/cert/x509_util.h"
#include "net/test/cert_test_util.h"
#include "net/test/test_data_directory.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/fetch_api.mojom-shared.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/loader/url_loader_throttle.h"
#include "url/origin.h"

namespace content {

namespace {

class DeferringURLLoaderThrottle final : public blink::URLLoaderThrottle {};

class MockURLLoader final : public network::mojom::URLLoader {};

class URLLoaderFactoryForMockLoader final
    : public network::mojom::URLLoaderFactory {};

void ForwardCertificateCallback(
    bool* called,
    SignedExchangeLoadResult* out_result,
    std::unique_ptr<SignedExchangeCertificateChain>* out_cert,
    SignedExchangeLoadResult result,
    std::unique_ptr<SignedExchangeCertificateChain> cert_chain,
    net::IPAddress cert_server_ip_address) {}

class SignedExchangeCertFetcherTest : public testing::Test {};

}  // namespace

TEST_F(SignedExchangeCertFetcherTest, Simple) {}

TEST_F(SignedExchangeCertFetcherTest, MultipleChunked) {}

TEST_F(SignedExchangeCertFetcherTest, ForceFetchAndFail) {}

TEST_F(SignedExchangeCertFetcherTest, MaxCertSize_Exceeds) {}

TEST_F(SignedExchangeCertFetcherTest, MaxCertSize_SameSize) {}

TEST_F(SignedExchangeCertFetcherTest, MaxCertSize_MultipleChunked) {}

TEST_F(SignedExchangeCertFetcherTest, MaxCertSize_ContentLengthCheck) {}

TEST_F(SignedExchangeCertFetcherTest, Abort_Redirect) {}

TEST_F(SignedExchangeCertFetcherTest, Abort_404) {}

TEST_F(SignedExchangeCertFetcherTest, WrongMimeType) {}

TEST_F(SignedExchangeCertFetcherTest, Invalid_CertData) {}

TEST_F(SignedExchangeCertFetcherTest, Invalid_CertMessage) {}

TEST_F(SignedExchangeCertFetcherTest, Throttle_Simple) {}

TEST_F(SignedExchangeCertFetcherTest, Throttle_AbortsOnRequest) {}

TEST_F(SignedExchangeCertFetcherTest, Throttle_AbortsOnRedirect) {}

TEST_F(SignedExchangeCertFetcherTest, Throttle_AbortsOnResponse) {}

TEST_F(SignedExchangeCertFetcherTest, DeleteFetcher_BeforeReceiveResponse) {}

TEST_F(SignedExchangeCertFetcherTest, DeleteFetcher_BeforeResponseBody) {}

TEST_F(SignedExchangeCertFetcherTest, DeleteFetcher_WhileReceivingBody) {}

TEST_F(SignedExchangeCertFetcherTest, DeleteFetcher_AfterReceivingBody) {}

TEST_F(SignedExchangeCertFetcherTest, CloseClientPipe_BeforeReceiveResponse) {}

TEST_F(SignedExchangeCertFetcherTest, CloseClientPipe_BeforeResponseBody) {}

TEST_F(SignedExchangeCertFetcherTest, CloseClientPipe_WhileReceivingBody) {}

TEST_F(SignedExchangeCertFetcherTest, CloseClientPipe_AfterReceivingBody) {}

TEST_F(SignedExchangeCertFetcherTest, DataURL) {}

TEST_F(SignedExchangeCertFetcherTest, DataURLWithWrongMimeType) {}

}  // namespace content