chromium/third_party/blink/common/interest_group/auction_config_mojom_traits_test.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/public/common/interest_group/auction_config_mojom_traits.h"

#include <limits>
#include <optional>
#include <string>
#include <tuple>
#include <vector>

#include "base/containers/flat_map.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "base/unguessable_token.h"
#include "base/uuid.h"
#include "mojo/public/cpp/test_support/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/numeric/int128.h"
#include "third_party/blink/common/interest_group/auction_config_test_util.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/interest_group/auction_config.h"
#include "third_party/blink/public/common/interest_group/seller_capabilities.h"
#include "third_party/blink/public/mojom/interest_group/interest_group_types.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace blink {

namespace {

// Cases for direct_from_seller_signals test parameterization.

constexpr char kPerBuyerSignals[] =;
constexpr char kSellerSignals[] =;
constexpr char kAuctionSignals[] =;

constexpr char kBundleUrl[] =;
constexpr char kPrefix[] =;

// Attempts to serialize and then deserialize `auction_config`, returning true
// if deserialization succeeded. On success, also checks that the resulting
// config matches the original config.
bool SerializeAndDeserialize(const AuctionConfig& auction_config) {}

template <class MojoType, class PromiseValue>
bool SerializeAndDeserialize(
    const AuctionConfig::MaybePromise<PromiseValue>& in) {}

bool SerializeAndDeserialize(const AuctionConfig::AdKeywordReplacement& in) {}

bool SerializeAndDeserialize(const AuctionConfig::BuyerTimeouts& in) {}

bool SerializeAndDeserialize(const AuctionConfig::BuyerCurrencies& in) {}

bool SerializeAndDeserialize(const AdCurrency& in) {}

bool SerializeAndDeserialize(const AuctionConfig::ServerResponseConfig& in) {}

TEST(AuctionConfigMojomTraitsTest, Empty) {}

TEST(AuctionConfigMojomTraitsTest, Basic) {}

TEST(AuctionConfigMojomTraitsTest, SellerNotHttps) {}

TEST(AuctionConfigMojomTraitsTest, SellerDecisionUrlMismatch) {}

// Tests that decision logic and trusted scoring signals GURLs exceeding max
// length can be passed through Mojo and will be converted into invalid, empty
// GURLs, and passing in invalid URLs works as well.
TEST(AuctionConfigMojomTraitsTest, SellerDecisionAndTrustedSignalsUrlsTooLong) {}

TEST(AuctionConfigMojomTraitsTest, SellerScoringSignalsUrlMismatch) {}

TEST(AuctionConfigMojomTraitsTest,
     SellerScoringSignalsUrlCrossOriginPermitted) {}

TEST(AuctionConfigMojomTraitsTest, TrustedScoringSignalsFields) {}

TEST(AuctionConfigMojomTraitsTest, FullConfig) {}

TEST(AuctionConfigMojomTraitsTest,
     perBuyerPrioritySignalsCannotOverrideBrowserSignals) {}

TEST(AuctionConfigMojomTraitsTest,
     allBuyersPrioritySignalsCannotOverrideBrowserSignals) {}

TEST(AuctionConfigMojomTraitsTest, SerializeAndDeserializeNonFinite) {}

TEST(AuctionConfigMojomTraitsTest, BuyerNotHttps) {}

TEST(AuctionConfigMojomTraitsTest, BuyerNotHttpsMultipleBuyers) {}

TEST(AuctionConfigMojomTraitsTest, ComponentAuctionUrlHttps) {}

TEST(AuctionConfigMojomTraitsTest, ComponentAuctionTooDeep) {}

TEST(AuctionConfigMojomTraitsTest, ComponentAuctionWithNonce) {}

TEST(AuctionConfigMojomTraitsTest,
     TopLevelAuctionHasBuyersAndComponentAuction) {}

TEST(AuctionConfigMojomTraitsTest, ComponentAuctionSuccessSingleBasic) {}

TEST(AuctionConfigMojomTraitsTest, ComponentAuctionSuccessMultipleFull) {}

TEST(AuctionConfigMojomTraitsTest, DuplicateAllSlotsRequestedSizes) {}

TEST(AuctionConfigMojomTraitsTest, MaxTrustedScoringSignalsUrlLength) {}

TEST(AuctionConfigMojomTraitsTest, TrustedScoringSignalsCoordinator) {}

TEST(AuctionConfigMojomTraitsTest,
     DirectFromSellerSignalsPrefixWithQueryString) {}

TEST(AuctionConfigMojomTraitsTest, DirectFromSellerSignalsBuyerNotPresent) {}

TEST(AuctionConfigMojomTraitsTest,
     DirectFromSellerSignalsNoDirectFromSellerSignals) {}

TEST(AuctionConfigMojomTraitsTest, DirectFromSellerSignalsNoPerBuyerSignals) {}

TEST(AuctionConfigMojomTraitsTest, DirectFromSellerSignalsNoSellerSignals) {}

TEST(AuctionConfigMojomTraitsTest, DirectFromSellerSignalsNoAuctionSignals) {}

TEST(AuctionConfigMojomTraitsTest, DirectFromSellerSignalsHeaderAdSlot) {}

TEST(AuctionConfigMojomTraitsTest,
     DirectFromSellerSignalsCantHaveBothBundlesAndHeaderAdSlot) {}

TEST(AuctionConfigMojomTraitsTest,
     DirectFromSellerSignalsCantHaveBothBundlesAndHeaderAdSlotPromise) {}

TEST(AuctionConfigMojomTraitsTest, MaybePromiseJson) {}

TEST(AuctionConfigMojomTraitsTest, MaybePromisePerBuyerSignals) {}

TEST(AuctionConfigMojomTraitsTest,
     MaybePromiseDeprecatedRenderURLReplacements) {}

TEST(AuctionConfigMojomTraitsTest, DeprecatedRenderURLReplacements) {}

TEST(AuctionConfigMojomTraitsTest,
     DeprecatedRenderURLReplacementsBadFormatting) {}

TEST(AuctionConfigMojomTraitsTest, SellerTimeout) {}

TEST(AuctionConfigMojomTraitsTest, BuyerTimeouts) {}

TEST(AuctionConfigMojomTraitsTest, MaybePromiseBuyerTimeouts) {}

TEST(AuctionConfigMojomTraitsTest, ReportingTimeout) {}

TEST(AuctionConfigMojomTraitsTest, BuyerCurrencies) {}

TEST(AuctionConfigMojomTraitsTest, AdCurrency) {}

TEST(AuctionConfigMojomTraitsTest, MaybePromiseDirectFromSellerSignals) {}

TEST(AuctionConfigMojomTraitsTest, ServerResponseConfig) {}

// Can't have `expects_additional_bids` without a nonce.
TEST(AuctionConfigMojomTraitsTest, AdditionalBidsNoNonce) {}

// Can't have `expects_additional_bids` with no interestGroupBuyers.
TEST(AuctionConfigMojomTraitsTest, AdditionalBidsNoInterestGroupBuyers) {}

// Can't have `expects_additional_bids` with empty interestGroupBuyers.
TEST(AuctionConfigMojomTraitsTest, AdditionalBidsEmptyInterestGroupBuyers) {}

class AuctionConfigMojomTraitsDirectFromSellerSignalsTest
    : public ::testing::TestWithParam<std::tuple<const char*, const char*>> {};

TEST_P(AuctionConfigMojomTraitsDirectFromSellerSignalsTest, NotHttps) {}

TEST_P(AuctionConfigMojomTraitsDirectFromSellerSignalsTest, WrongOrigin) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace

}  // namespace blink