chromium/content/browser/first_party_sets/first_party_set_parser_unittest.cc

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

#include "content/browser/first_party_sets/first_party_set_parser.h"

#include <optional>
#include <sstream>

#include "base/json/json_reader.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/version.h"
#include "content/public/browser/first_party_sets_handler.h"
#include "content/public/common/content_features.h"
#include "net/base/schemeful_site.h"
#include "net/first_party_sets/first_party_set_entry.h"
#include "net/first_party_sets/global_first_party_sets.h"
#include "net/first_party_sets/local_set_declaration.h"
#include "net/first_party_sets/sets_mutation.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

ElementsAre;
IsEmpty;
Pair;
UnorderedElementsAre;

namespace content {

namespace {

ParseErrorType;
ParseError;
ParseWarningType;
ParseWarning;

constexpr char kPrimaryField[] =;
constexpr char kAssociatedSitesField[] =;
constexpr char kCctldsField[] =;
constexpr char kReplacementsField[] =;
constexpr char kAdditionsField[] =;
constexpr char kParsedSuccessfullyHistogram[] =;
constexpr char kNonfatalErrorsHistogram[] =;
constexpr char kProcessedComponentHistogram[] =;

const base::Version kVersion("1.0");

const net::GlobalFirstPartySets kEmptySets =;

}  // namespace

net::GlobalFirstPartySets ParseSets(const std::string& sets) {}

TEST(FirstPartySetParser, RejectsNonemptyMalformed) {}

TEST(FirstPartySetParser, AcceptsTrivial) {}

TEST(FirstPartySetParser, RejectsSingletonSet) {}

TEST(FirstPartySetParser, AcceptsMinimal_Associated) {}

TEST(FirstPartySetParser, AcceptsMinimal_Service) {}

TEST(FirstPartySetParser, AcceptsMinimal_AllSubsets_WithCcTLDs) {}

TEST(FirstPartySetParser, RejectsMissingPrimary) {}

TEST(FirstPartySetParser, RejectsTypeUnsafePrimary) {}

TEST(FirstPartySetParser, RejectsNonHTTPSPrimary) {}

TEST(FirstPartySetParser, NonOriginPrimary) {}

TEST(FirstPartySetParser, PrimaryIsTLD) {}

TEST(FirstPartySetParser, PrimaryIsIPAddress) {}

TEST(FirstPartySetParser, PrimaryHasNoTLD) {}

TEST(FirstPartySetParser, RejectsMissingAssociatedSites) {}

TEST(FirstPartySetParser, RejectsTypeUnsafeAssociatedSites) {}

TEST(FirstPartySetParser, RejectsNonHTTPSAssociatedSite) {}

TEST(FirstPartySetParser, NonOriginAssociatedSite) {}

TEST(FirstPartySetParser, AssociatedSiteIsTLD) {}

TEST(FirstPartySetParser, AssociatedSiteIsIPAddress) {}

TEST(FirstPartySetParser, AssociatedSiteHasNoTLD) {}

TEST(FirstPartySetParser, TruncatesSubdomain_Primary) {}

TEST(FirstPartySetParser, TruncatesPrimaryInvalidWithAlias) {}

TEST(FirstPartySetParser, TruncatesSubdomain_AssociatedSite) {}

TEST(FirstPartySetParser, TruncatesSubdomain_RepeatedDomain) {}

TEST(FirstPartySetParser, TruncatesSubdomain_NondisjointSets) {}

TEST(FirstPartySetParser, AcceptsMultipleSets) {}

TEST(FirstPartySetParser, AcceptsMultipleSetsWithWhitespace) {}

TEST(FirstPartySetParser, RejectsInvalidSets_InvalidPrimary) {}

TEST(FirstPartySetParser, RejectsInvalidSets_InvalidAssociatedSite) {}

TEST(FirstPartySetParser, AllowsTrailingCommas) {}

TEST(FirstPartySetParser, Rejects_SamePrimary) {}

TEST(FirstPartySetParser, Rejects_AssociatedSiteAsPrimary) {}

TEST(FirstPartySetParser, Rejects_SameAssociatedSite) {}

TEST(FirstPartySetParser, Rejects_PrimaryAsAssociatedSite) {}

TEST(FirstPartySetParser, Accepts_ccTLDAliases) {}

TEST(FirstPartySetParser, Rejects_NonSchemefulSiteCcTLDAliases) {}

TEST(FirstPartySetParser, Rejects_NondisjointCcTLDAliases) {}

TEST(FirstPartySetParser, Logs_MultipleRejections) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     Accepts_MissingSetLists) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     Accepts_EmptyLists) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     InvalidTypeError_MissingPrimary) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     InvalidTypeError_WrongPrimaryType) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     InvalidTypeError_WrongAssociatedSitesFieldType) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     InvalidTypeError_WrongAssociatedSiteType) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     InvalidOriginError_PrimaryOpaque) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     InvalidOriginError_AssociatedSiteOpaque) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest, PrimaryNonHttps) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     AssociatedSiteNonHttps) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     PrimaryNonRegisteredDomain) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     AssociatedSiteNonRegisteredDomain) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     SingletonSetError_EmptyAssociatedSites) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     RepeatedDomainError_WithinReplacements) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     NonDisjointError_WithinReplacements) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     NonDisjointError_WithinAdditions) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     NonDisjointError_AcrossBothLists) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest, WarnsUntilError) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     SuccessfulMapping_SameList) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     SuccessfulMapping_CrossList) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     SuccessfulMapping_CrossList_TruncatesNonDisjoint) {}

TEST(FirstPartySetParser_ParseSetsFromEnterprisePolicyTest,
     SuccessfulMapping_CCTLDs) {}

TEST(FirstPartySetParser, RespectsAssociatedSiteLimit) {}

TEST(FirstPartySetParser, DetectsErrorsPastAssociatedSiteLimit) {}

TEST(FirstPartySetParser, ServiceSitesAreNotCountedAgainstAssociatedSiteLimit) {}

TEST(FirstPartySetParser, AliasesAreNotCountedAgainstAssociatedSiteLimit) {}

TEST(FirstPartySetParser, EnterprisePolicies_ExemptFromAssociatedSiteLimit) {}

TEST(FirstPartySetParser, ParseFromCommandLine_Invalid_MultipleSets) {}

TEST(FirstPartySetParser, ParseFromCommandLine_Invalid_Singleton) {}

TEST(FirstPartySetParser,
     ParseFromCommandLine_Valid_MultipleSubsetsAndAliases) {}

}  // namespace content