#include "content/browser/interest_group/interest_group_storage.h"
#include <stddef.h>
#include <functional>
#include <memory>
#include <optional>
#include "base/base64.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/escape.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_clock.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "content/browser/interest_group/bidding_and_auction_server_key_fetcher.h"
#include "content/browser/interest_group/for_debugging_only_report_util.h"
#include "content/browser/interest_group/interest_group_update.h"
#include "content/browser/interest_group/storage_interest_group.h"
#include "content/services/auction_worklet/public/mojom/bidder_worklet.mojom.h"
#include "crypto/sha2.h"
#include "sql/database.h"
#include "sql/meta_table.h"
#include "sql/test/scoped_error_expecter.h"
#include "sql/test/test_helpers.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/common/interest_group/test_interest_group_builder.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "url/origin.h"
namespace content {
namespace {
IgExpectEqualsForTesting;
IgExpectNotEqualsForTesting;
InterestGroup;
Field;
Property;
UnorderedElementsAre;
UnorderedElementsAreArray;
SellerCapabilities;
SellerCapabilitiesType;
constexpr char kFullOriginStr[] = …;
constexpr char kPartialOriginStr[] = …;
constexpr int kOldestAllFieldsVersion = …;
class InterestGroupStorageTest : public testing::Test { … };
TEST_F(InterestGroupStorageTest, DatabaseInitialized_CreateDatabase) { … }
TEST_F(InterestGroupStorageTest, DatabaseRazesOldVersion) { … }
TEST_F(InterestGroupStorageTest, DatabaseRazesNewVersion) { … }
TEST_F(InterestGroupStorageTest, DatabaseJoin) { … }
TEST_F(InterestGroupStorageTest, GetGroupDoesNotReturnOutdatedKanonKeys) { … }
TEST_F(InterestGroupStorageTest,
JoinAndUpdateReturnCorrectKanonUpdateParameter) { … }
TEST_F(InterestGroupStorageTest, JoinJoinLeave) { … }
TEST_F(InterestGroupStorageTest, ClearOriginJoinedInterestGroups) { … }
TEST_F(InterestGroupStorageTest, ClearOriginJoinedInterestGroupsClearsHistory) { … }
TEST_F(InterestGroupStorageTest, GetInterestGroupsForUpdate) { … }
TEST_F(InterestGroupStorageTest, BidCount) { … }
TEST_F(InterestGroupStorageTest, RecordsWins) { … }
TEST_F(InterestGroupStorageTest, RecordsDebugReportLockoutAndCooldown) { … }
TEST_F(InterestGroupStorageTest, DeleteExpiredDebugReportCooldown) { … }
TEST_F(InterestGroupStorageTest, UpdatesAdKAnonymity) { … }
TEST_F(InterestGroupStorageTest,
UpdatesAdKAnonymityWithMultipleInterestGroups) { … }
TEST_F(InterestGroupStorageTest, KAnonDataExpires) { … }
TEST_F(InterestGroupStorageTest, StoresAllFields) { … }
#if !BUILDFLAG(IS_IOS)
TEST_F(InterestGroupStorageTest, DumpAllIgFields) { … }
#endif
TEST_F(InterestGroupStorageTest, DeleteOriginDeleteAll) { … }
TEST_F(InterestGroupStorageTest, DeleteOwnerJoinerPair) { … }
TEST_F(InterestGroupStorageTest, JoinTooManyRegularGroupNames) { … }
TEST_F(InterestGroupStorageTest, JoinTooManyNegativeGroupNames) { … }
TEST_F(InterestGroupStorageTest, JoinTooMuchStorage) { … }
TEST_F(InterestGroupStorageTest, JoinTooManyGroupOwners) { … }
TEST_F(InterestGroupStorageTest, ExpiredGroupsNotReturned) { … }
TEST_F(InterestGroupStorageTest, DBMaintenanceExpiresOldInterestGroups) { … }
TEST_F(InterestGroupStorageTest, ExpirationDeletesMetadata) { … }
TEST_F(InterestGroupStorageTest, UpgradeFromV6) { … }
TEST_F(InterestGroupStorageTest, UpgradeFromV6ThenAcceptNewData) { … }
TEST_F(InterestGroupStorageTest, UpgradeFromV16) { … }
TEST_F(InterestGroupStorageTest, MultiVersionUpgradeTest) { … }
TEST_F(InterestGroupStorageTest,
ClusteredGroupsClearedWhenClusterChangesOnJoin) { … }
TEST_F(InterestGroupStorageTest,
ClusteredGroupsClearedWhenClusterChangesOnLeave) { … }
TEST_F(InterestGroupStorageTest, SetGetLastKAnonReported) { … }
TEST_F(InterestGroupStorageTest, UpdatePrioritySignalsOverrides) { … }
TEST_F(InterestGroupStorageTest, OnlyDeletesExpiredKAnon) { … }
TEST_F(InterestGroupStorageTest, SetGetBiddingAndAuctionKeys) { … }
TEST_F(InterestGroupStorageTest, SetGetBiddingAndAuctionKeysNonUtf8) { … }
}
}