chromium/content/services/auction_worklet/public/cpp/auction_downloader_unittest.cc

// Copyright 2021 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/services/auction_worklet/public/cpp/auction_downloader.h"

#include <cstddef>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "content/services/auction_worklet/worklet_test_util.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
#include "services/network/public/cpp/devtools_observer_util.h"
#include "services/network/public/cpp/url_loader_completion_status.h"
#include "services/network/public/mojom/url_response_head.mojom-forward.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace auction_worklet {
namespace {

const char kAsciiResponseBody[] =;
const char kUtf8ResponseBody[] =;
const char kNonUtf8ResponseBody[] =;

const char kAsciiCharset[] =;
const char kUtf8Charset[] =;

class AuctionDownloaderTest
    : public testing::TestWithParam<AuctionDownloader::DownloadMode> {};

TEST_P(AuctionDownloaderTest, NetworkError) {}

TEST_P(AuctionDownloaderTest, NetworkErrorTruncatesUrl) {}

// HTTP 404 responses are treated as failures.
TEST_P(AuctionDownloaderTest, HttpError) {}

TEST_P(AuctionDownloaderTest, Timeout) {}

TEST_P(AuctionDownloaderTest, AllowAdAuction) {}

TEST_P(AuctionDownloaderTest, PassesHeaders) {}

TEST_P(AuctionDownloaderTest, ResponseStartedCallback) {}

// Redirect responses are treated as failures.
TEST_P(AuctionDownloaderTest, Redirect) {}

TEST_P(AuctionDownloaderTest, Success) {}

TEST_P(AuctionDownloaderTest, SuccessWithPostBody) {}

// Test `AuctionDownloader::MimeType` values work as expected.
TEST_P(AuctionDownloaderTest, MimeType) {}

TEST_P(AuctionDownloaderTest, MimeTypeWasm) {}

TEST_P(AuctionDownloaderTest, MimeTypeTrustedSignals) {}

// Test all Javascript and JSON MIME type strings.
TEST_P(AuctionDownloaderTest, MimeTypeVariants) {}

TEST_P(AuctionDownloaderTest, Charset) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace
}  // namespace auction_worklet