#include "content/browser/first_party_sets/first_party_sets_handler_impl_instance.h"
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/callback_helpers.h"
#include "base/json/json_reader.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/gmock_expected_support.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "base/version.h"
#include "content/browser/first_party_sets/first_party_set_parser.h"
#include "content/public/browser/first_party_sets_handler.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_browser_context.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_metadata.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 "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
_;
Eq;
IsEmpty;
Not;
Optional;
Pair;
SizeIs;
UnorderedElementsAre;
namespace content {
namespace {
ParseErrorType;
ParseWarningType;
constexpr char kAdditionsField[] = …;
constexpr char kPrimaryField[] = …;
constexpr char kCctldsField[] = …;
constexpr char kFirstPartySetsClearSiteDataOutcomeHistogram[] = …;
constexpr char kDelayedQueriesCountHistogram[] = …;
constexpr char kMostDelayedQueryDeltaHistogram[] = …;
}
TEST(FirstPartySetsHandlerImplInstance, ValidateEnterprisePolicy_ValidPolicy) { … }
TEST(FirstPartySetsHandlerImplInstance,
ValidateEnterprisePolicy_ValidPolicyWithWarnings) { … }
TEST(FirstPartySetsHandlerImplInstance,
ValidateEnterprisePolicy_InvalidPolicy) { … }
class FirstPartySetsHandlerImplTest : public ::testing::Test { … };
class FirstPartySetsHandlerImplDisabledTest
: public FirstPartySetsHandlerImplTest { … };
TEST_F(FirstPartySetsHandlerImplDisabledTest, InitMetrics) { … }
TEST_F(FirstPartySetsHandlerImplDisabledTest, InitImmediately) { … }
class FirstPartySetsHandlerImplEnabledTest
: public FirstPartySetsHandlerImplTest { … };
TEST_F(FirstPartySetsHandlerImplEnabledTest, EmptyDBPath) { … }
TEST_F(FirstPartySetsHandlerImplEnabledTest,
ClearSiteDataOnChangedSetsForContext_ManualSet_Successful) { … }
TEST_F(FirstPartySetsHandlerImplEnabledTest,
ClearSiteDataOnChangedSetsForContext_PublicSetsWithDiff_Successful) { … }
TEST_F(FirstPartySetsHandlerImplEnabledTest,
ClearSiteDataOnChangedSetsForContext_EmptyDBPath) { … }
TEST_F(FirstPartySetsHandlerImplEnabledTest,
ClearSiteDataOnChangedSetsForContext_BeforeSetsReady) { … }
TEST_F(FirstPartySetsHandlerImplEnabledTest,
GetSetsIfEnabledAndReady_AfterSetsReady) { … }
TEST_F(FirstPartySetsHandlerImplEnabledTest,
GetSetsIfEnabledAndReady_BeforeSetsReady) { … }
TEST_F(FirstPartySetsHandlerImplEnabledTest,
ComputeFirstPartySetMetadata_SynchronousResult) { … }
TEST_F(FirstPartySetsHandlerImplEnabledTest,
ComputeFirstPartySetMetadata_AsynchronousResult) { … }
TEST_F(FirstPartySetsHandlerImplEnabledTest,
ForEachEffectiveSetEntry_BeforeSetsReady) { … }
TEST_F(FirstPartySetsHandlerImplEnabledTest,
ForEachEffectiveSetEntry_WithNonEmptyConfig) { … }
class FirstPartySetsHandlerGetContextConfigForPolicyTest
: public FirstPartySetsHandlerImplEnabledTest { … };
TEST_F(FirstPartySetsHandlerGetContextConfigForPolicyTest,
DefaultOverridesPolicy_DefaultContextConfigs) { … }
TEST_F(FirstPartySetsHandlerGetContextConfigForPolicyTest,
MalformedOverridesPolicy_DefaultContextConfigs) { … }
TEST_F(FirstPartySetsHandlerGetContextConfigForPolicyTest,
NonDefaultOverridesPolicy_NonDefaultContextConfigs) { … }
}