#include "content/services/auction_worklet/worklet_test_util.h"
#include <memory>
#include <optional>
#include <string>
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/to_string.h"
#include "base/synchronization/waitable_event.h"
#include "content/services/auction_worklet/auction_v8_helper.h"
#include "content/services/auction_worklet/public/cpp/auction_downloader.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/http/http_util.h"
#include "services/network/public/cpp/url_loader_completion_status.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
namespace auction_worklet {
const char kJavascriptMimeType[] = …;
const char kJsonMimeType[] = …;
const char kWasmMimeType[] = …;
const char kAdAuctionTrustedSignalsMimeType[] = …;
const char kAllowFledgeHeader[] = …;
void AddResponse(network::TestURLLoaderFactory* url_loader_factory,
const GURL& url,
std::optional<std::string> mime_type,
std::optional<std::string> charset,
const std::string content,
std::optional<std::string> headers,
net::HttpStatusCode http_status,
network::TestURLLoaderFactory::Redirects redirects) { … }
void AddJavascriptResponse(
network::TestURLLoaderFactory* url_loader_factory,
const GURL& url,
const std::string& content,
base::optional_ref<const std::string> extra_headers) { … }
void AddJsonResponse(network::TestURLLoaderFactory* url_loader_factory,
const GURL& url,
const std::string content) { … }
void AddVersionedJsonResponse(network::TestURLLoaderFactory* url_loader_factory,
const GURL& url,
const std::string content,
uint32_t data_version) { … }
void AddBidderJsonResponse(
network::TestURLLoaderFactory* url_loader_factory,
const GURL& url,
const std::string content,
std::optional<uint32_t> data_version,
const std::optional<std::string>& format_version_string) { … }
base::WaitableEvent* WedgeV8Thread(AuctionV8Helper* v8_helper) { … }
bool TestAuctionSharedStorageHost::Request::operator==(
const Request& rhs) const { … }
TestAuctionSharedStorageHost::TestAuctionSharedStorageHost() = default;
TestAuctionSharedStorageHost::~TestAuctionSharedStorageHost() = default;
void TestAuctionSharedStorageHost::Set(
const std::u16string& key,
const std::u16string& value,
bool ignore_if_present,
mojom::AuctionWorkletFunction source_auction_worklet_function) { … }
void TestAuctionSharedStorageHost::Append(
const std::u16string& key,
const std::u16string& value,
mojom::AuctionWorkletFunction source_auction_worklet_function) { … }
void TestAuctionSharedStorageHost::Delete(
const std::u16string& key,
mojom::AuctionWorkletFunction source_auction_worklet_function) { … }
void TestAuctionSharedStorageHost::Clear(
mojom::AuctionWorkletFunction source_auction_worklet_function) { … }
void TestAuctionSharedStorageHost::ClearObservedRequests() { … }
TestAuctionNetworkEventsHandler::TestAuctionNetworkEventsHandler() = default;
TestAuctionNetworkEventsHandler::~TestAuctionNetworkEventsHandler() = default;
void TestAuctionNetworkEventsHandler::OnNetworkSendRequest(
const ::network::ResourceRequest& request,
::base::TimeTicks timestamp) { … }
void TestAuctionNetworkEventsHandler::OnNetworkResponseReceived(
const std::string& request_id,
const std::string& loader_id,
const ::GURL& request_url,
::network::mojom::URLResponseHeadPtr headers) { … }
void TestAuctionNetworkEventsHandler::OnNetworkRequestComplete(
const std::string& request_id,
const ::network::URLLoaderCompletionStatus& status) { … }
void TestAuctionNetworkEventsHandler::Clone(
mojo::PendingReceiver<auction_worklet::mojom::AuctionNetworkEventsHandler>
receiver) { … }
mojo::PendingRemote<auction_worklet::mojom::AuctionNetworkEventsHandler>
TestAuctionNetworkEventsHandler::CreateRemote() { … }
const std::vector<std::string>&
TestAuctionNetworkEventsHandler::GetObservedRequests() { … }
}