#include "content/browser/first_party_sets/database/first_party_sets_database.h"
#include <memory>
#include <optional>
#include <string>
#include <tuple>
#include <utility>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/version.h"
#include "net/base/schemeful_site.h"
#include "net/first_party_sets/first_party_set_entry.h"
#include "net/first_party_sets/first_party_set_entry_override.h"
#include "net/first_party_sets/first_party_sets_cache_filter.h"
#include "net/first_party_sets/first_party_sets_context_config.h"
#include "net/first_party_sets/global_first_party_sets.h"
#include "net/first_party_sets/local_set_declaration.h"
#include "sql/database.h"
#include "sql/statement.h"
#include "sql/test/test_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace content {
namespace {
IsEmpty;
Pair;
UnorderedElementsAre;
const int kCurrentVersionNumber = …;
static const size_t kTableCount = …;
int VersionFromMetaTable(sql::Database& db) { … }
int CompatibleVersionFromMetaTable(sql::Database& db) { … }
}
class FirstPartySetsDatabaseTest : public testing::Test { … };
TEST_F(FirstPartySetsDatabaseTest, CreateDB_TablesAndIndexesLazilyInitialized) { … }
TEST_F(FirstPartySetsDatabaseTest, LoadDBFile_CurrentVersion_Success) { … }
TEST_F(FirstPartySetsDatabaseTest, LoadDBFile_RecreateOnTooOld) { … }
TEST_F(FirstPartySetsDatabaseTest, LoadDBFile_RecreateOnTooNew) { … }
TEST_F(FirstPartySetsDatabaseTest, LoadDBFile_InvalidRunCount_Fail) { … }
TEST_F(FirstPartySetsDatabaseTest, PersistSets_NoPreExistingDB) { … }
TEST_F(FirstPartySetsDatabaseTest, PersistSets_NoPreExistingDB_NoPublicSets) { … }
TEST_F(FirstPartySetsDatabaseTest, PersistSets_PreExistingDB) { … }
TEST_F(FirstPartySetsDatabaseTest, PersistSets_PreExistingVersion) { … }
TEST_F(FirstPartySetsDatabaseTest, InsertSitesToClear_NoPreExistingDB) { … }
TEST_F(FirstPartySetsDatabaseTest, InsertSitesToClear_PreExistingDB) { … }
TEST_F(FirstPartySetsDatabaseTest,
InsertBrowserContextCleared_NoPreExistingDB) { … }
TEST_F(FirstPartySetsDatabaseTest, InsertBrowserContextCleared_PreExistingDB) { … }
TEST_F(FirstPartySetsDatabaseTest, GetSitesToClearFilters_NoPreExistingDB) { … }
TEST_F(FirstPartySetsDatabaseTest, GetSitesToClearFilters) { … }
TEST_F(FirstPartySetsDatabaseTest, GetSets_NoPreExistingDB) { … }
TEST_F(FirstPartySetsDatabaseTest, GetSets_NoPublicSets) { … }
TEST_F(FirstPartySetsDatabaseTest, GetSets_PublicSetsHaveSingleton) { … }
TEST_F(FirstPartySetsDatabaseTest, GetSets_PublicSetsHaveOrphan) { … }
TEST_F(FirstPartySetsDatabaseTest, GetSets) { … }
TEST_F(FirstPartySetsDatabaseTest,
HasEntryInBrowserContextsClearedForTesting_NoPreExistingDB) { … }
TEST_F(FirstPartySetsDatabaseTest, HasEntryInBrowserContextsClearedForTesting) { … }
TEST_F(FirstPartySetsDatabaseTest, PersistSets_FormatCheck) { … }
class FirstPartySetsDatabaseMigrationsTest : public FirstPartySetsDatabaseTest { … };
TEST_F(FirstPartySetsDatabaseMigrationsTest, MigrateEmptyToCurrent) { … }
TEST_F(FirstPartySetsDatabaseMigrationsTest, MigrateVersion2ToCurrent) { … }
TEST_F(FirstPartySetsDatabaseMigrationsTest, MigrateVersion3ToCurrent) { … }
TEST_F(FirstPartySetsDatabaseMigrationsTest, MigrateVersion4ToCurrent) { … }
}