#include "content/browser/interest_group/auction_metrics_recorder.h"
#include <stdint.h>
#include <optional>
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/gtest_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/browser/interest_group/additional_bid_result.h"
#include "content/browser/interest_group/auction_worklet_manager.h"
#include "content/public/browser/auction_result.h"
#include "content/services/auction_worklet/public/mojom/bidder_worklet.mojom-shared.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace content {
namespace {
UkmEntry;
class AuctionMetricsRecorderTest : public testing::Test { … };
TEST_F(AuctionMetricsRecorderTest, ResultAndEndToEndLatencyInMillis) { … }
TEST_F(AuctionMetricsRecorderTest, CrashOnRepeatedOnAuctionEnd) { … }
TEST_F(AuctionMetricsRecorderTest, MostMethodsCrashAfterOnAuctionEnd) { … }
TEST_F(AuctionMetricsRecorderTest, NoLoadInterestGroupPhaseLatencyAndEndTime) { … }
TEST_F(AuctionMetricsRecorderTest, LoadInterestGroupPhaseLatencyAndEndTime) { … }
TEST_F(AuctionMetricsRecorderTest,
WorkletCreationPhaseMetricsHaveNoValuesForNoWorkletsCreated) { … }
TEST_F(AuctionMetricsRecorderTest, WorkletCreationPhaseMetricsWithOneRecord) { … }
TEST_F(AuctionMetricsRecorderTest, WorkletCreationPhaseMetricsWithTwoRecords) { … }
TEST_F(AuctionMetricsRecorderTest, NumInterestGroups) { … }
TEST_F(AuctionMetricsRecorderTest, NumOwnersWithInterestGroups) { … }
TEST_F(AuctionMetricsRecorderTest, NumOwnersWithoutInterestGroups) { … }
TEST_F(AuctionMetricsRecorderTest, NumSellersWithBidders) { … }
TEST_F(AuctionMetricsRecorderTest,
NumNegativeInterestGroupsHasNoValueIfNeverRecorded) { … }
TEST_F(AuctionMetricsRecorderTest, NumNegativeInterestGroups) { … }
TEST_F(AuctionMetricsRecorderTest, NumDistinctOwnersWithInterestGroupsName) { … }
TEST_F(AuctionMetricsRecorderTest, NumBidderWorklets) { … }
TEST_F(AuctionMetricsRecorderTest, NumBidsAbortedByBuyerCumulativeTimeout) { … }
TEST_F(AuctionMetricsRecorderTest, NumBidsAbortedByBidderWorkletFatalError) { … }
TEST_F(AuctionMetricsRecorderTest, NumBidsFilteredDuringInterestGroupLoad) { … }
TEST_F(AuctionMetricsRecorderTest, NumBidsFilteredDuringReprioritization) { … }
TEST_F(AuctionMetricsRecorderTest, NumBidsFilteredByPerBuyerLimits) { … }
TEST_F(AuctionMetricsRecorderTest, NumAdditionalBidsSentForScoring) { … }
TEST_F(AuctionMetricsRecorderTest, NumAdditionalBidsNegativeTargeted) { … }
TEST_F(AuctionMetricsRecorderTest,
SetNumAdditionalBidsRejectedDueToInvalidBase64) { … }
TEST_F(AuctionMetricsRecorderTest,
NumAdditionalBidsRejectedDueToSignedBidJsonParseError) { … }
TEST_F(AuctionMetricsRecorderTest,
NumAdditionalBidsRejectedDueToSignedBidDecodeError) { … }
TEST_F(AuctionMetricsRecorderTest,
NumAdditionalBidsRejectedDueToJsonParseError) { … }
TEST_F(AuctionMetricsRecorderTest, NumAdditionalBidsRejectedDueToDecodeError) { … }
TEST_F(AuctionMetricsRecorderTest,
NumAdditionalBidsRejectedDueToBuyerNotAllowed) { … }
TEST_F(AuctionMetricsRecorderTest,
NumAdditionalBidsRejectedDueToCurrencyMismatch) { … }
TEST_F(AuctionMetricsRecorderTest, AdditionalBidsDecodeLatency) { … }
TEST_F(AuctionMetricsRecorderTest,
RecordNegativeInterestGroupIgnoredDueToInvalidSignature) { … }
TEST_F(AuctionMetricsRecorderTest,
RecordNegativeInterestGroupIgnoredDueToJoiningOriginMismatch) { … }
TEST_F(AuctionMetricsRecorderTest, KAnonymityBidMode) { … }
TEST_F(AuctionMetricsRecorderTest, NumConfigPromises) { … }
TEST_F(AuctionMetricsRecorderTest, OnConfigPromisesResolvedNeverCalled) { … }
TEST_F(AuctionMetricsRecorderTest, OnConfigPromisesResolvedCalledOnce) { … }
TEST_F(AuctionMetricsRecorderTest, OnConfigPromisesResolvedCalledTwice) { … }
TEST_F(AuctionMetricsRecorderTest, NumInterestGroupsWithNoBids) { … }
TEST_F(AuctionMetricsRecorderTest, NumInterestGroupsWithOnlyNonKAnonBid) { … }
TEST_F(AuctionMetricsRecorderTest,
NumInterestGroupsWithSameBidForKAnonAndNonKAnon) { … }
TEST_F(AuctionMetricsRecorderTest,
NumInterestGroupsWithSeparateBidsForKAnonAndNonKAnon) { … }
TEST_F(AuctionMetricsRecorderTest, NumInterestGroupsWithOtherMultiBid) { … }
TEST_F(AuctionMetricsRecorderTest,
ComponentAuctionLatencyMetricsHaveNoValuesForSingleSellerAuctions) { … }
TEST_F(AuctionMetricsRecorderTest, ComponentAuctionLatencyWithOneRecord) { … }
TEST_F(AuctionMetricsRecorderTest, ComponentAuctionLatencyWithTwoRecords) { … }
TEST_F(AuctionMetricsRecorderTest,
ComponentAuctionLatencyIgnoresNegativeValues) { … }
TEST_F(AuctionMetricsRecorderTest,
BidForOneInterestGroupLatencyMetricsHaveNoValuesForNoGenerateBids) { … }
TEST_F(AuctionMetricsRecorderTest, BidForOneInterestGroupLatencyWithOneRecord) { … }
TEST_F(AuctionMetricsRecorderTest,
BidForOneInterestGroupLatencyWithTwoRecords) { … }
TEST_F(AuctionMetricsRecorderTest,
BidForOneInterestGroupLatencyIgnoresNegativeValues) { … }
TEST_F(AuctionMetricsRecorderTest,
GenerateSingleBidLatencyMetricsHaveNoValuesForNoGenerateBids) { … }
TEST_F(AuctionMetricsRecorderTest, GenerateSingleBidLatencyWithOneRecord) { … }
TEST_F(AuctionMetricsRecorderTest, GenerateSingleBidLatencyWithTwoRecords) { … }
TEST_F(AuctionMetricsRecorderTest,
GenerateSingleBidLatencyIgnoresNegativeValues) { … }
TEST_F(AuctionMetricsRecorderTest,
GenerateBidDependencyLatencyMetricsHaveNoValuesForNoGenerateBids) { … }
TEST_F(AuctionMetricsRecorderTest,
GenerateBidDependencyLatencyMetricsHaveNoValuesForNullOptLatencies) { … }
TEST_F(AuctionMetricsRecorderTest,
GenerateBidDependencyLatencyMetricsWithOneRecord) { … }
TEST_F(AuctionMetricsRecorderTest,
GenerateBidDependencyLatencyMetricsWithTwoRecords) { … }
TEST_F(AuctionMetricsRecorderTest,
GenerateBidDependencyLatencyMetricsIgnoresNegativeValues) { … }
TEST_F(AuctionMetricsRecorderTest,
GenerateBidCriticalPathMetricsHasNoValuesWhenNoneAreRecorded) { … }
TEST_F(AuctionMetricsRecorderTest,
GenerateBidCriticalPathMetricsRecordedManyTimes) { … }
TEST_F(AuctionMetricsRecorderTest, GenerateBidCriticalPathMetricsComputeMean) { … }
TEST_F(AuctionMetricsRecorderTest,
GenerateBidCriticalPathMetricsIgnoreNegativeValues) { … }
TEST_F(AuctionMetricsRecorderTest,
GenerateBidPhaseMetricsHaveNoValuesForNoGenerateBids) { … }
TEST_F(AuctionMetricsRecorderTest, GenerateBidPhaseMetricsWithOneRecord) { … }
TEST_F(AuctionMetricsRecorderTest, GenerateBidPhaseMetricsWithTwoRecords) { … }
TEST_F(AuctionMetricsRecorderTest,
TopLevelBidsQueuedWaitingForConfigPromisesMetricsWhenNeverRecorded) { … }
TEST_F(AuctionMetricsRecorderTest,
TopLevelBidsQueuedWaitingForConfigPromisesMetricWhenRecordedManyTimes) { … }
TEST_F(AuctionMetricsRecorderTest,
TopLevelBidsQueuedWaitingForConfigPromisesMetricIgnoresNegativeValues) { … }
TEST_F(AuctionMetricsRecorderTest,
TopLevelBidsQueuedWaitingForSellerWorkletMetricsWhenNeverRecorded) { … }
TEST_F(AuctionMetricsRecorderTest,
TopLevelBidsQueuedWaitingForSellerWorkletMetricWhenRecordedManyTimes) { … }
TEST_F(AuctionMetricsRecorderTest,
TopLevelBidsQueuedWaitingForSellerWorkletMetricIgnoresNegativeValues) { … }
TEST_F(AuctionMetricsRecorderTest,
BidsQueuedWaitingForConfigPromisesMetricsWhenNeverRecorded) { … }
TEST_F(AuctionMetricsRecorderTest,
BidsQueuedWaitingForConfigPromisesMetricWhenRecordedManyTimes) { … }
TEST_F(AuctionMetricsRecorderTest,
BidsQueuedWaitingForConfigPromisesMetricIgnoresNegativeValues) { … }
TEST_F(AuctionMetricsRecorderTest,
BidsQueuedWaitingForSellerWorkletMetricsWhenNeverRecorded) { … }
TEST_F(AuctionMetricsRecorderTest,
BidsQueuedWaitingForSellerWorkletMetricWhenRecordedManyTimes) { … }
TEST_F(AuctionMetricsRecorderTest,
BidsQueuedWaitingForSellerWorkletMetricIgnoresNegativeValues) { … }
TEST_F(AuctionMetricsRecorderTest,
ScoreAdLatencyMetricsHaveNoValuesForNoGenerateBids) { … }
TEST_F(AuctionMetricsRecorderTest, ScoreAdLatencyWithOneRecord) { … }
TEST_F(AuctionMetricsRecorderTest, ScoreAdLatencyWithTwoRecords) { … }
TEST_F(AuctionMetricsRecorderTest, ScoreAdLatencyIgnoresNegativeValues) { … }
TEST_F(AuctionMetricsRecorderTest,
ScoreAdFlowLatencyMetricsHaveNoValuesForNoGenerateBids) { … }
TEST_F(AuctionMetricsRecorderTest, ScoreAdFlowLatencyWithOneRecord) { … }
TEST_F(AuctionMetricsRecorderTest, ScoreAdFlowLatencyWithTwoRecords) { … }
TEST_F(AuctionMetricsRecorderTest, ScoreAdFlowLatencyIgnoresNegativeValues) { … }
TEST_F(AuctionMetricsRecorderTest,
ScoreAdDependencyLatencyMetricsHaveNoValuesForNoScoreAds) { … }
TEST_F(AuctionMetricsRecorderTest,
ScoreAdDependencyLatencyMetricsHaveNoValuesForNullOptLatencies) { … }
TEST_F(AuctionMetricsRecorderTest,
ScoreAdDependencyLatencyMetricsWithOneRecord) { … }
TEST_F(AuctionMetricsRecorderTest,
ScoreAdDependencyLatencyMetricsWithTwoRecords) { … }
TEST_F(AuctionMetricsRecorderTest,
ScoreAdDependencyLatencyMetricsIgnoresNegativeValues) { … }
TEST_F(AuctionMetricsRecorderTest,
ScoreAdCriticalPathMetricsHasNoValuesWhenNoneAreRecorded) { … }
TEST_F(AuctionMetricsRecorderTest,
ScoreAdCriticalPathMetricsRecordedManyTimes) { … }
TEST_F(AuctionMetricsRecorderTest, ScoreAdCriticalPathMetricsComputeMean) { … }
TEST_F(AuctionMetricsRecorderTest,
ScoreAdCriticalPathMetricsIgnoreNegativeValues) { … }
TEST_F(AuctionMetricsRecorderTest,
ScoreAdPhaseMetricsHaveNoValuesForNoScoreAds) { … }
TEST_F(AuctionMetricsRecorderTest, ScoreAdPhaseMetricsWithOneRecord) { … }
TEST_F(AuctionMetricsRecorderTest, ScoreAdPhaseMetricsWithTwoRecords) { … }
TEST_F(AuctionMetricsRecorderTest, MultiBidCount) { … }
}
}