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

// Copyright 2021 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/interest_group_mojom_traits.h"

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

#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "mojo/public/cpp/test_support/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/common_export.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/interest_group/interest_group.h"
#include "third_party/blink/public/common/interest_group/test/interest_group_test_utils.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 {

IgExpectEqualsForTesting;
IgExpectNotEqualsForTesting;

const char kOrigin1[] =;
const char kOrigin2[] =;

const char kName1[] =;
const char kName2[] =;

// Two URLs that share kOrigin1.
const char kUrl1[] =;
const char kUrl2[] =;

// Creates an InterestGroup with an owner and a name,which are mandatory fields.
InterestGroup CreateInterestGroup() {}

// SerializesAndDeserializes the provided interest group, expecting
// deserialization to succeed. Expects the deserialization to succeed, and to be
// the same as the original group. Also makes sure the input InterestGroup is
// not equal to the output of CreateInterestGroup(), to verify that
// IgExpect[Not]EqualsForTesting() is checking whatever was modified in the
// input group.
//
// Arguments is not const because SerializeAndDeserialize() doesn't take a
// const input value, as serializing some object types is destructive.
void SerializeAndDeserializeAndCompare(InterestGroup& interest_group) {}

// A variant of SerializeAndDeserializeAndCompare() that expects serialization
// to fail.
//
// **NOTE**: Most validation of invalid fields should be checked in
// validate_blink_interest_group_test.cc, as it checks both against
// validate_blink_interest_group.cc (which runs in the renderer) and
// InterestGroup::IsValid() (which runs in the browser process). This method is
// useful for cases where validation is performed by WebIDL instead of custom
// renderer-side logic, but InterestGroup::IsValid() still needs to be checked.
void SerializeAndDeserializeExpectFailure(InterestGroup& interest_group,
                                          std::string_view tag = "") {}

}  // namespace

// This file has tests for the deserialization success case. Failure cases are
// currently tested alongside ValidateBlinkInterestGroup(), since their failure
// cases should be the same.

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeExpiry) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeOwner) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeName) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializePriority) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeEnableBiddingSignalsPrioritization) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializePriorityVector) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializePrioritySignalsOverride) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeNonFinite) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeSellerCapabilities) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeAllSellersCapabilities) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeBiddingUrl) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeWasmHelperUrl) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeUpdateUrl) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeTrustedBiddingSignalsUrl) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeCrossOriginTrustedBiddingSignalsUrl) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeTrustedBiddingSignalsKeys) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeTrustedBiddingSignalsSlotSizeMode) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeMaxTrustedBiddingSignalsURLLength) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeTrustedBiddingSignalsCoordinator) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeInvalidTrustedBiddingSignalsCoordinator) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeUserBiddingSignals) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeAds) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeAdsWithReportingIds) {}

TEST(InterestGroupMojomTraitsTest, AdComponentsWithBuyerReportingIdInvalid) {}

TEST(InterestGroupMojomTraitsTest,
     AdComponentsWithBuyerAndSellerReportingIdInvalid) {}

TEST(InterestGroupMojomTraitsTest,
     AdComponentsWithSelectableReportingIdInvalid) {}

TEST(InterestGroupMojomTraitsTest, AdComponentsWithNoReportingIdsIsValid) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeAdsWithSizeGroups) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeAdsWithAdRenderId) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeAdsWithAllowedReportingOrigins) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeAdComponents) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeAdComponentsWithSize) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeAdComponentsWithAdRenderId) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeAdSizes) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeSizeGroups) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeAuctionServerRequestFlags) {}

TEST(InterestGroupMojomTraitsTest, SerializeAndDeserializeAdditionalBidKey) {}

TEST(InterestGroupMojomTraitsTest,
     SerializeAndDeserializeAggregationCoordinatorOrigin) {}

}  // namespace blink