#include "content/browser/interest_group/interest_group_auction_reporter.h"
#include <cstdint>
#include <limits>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "content/browser/fenced_frame/fenced_frame_reporter.h"
#include "content/browser/interest_group/ad_auction_page_data.h"
#include "content/browser/interest_group/auction_worklet_manager.h"
#include "content/browser/interest_group/header_direct_from_seller_signals.h"
#include "content/browser/interest_group/interest_group_k_anonymity_manager.h"
#include "content/browser/interest_group/interest_group_manager_impl.h"
#include "content/browser/interest_group/interest_group_pa_report_util.h"
#include "content/browser/interest_group/mock_auction_process_manager.h"
#include "content/browser/interest_group/subresource_url_builder.h"
#include "content/browser/interest_group/test_interest_group_manager_impl.h"
#include "content/browser/interest_group/test_interest_group_private_aggregation_manager.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/public/browser/page_user_data.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/test_utils.h"
#include "content/services/auction_worklet/public/mojom/private_aggregation_request.mojom.h"
#include "content/services/auction_worklet/public/mojom/real_time_reporting.mojom-forward.h"
#include "content/test/test_content_browser_client.h"
#include "mojo/public/cpp/system/functions.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/client_security_state.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/features.h"
#include "third_party/blink/public/common/fenced_frame/redacted_fenced_frame_config.h"
#include "third_party/blink/public/common/interest_group/auction_config.h"
#include "third_party/blink/public/common/interest_group/interest_group.h"
#include "third_party/blink/public/common/interest_group/test_interest_group_builder.h"
#include "third_party/blink/public/mojom/aggregation_service/aggregatable_report.mojom.h"
#include "third_party/blink/public/mojom/private_aggregation/private_aggregation_host.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace content {
namespace {
InterestGroupAuctionReporter::SellerWinningBidInfo CreateSellerWinningBidInfo(
blink::AuctionConfig* auction_config) { … }
template <typename... Ts>
auto ElementsAreRequests(Ts&... requests) { … }
template <typename... Ts>
auto ElementsAreContributions(Ts&... requests) { … }
class EventReportingAttestationBrowserClient : public TestContentBrowserClient { … };
class InterestGroupAuctionReporterTest
: public RenderViewHostTestHarness,
public AuctionWorkletManager::Delegate { … };
TEST_F(InterestGroupAuctionReporterTest, SingleSellerNoReports) { … }
TEST_F(InterestGroupAuctionReporterTest, ComponentAuctionNoReports) { … }
TEST_F(InterestGroupAuctionReporterTest, SingleSellerReports) { … }
TEST_F(InterestGroupAuctionReporterTest,
SingleSellerReportsWhenFrameTreeNodeIsDestroyed) { … }
TEST_F(InterestGroupAuctionReporterTest, ComponentAuctionReports) { … }
TEST_F(InterestGroupAuctionReporterTest, ComponentAuctionErrors) { … }
TEST_F(InterestGroupAuctionReporterTest, SingleSellerReportsLateNavigation) { … }
TEST_F(InterestGroupAuctionReporterTest,
ComponentAuctionReportsLateNavigation) { … }
TEST_F(InterestGroupAuctionReporterTest, SingleSellerSellerCrash) { … }
TEST_F(InterestGroupAuctionReporterTest, SingleSellerBuyerCrash) { … }
TEST_F(InterestGroupAuctionReporterTest, ComponentAuctionTopLevelSellerCrash) { … }
TEST_F(InterestGroupAuctionReporterTest, ComponentAuctionComponentSellerCrash) { … }
TEST_F(InterestGroupAuctionReporterTest, SingleSellerBadSellerReportUrl) { … }
TEST_F(InterestGroupAuctionReporterTest, ComponentAuctionBadSellerReportUrl) { … }
TEST_F(InterestGroupAuctionReporterTest, SingleSellerBadBidderReportUrl) { … }
TEST_F(InterestGroupAuctionReporterTest, SingleSellerReportBeaconMap) { … }
TEST_F(InterestGroupAuctionReporterTest, ComponentAuctionReportBeaconMap) { … }
TEST_F(InterestGroupAuctionReporterTest,
ComponentAuctionReportBeaconMapBadSellerUrl) { … }
TEST_F(InterestGroupAuctionReporterTest,
ComponentAuctionReportBeaconMapBadBidderUrl) { … }
TEST_F(InterestGroupAuctionReporterTest, DebugReportsEarlyNavigation) { … }
TEST_F(InterestGroupAuctionReporterTest, DebugReportsLateNavigation) { … }
TEST_F(InterestGroupAuctionReporterTest, RecordWinAndBids) { … }
TEST_F(InterestGroupAuctionReporterTest, RecordWinAndBidsLateNavigation) { … }
TEST_F(InterestGroupAuctionReporterTest, RecordKAnonKeysToJoin) { … }
TEST_F(InterestGroupAuctionReporterTest, RecordKAnonKeysToJoinLateNavigation) { … }
TEST_F(InterestGroupAuctionReporterTest, PrivateAggregationRequests) { … }
TEST_F(InterestGroupAuctionReporterTest,
PrivateAggregationRequestsLateNavigation) { … }
TEST_F(InterestGroupAuctionReporterTest,
PrivateAggregationRequestsNonReserved) { … }
TEST_F(InterestGroupAuctionReporterTest,
PrivateAggregationRequestsNonReservedLateNavigation) { … }
TEST_F(InterestGroupAuctionReporterTest, RealTimeReporting) { … }
TEST_F(InterestGroupAuctionReporterTest, RealTimeReportingLateNavigation) { … }
TEST_F(InterestGroupAuctionReporterTest,
PrivateAggregationLoggingForUseCounter) { … }
TEST_F(InterestGroupAuctionReporterTest,
PrivateAggregationLoggingForUseCounterNotUsed) { … }
TEST_F(InterestGroupAuctionReporterTest,
DestroyedDuringSellerReportResultBeforeNavigation) { … }
TEST_F(InterestGroupAuctionReporterTest, DestroyedDuringSellerReportResult) { … }
TEST_F(InterestGroupAuctionReporterTest,
DestroyedDuringComponentSellerReportResult) { … }
TEST_F(InterestGroupAuctionReporterTest, DestroyedDuringReportWin) { … }
TEST_F(InterestGroupAuctionReporterTest, NoNavigation) { … }
TEST_F(InterestGroupAuctionReporterTest, MultipleNavigations) { … }
class InterestGroupAuctionReporterPrivateAggregationDisabledTest
: public InterestGroupAuctionReporterTest { … };
TEST_F(InterestGroupAuctionReporterPrivateAggregationDisabledTest,
PrivateAggregationRequestsNonReserved) { … }
class InterestGroupAuctionReporterPrivateAggregationFledgeExtensionDisabledTest
: public InterestGroupAuctionReporterTest { … };
TEST_F(
InterestGroupAuctionReporterPrivateAggregationFledgeExtensionDisabledTest,
PrivateAggregationRequestsNonReserved) { … }
TEST(InterestGroupAuctionReporterStochasticRounding, MatchesTable) { … }
TEST(InterestGroupAuctionReporterStochasticRounding, PassesNaN) { … }
TEST(InterestGroupAuctionReporterStochasticRounding, IsNonDeterministic) { … }
TEST(InterestGroupAuctionReporterStochasticRounding, RoundsUpAndDown) { … }
TEST(InterestGroupAuctionReporterStochasticRounding, HandlesOverflow) { … }
TEST(InterestGroupAuctionReporterStochasticRounding, ApproximatesTrueSum) { … }
class InterestGroupAuctionReporterAdMacroReportingEnabledTest
: public InterestGroupAuctionReporterTest { … };
TEST_F(InterestGroupAuctionReporterAdMacroReportingEnabledTest,
SingleSellerReportMacros) { … }
TEST_F(InterestGroupAuctionReporterAdMacroReportingEnabledTest,
ComponentAuctionReportMacros) { … }
}
}