#include "net/reporting/reporting_header_parser.h"
#include <optional>
#include <sstream>
#include <string>
#include <vector>
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/time/time.h"
#include "base/values.h"
#include "net/base/features.h"
#include "net/base/isolation_info.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/schemeful_site.h"
#include "net/reporting/mock_persistent_reporting_store.h"
#include "net/reporting/reporting_cache.h"
#include "net/reporting/reporting_endpoint.h"
#include "net/reporting/reporting_target_type.h"
#include "net/reporting/reporting_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace net {
namespace {
CommandType;
Dictionary;
constexpr char kReportingHeaderTypeHistogram[] = …;
class ReportingHeaderParserTestBase
: public ReportingTestBase,
public ::testing::WithParamInterface<bool> { … };
class ReportingHeaderParserTest : public ReportingHeaderParserTestBase { … };
TEST_P(ReportingHeaderParserTest, Invalid) { … }
TEST_P(ReportingHeaderParserTest, Basic) { … }
TEST_P(ReportingHeaderParserTest, PathAbsoluteURLEndpoint) { … }
TEST_P(ReportingHeaderParserTest, OmittedGroupName) { … }
TEST_P(ReportingHeaderParserTest, IncludeSubdomainsTrue) { … }
TEST_P(ReportingHeaderParserTest, IncludeSubdomainsFalse) { … }
TEST_P(ReportingHeaderParserTest, IncludeSubdomainsEtldRejected) { … }
TEST_P(ReportingHeaderParserTest, NonIncludeSubdomainsEtldAccepted) { … }
TEST_P(ReportingHeaderParserTest, IncludeSubdomainsNotBoolean) { … }
TEST_P(ReportingHeaderParserTest, NonDefaultPriority) { … }
TEST_P(ReportingHeaderParserTest, NonDefaultWeight) { … }
TEST_P(ReportingHeaderParserTest, MaxAge) { … }
TEST_P(ReportingHeaderParserTest, MultipleEndpointsSameGroup) { … }
TEST_P(ReportingHeaderParserTest, MultipleEndpointsDifferentGroups) { … }
TEST_P(ReportingHeaderParserTest, MultipleHeadersFromDifferentOrigins) { … }
TEST_P(ReportingHeaderParserTest, EndpointGroupKey) { … }
TEST_P(ReportingHeaderParserTest,
HeaderErroneouslyContainsMultipleGroupsOfSameName) { … }
TEST_P(ReportingHeaderParserTest,
HeaderErroneouslyContainsGroupsWithRedundantEndpoints) { … }
TEST_P(ReportingHeaderParserTest,
HeaderErroneouslyContainsMultipleGroupsOfSameNameAndEndpoints) { … }
TEST_P(ReportingHeaderParserTest,
HeaderErroneouslyContainsGroupsOfSameNameAndOverlappingEndpoints) { … }
TEST_P(ReportingHeaderParserTest, OverwriteOldHeader) { … }
TEST_P(ReportingHeaderParserTest, OverwriteOldHeaderWithCompletelyNew) { … }
TEST_P(ReportingHeaderParserTest, ZeroMaxAgeRemovesEndpointGroup) { … }
TEST_P(ReportingHeaderParserTest, InvalidAdvertisementRemovesEndpointGroup) { … }
TEST_P(ReportingHeaderParserTest, EvictEndpointsOverPerOriginLimit1) { … }
TEST_P(ReportingHeaderParserTest, EvictEndpointsOverPerOriginLimit2) { … }
TEST_P(ReportingHeaderParserTest, EvictEndpointsOverGlobalLimit) { … }
INSTANTIATE_TEST_SUITE_P(…);
class ReportingHeaderParserStructuredHeaderTest
: public ReportingHeaderParserTestBase { … };
TEST_P(ReportingHeaderParserStructuredHeaderTest, ParseInvalid) { … }
TEST_P(ReportingHeaderParserStructuredHeaderTest, ProcessInvalid) { … }
TEST_P(ReportingHeaderParserStructuredHeaderTest, ParseBasic) { … }
TEST_P(ReportingHeaderParserStructuredHeaderTest, Basic) { … }
TEST_P(ReportingHeaderParserStructuredHeaderTest, PathAbsoluteURLEndpoint) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
}