#include "content/services/auction_worklet/public/mojom/auction_worklet_service.mojom-forward.h"
#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <stdint.h>
#include <list>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "base/time/time.h"
#include "content/browser/interest_group/auction_metrics_recorder.h"
#include "content/browser/interest_group/auction_process_manager.h"
#include "content/browser/interest_group/auction_worklet_manager.h"
#include "content/browser/interest_group/subresource_url_authorizations.h"
#include "content/browser/interest_group/subresource_url_builder.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_renderer_host.h"
#include "content/services/auction_worklet/public/mojom/auction_network_events_handler.mojom.h"
#include "content/services/auction_worklet/public/mojom/auction_shared_storage_host.mojom.h"
#include "content/services/auction_worklet/public/mojom/auction_worklet_service.mojom.h"
#include "content/services/auction_worklet/public/mojom/bidder_worklet.mojom.h"
#include "content/services/auction_worklet/public/mojom/seller_worklet.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/functions.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/mojom/client_security_state.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/interest_group/ad_display_size.h"
#include "third_party/blink/public/common/interest_group/auction_config.h"
#include "url/gurl.h"
#include "url/origin.h"
UnorderedElementsAre;
namespace content {
class ProcessHandleTestPeer { … };
namespace {
const char kAuction1[] = …;
const char kAuction2[] = …;
const char kAuction3[] = …;
const char kAuction4[] = …;
const char kAuction5[] = …;
BundleSubresourceInfo;
constexpr char kBuyer1OriginStr[] = …;
constexpr char kBuyer2OriginStr[] = …;
AuctionWorkletManager::FatalErrorCallback NeverInvokedFatalErrorCallback() { … }
blink::DirectFromSellerSignalsSubresource CreateSubresource(
const GURL& bundle_url) { … }
blink::DirectFromSellerSignals PopulateSubresources() { … }
class FatalLoadErrorHelper { … };
class MockBidderWorklet : public auction_worklet::mojom::BidderWorklet { … };
class MockSellerWorklet : public auction_worklet::mojom::SellerWorklet { … };
class MockAuctionProcessManager
: public AuctionProcessManager,
public auction_worklet::mojom::AuctionWorkletService { … };
class AuctionWorkletManagerTest : public RenderViewHostTestHarness,
public AuctionWorkletManager::Delegate { … };
TEST_F(AuctionWorkletManagerTest, SingleBidderWorklet) { … }
TEST_F(AuctionWorkletManagerTest, SingleSellerWorklet) { … }
TEST_F(AuctionWorkletManagerTest,
SingleBidderWorkletEmptyDirectFromSellerSignals) { … }
TEST_F(AuctionWorkletManagerTest,
SingleSellerWorkletEmptyDirectFromSellerSignals) { … }
TEST_F(AuctionWorkletManagerTest, BidderWorkletAsync) { … }
TEST_F(AuctionWorkletManagerTest, SellerWorkletAsync) { … }
TEST_F(AuctionWorkletManagerTest, ReuseBidderWorklet) { … }
TEST_F(AuctionWorkletManagerTest, ReuseSellerWorklet) { … }
TEST_F(AuctionWorkletManagerTest, DifferentBidderWorklets) { … }
TEST_F(AuctionWorkletManagerTest, BidderWorkletExperimentIDs) { … }
TEST_F(AuctionWorkletManagerTest, BidderWorkletCORSForAdditionalBid) { … }
TEST_F(AuctionWorkletManagerTest, DifferentSellerWorklets) { … }
TEST_F(AuctionWorkletManagerTest, SellerWorkletExperimentIDs) { … }
TEST_F(AuctionWorkletManagerTest, BidderWorkletLoadError) { … }
TEST_F(AuctionWorkletManagerTest, LoadErrorWithoutProcessAssigned) { … }
TEST_F(AuctionWorkletManagerTest, LoadSuccessOrder) { … }
TEST_F(AuctionWorkletManagerTest, SellerWorkletLoadError) { … }
TEST_F(AuctionWorkletManagerTest, BidderWorkletCrash) { … }
TEST_F(AuctionWorkletManagerTest, SellerWorkletCrash) { … }
TEST_F(AuctionWorkletManagerTest, BidderWorkletDeleteOnError) { … }
TEST_F(AuctionWorkletManagerTest, BidderWorkletDeleteOnSuccess) { … }
TEST_F(AuctionWorkletManagerTest, SellerWorkletDeleteOnError) { … }
TEST_F(AuctionWorkletManagerTest, BidderWorkletUrlRequestProtection) { … }
TEST_F(AuctionWorkletManagerTest, SellerWorkletUrlRequestProtection) { … }
TEST(WorkletKeyTest, HashConsistentForEqualKeys) { … }
TEST(WorkletKeyTest, HashIsDifferentForKeysWithDifferentType) { … }
TEST(WorkletKeyTest, HashIsDifferentForKeysWithDifferentScriptUrl) { … }
TEST(WorkletKeyTest, HashIsDifferentForKeysWithDifferentWasmUrl) { … }
TEST(WorkletKeyTest, HashIsDifferentWhenGivenNullOptWasmUrl) { … }
TEST(WorkletKeyTest, HashIsDifferentForKeysWithDifferentSignalsUrl) { … }
TEST(WorkletKeyTest, HashIsDifferentWhenGivenNullOptSignalsUrl) { … }
TEST(WorkletKeyTest, HashIsDifferentForKeysWithDifferentExperiment) { … }
TEST(WorkletKeyTest, HashIsDifferentWhenGivenNullOptExperiment) { … }
TEST(WorkletKeyTest, HashIsDifferentForKeysWithDifferentCORSForAdditionalBid) { … }
TEST(WorkletKeyTest, HashIsSameForDifferentSlotSizeParamWhenNoSignalsUrl) { … }
TEST(WorkletKeyTest, HashIsDifferentForDifferentSlotSizeParamWithSignalsUrl) { … }
TEST(WorkletKeyTest, HashIsDifferentForKeysWithDifferentCoordinator) { … }
TEST(WorkletKeyTest, HashIsDifferentWhenGivenNullOptCoordinator) { … }
TEST_F(AuctionWorkletManagerTest,
DoesNotCrashWhenProcessReadyAfterWorkletDestroyed) { … }
}
}