#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "content/browser/interest_group/additional_bids_util.h"
#include <stdint.h>
#include <array>
#include <limits>
#include <optional>
#include <string>
#include "base/base64.h"
#include "base/containers/flat_set.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/test/task_environment.h"
#include "base/types/expected.h"
#include "base/types/optional_ref.h"
#include "base/uuid.h"
#include "base/values.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/browser/interest_group/auction_metrics_recorder.h"
#include "content/services/auction_worklet/public/mojom/bidder_worklet.mojom-forward.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/interest_group/ad_auction_constants.h"
#include "third_party/blink/public/common/interest_group/ad_display_size.h"
#include "third_party/boringssl/src/include/openssl/curve25519.h"
#include "url/gurl.h"
#include "url/origin.h"
UnorderedElementsAre;
namespace content {
namespace {
const uint8_t kKey1[] = …;
const char kKey1Base64[] = …;
const uint8_t kKey2[] = …;
const char kKey2Base64[] = …;
const uint8_t kSig1[] = …;
const char kSig1Base64[] = …;
const uint8_t kSig2[] = …;
const char kSig2Base64[] = …;
const char kSig2Base64Sloppy[] = …;
const char kPretendBid[] = …;
class AdditionalBidsUtilTest : public testing::Test { … };
TEST_F(AdditionalBidsUtilTest, FailNotDict) { … }
TEST_F(AdditionalBidsUtilTest, FailNoNonce) { … }
TEST_F(AdditionalBidsUtilTest, FailInvalidNonce) { … }
TEST_F(AdditionalBidsUtilTest, FailMissingSeller) { … }
TEST_F(AdditionalBidsUtilTest, FailInvalidSeller) { … }
TEST_F(AdditionalBidsUtilTest, FailInvalidTopLevelSeller) { … }
TEST_F(AdditionalBidsUtilTest, FailInvalidTopLevelSeller2) { … }
TEST_F(AdditionalBidsUtilTest, FailInvalidTopLevelSeller3) { … }
TEST_F(AdditionalBidsUtilTest, FailNoIGDictionary) { … }
TEST_F(AdditionalBidsUtilTest, FailMissingInterestGroupName) { … }
TEST_F(AdditionalBidsUtilTest, FailMissingInterestGroupBiddingScript) { … }
TEST_F(AdditionalBidsUtilTest, FailMissingInterestGroupOwner) { … }
TEST_F(AdditionalBidsUtilTest, FailNonHttpsInterestGroupOwner) { … }
TEST_F(AdditionalBidsUtilTest, FailDomainMismatchBetweenOwnerAndBiddingScript) { … }
TEST_F(AdditionalBidsUtilTest, AdditionalBidOwnerNotInInterestGroupBuyers) { … }
TEST_F(AdditionalBidsUtilTest, FailMissingBid) { … }
TEST_F(AdditionalBidsUtilTest, FailMissingBidCreative) { … }
TEST_F(AdditionalBidsUtilTest, FailMissingBidValue) { … }
TEST_F(AdditionalBidsUtilTest, FailInvalidBidValue) { … }
TEST_F(AdditionalBidsUtilTest, MinimalValid) { … }
TEST_F(AdditionalBidsUtilTest, InvalidBidCurrencyType) { … }
TEST_F(AdditionalBidsUtilTest, InvalidBidCurrencySyntax) { … }
TEST_F(AdditionalBidsUtilTest, ValidBidCurrency) { … }
TEST_F(AdditionalBidsUtilTest, InvalidAdCost) { … }
TEST_F(AdditionalBidsUtilTest, ValidAdCost) { … }
TEST_F(AdditionalBidsUtilTest, InvalidModelingSignals) { … }
TEST_F(AdditionalBidsUtilTest, InvalidModelingSignals2) { … }
TEST_F(AdditionalBidsUtilTest, BadTypeModelingSignals) { … }
TEST_F(AdditionalBidsUtilTest, ValidModelingSignals) { … }
TEST_F(AdditionalBidsUtilTest, ValidModelingSignals2) { … }
TEST_F(AdditionalBidsUtilTest, ValidModelingSignals3) { … }
TEST_F(AdditionalBidsUtilTest, InvalidAdComponents) { … }
TEST_F(AdditionalBidsUtilTest, InvalidAdComponentsEntry) { … }
TEST_F(AdditionalBidsUtilTest, TooManyAdComponents) { … }
TEST_F(AdditionalBidsUtilTest, ValidAdComponents) { … }
TEST_F(AdditionalBidsUtilTest, ValidAdComponentsEmpty) { … }
TEST_F(AdditionalBidsUtilTest, ValidAdMetadata) { … }
TEST_F(AdditionalBidsUtilTest, ValidSingleNegativeIG) { … }
TEST_F(AdditionalBidsUtilTest, InvalidSingleNegativeIG) { … }
TEST_F(AdditionalBidsUtilTest, InvalidBothKindsOfNegativeIG) { … }
TEST_F(AdditionalBidsUtilTest, ValidMultipleNegativeIG) { … }
TEST_F(AdditionalBidsUtilTest, InvalidMultipleNegativeIG) { … }
TEST_F(AdditionalBidsUtilTest, InvalidMultipleNegativeIG2) { … }
TEST_F(AdditionalBidsUtilTest, InvalidMultipleNegativeIG3) { … }
TEST_F(AdditionalBidsUtilTest, InvalidMultipleNegativeIG4) { … }
TEST_F(AdditionalBidsUtilTest, InvalidMultipleNegativeIG5) { … }
TEST_F(AdditionalBidsUtilTest, InvalidMultipleNegativeIG6) { … }
TEST_F(AdditionalBidsUtilTest, InvalidMultipleNegativeIG7) { … }
TEST_F(AdditionalBidsUtilTest, DecodeBasicSignedBid) { … }
TEST_F(AdditionalBidsUtilTest, SignedNotDict) { … }
TEST_F(AdditionalBidsUtilTest, DecodeSignedMissingBid) { … }
TEST_F(AdditionalBidsUtilTest, DecodeSignedMissingSignatures) { … }
TEST_F(AdditionalBidsUtilTest, DecodeSignedInvalidSignatures) { … }
TEST_F(AdditionalBidsUtilTest, DecodeSignedMissingSignatureKey) { … }
TEST_F(AdditionalBidsUtilTest, DecodeSignedInvalidSignatureKey) { … }
TEST_F(AdditionalBidsUtilTest, DecodeSignedInvalidSignatureKeyLength) { … }
TEST_F(AdditionalBidsUtilTest, DecodeSignedMissingSignatureSig) { … }
TEST_F(AdditionalBidsUtilTest, DecodeSignedInvalidSignatureSig) { … }
TEST_F(AdditionalBidsUtilTest, DecodeSignedInvalidSignatureSigLength) { … }
TEST_F(AdditionalBidsUtilTest, VerifySignature) { … }
class AdditionalBidsUtilNegativeTargetingTest : public AdditionalBidsUtilTest { … };
TEST_F(AdditionalBidsUtilNegativeTargetingTest, GetNumNegativeInterestGroups) { … }
TEST_F(AdditionalBidsUtilNegativeTargetingTest, SuccessfullyNegativeTargets) { … }
TEST_F(AdditionalBidsUtilNegativeTargetingTest, WrongBuyer) { … }
TEST_F(AdditionalBidsUtilNegativeTargetingTest,
SuccessfulDespiteUnusedBadSignature) { … }
TEST_F(AdditionalBidsUtilNegativeTargetingTest, NoMatchingKey) { … }
TEST_F(AdditionalBidsUtilNegativeTargetingTest, SuccessfulDespiteMissingKey) { … }
TEST_F(AdditionalBidsUtilNegativeTargetingTest,
SuccessfulSoDoesNotEvenSeeMissingKey) { … }
TEST_F(AdditionalBidsUtilNegativeTargetingTest, JoiningOriginMismatch) { … }
TEST_F(AdditionalBidsUtilNegativeTargetingTest,
SuccessfulWithMultipleNegativeInterestGroups) { … }
TEST_F(AdditionalBidsUtilNegativeTargetingTest,
SuccessfulDespiteTwoJoiningOriginMismatches) { … }
}
}