#include "net/reporting/reporting_cache.h"
#include <string>
#include <utility>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/values_test_util.h"
#include "base/time/time.h"
#include "base/values.h"
#include "net/base/features.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_impl.h"
#include "net/reporting/reporting_cache_observer.h"
#include "net/reporting/reporting_endpoint.h"
#include "net/reporting/reporting_report.h"
#include "net/reporting/reporting_target_type.h"
#include "net/reporting/reporting_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace net {
namespace {
CommandType;
class TestReportingCacheObserver : public ReportingCacheObserver { … };
class ReportingCacheTest : public ReportingTestBase,
public ::testing::WithParamInterface<bool> { … };
TEST_P(ReportingCacheTest, Reports) { … }
TEST_P(ReportingCacheTest, RemoveAllReports) { … }
TEST_P(ReportingCacheTest, RemovePendingReports) { … }
TEST_P(ReportingCacheTest, RemoveAllPendingReports) { … }
TEST_P(ReportingCacheTest, GetReportsAsValue) { … }
TEST_P(ReportingCacheTest, GetReportsToDeliverForSource) { … }
TEST_P(ReportingCacheTest, Endpoints) { … }
TEST_P(ReportingCacheTest, SetEnterpriseReportingEndpointsWithFeatureEnabled) { … }
TEST_P(ReportingCacheTest, SetEnterpriseReportingEndpointsWithFeatureDisabled) { … }
TEST_P(ReportingCacheTest, ReportingCacheImplConstructionWithFeatureEnabled) { … }
TEST_P(ReportingCacheTest, ReportingCacheImplConstructionWithFeatureDisabled) { … }
TEST_P(ReportingCacheTest, ClientsKeyedByEndpointGroupKey) { … }
TEST_P(ReportingCacheTest, RemoveClientsForOrigin) { … }
TEST_P(ReportingCacheTest, RemoveAllClients) { … }
TEST_P(ReportingCacheTest, RemoveEndpointGroup) { … }
TEST_P(ReportingCacheTest, RemoveEndpointsForUrl) { … }
TEST_P(ReportingCacheTest, RemoveSourceAndEndpoints) { … }
TEST_P(ReportingCacheTest, GetClientsAsValue) { … }
TEST_P(ReportingCacheTest, GetCandidateEndpointsForDelivery) { … }
TEST_P(ReportingCacheTest, GetCandidateEnterpriseEndpointsForDelivery) { … }
TEST_P(ReportingCacheTest, GetCandidateEndpointsFromDocumentForDelivery) { … }
TEST_P(ReportingCacheTest, GetCandidateEndpointsFromDocumentForNetworkReports) { … }
TEST_P(ReportingCacheTest, GetCandidateEndpointsFromDifferentDocument) { … }
TEST_P(ReportingCacheTest, GetMixedCandidateEndpointsForDelivery) { … }
TEST_P(ReportingCacheTest, GetCandidateEndpointsDifferentNak) { … }
TEST_P(ReportingCacheTest, GetCandidateEndpointsExcludesExpired) { … }
TEST_P(ReportingCacheTest, ExcludeSubdomainsDifferentPort) { … }
TEST_P(ReportingCacheTest, ExcludeSubdomainsSuperdomain) { … }
TEST_P(ReportingCacheTest, IncludeSubdomainsDifferentPort) { … }
TEST_P(ReportingCacheTest, IncludeSubdomainsSuperdomain) { … }
TEST_P(ReportingCacheTest, IncludeSubdomainsPreferOriginToDifferentPort) { … }
TEST_P(ReportingCacheTest, IncludeSubdomainsPreferOriginToSuperdomain) { … }
TEST_P(ReportingCacheTest, IncludeSubdomainsPreferMoreSpecificSuperdomain) { … }
TEST_P(ReportingCacheTest, IncludeSubdomainsPreserveNak) { … }
TEST_P(ReportingCacheTest, EvictOldestReport) { … }
TEST_P(ReportingCacheTest, DontEvictPendingReports) { … }
TEST_P(ReportingCacheTest, EvictEndpointsOverPerOriginLimit) { … }
TEST_P(ReportingCacheTest, EvictExpiredGroups) { … }
TEST_P(ReportingCacheTest, EvictStaleGroups) { … }
TEST_P(ReportingCacheTest, EvictFromStalestGroup) { … }
TEST_P(ReportingCacheTest, EvictFromLargestGroup) { … }
TEST_P(ReportingCacheTest, EvictLeastImportantEndpoint) { … }
TEST_P(ReportingCacheTest, EvictEndpointsOverGlobalLimitFromStalestClient) { … }
TEST_P(ReportingCacheTest, AddClientsLoadedFromStore) { … }
TEST_P(ReportingCacheTest,
AddStoredClientsWithDifferentNetworkAnonymizationKeys) { … }
TEST_P(ReportingCacheTest, DoNotStoreMoreThanLimits) { … }
TEST_P(ReportingCacheTest, DoNotLoadMismatchedGroupsAndEndpoints) { … }
TEST_P(ReportingCacheTest, StoreLastUsedProperly) { … }
TEST_P(ReportingCacheTest, DoNotAddDuplicatedEntriesFromStore) { … }
TEST_P(ReportingCacheTest, GetIsolationInfoForEndpoint) { … }
TEST_P(ReportingCacheTest, GetV1ReportingEndpointsForOrigin) { … }
TEST_P(ReportingCacheTest, ReportingTargetType) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
}