#include <memory>
#include <string>
#include <vector>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_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/ip_address.h"
#include "net/base/net_errors.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/schemeful_site.h"
#include "net/network_error_logging/mock_persistent_nel_store.h"
#include "net/network_error_logging/network_error_logging_service.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 {
class NetworkErrorLoggingServiceTest : public ::testing::TestWithParam<bool> { … };
void ExpectDictDoubleValue(double expected_value,
const base::Value::Dict& value,
const std::string& key) { … }
TEST_P(NetworkErrorLoggingServiceTest, CreateService) { … }
TEST_P(NetworkErrorLoggingServiceTest, NoReportingService) { … }
TEST_P(NetworkErrorLoggingServiceTest, NoPolicy) { … }
TEST_P(NetworkErrorLoggingServiceTest, PolicyKeyMatchesNakAndOrigin) { … }
TEST_P(NetworkErrorLoggingServiceTest,
PolicyKeyMatchesNakAndOriginIncludeSubdomains) { … }
TEST_P(NetworkErrorLoggingServiceTest,
PolicyKeyMatchesNakAndOriginIncludeSubdomainsAndSuccess) { … }
TEST_P(NetworkErrorLoggingServiceTest, NetworkAnonymizationKeyDisabled) { … }
TEST_P(NetworkErrorLoggingServiceTest, JsonTooLong) { … }
TEST_P(NetworkErrorLoggingServiceTest, JsonTooDeep) { … }
TEST_P(NetworkErrorLoggingServiceTest, IncludeSubdomainsEtldRejected) { … }
TEST_P(NetworkErrorLoggingServiceTest, NonIncludeSubdomainsEtldAccepted) { … }
TEST_P(NetworkErrorLoggingServiceTest, SuccessReportQueued) { … }
TEST_P(NetworkErrorLoggingServiceTest, FailureReportQueued) { … }
TEST_P(NetworkErrorLoggingServiceTest, UnknownFailureReportQueued) { … }
TEST_P(NetworkErrorLoggingServiceTest, UnknownCertFailureReportQueued) { … }
TEST_P(NetworkErrorLoggingServiceTest, HttpErrorReportQueued) { … }
TEST_P(NetworkErrorLoggingServiceTest, SuccessReportDowngraded) { … }
TEST_P(NetworkErrorLoggingServiceTest, FailureReportDowngraded) { … }
TEST_P(NetworkErrorLoggingServiceTest, HttpErrorReportDowngraded) { … }
TEST_P(NetworkErrorLoggingServiceTest, DNSFailureReportNotDowngraded) { … }
TEST_P(NetworkErrorLoggingServiceTest, SuccessPOSTReportQueued) { … }
TEST_P(NetworkErrorLoggingServiceTest, MaxAge0) { … }
TEST_P(NetworkErrorLoggingServiceTest, SuccessFraction0) { … }
TEST_P(NetworkErrorLoggingServiceTest, SuccessFractionHalf) { … }
TEST_P(NetworkErrorLoggingServiceTest, FailureFraction0) { … }
TEST_P(NetworkErrorLoggingServiceTest, FailureFractionHalf) { … }
TEST_P(NetworkErrorLoggingServiceTest,
ExcludeSubdomainsDoesntMatchDifferentPort) { … }
TEST_P(NetworkErrorLoggingServiceTest, ExcludeSubdomainsDoesntMatchSubdomain) { … }
TEST_P(NetworkErrorLoggingServiceTest, IncludeSubdomainsMatchesDifferentPort) { … }
TEST_P(NetworkErrorLoggingServiceTest, IncludeSubdomainsMatchesSubdomain) { … }
TEST_P(NetworkErrorLoggingServiceTest,
IncludeSubdomainsDoesntMatchSuperdomain) { … }
TEST_P(NetworkErrorLoggingServiceTest,
IncludeSubdomainsDoesntReportConnectionError) { … }
TEST_P(NetworkErrorLoggingServiceTest,
IncludeSubdomainsDoesntReportApplicationError) { … }
TEST_P(NetworkErrorLoggingServiceTest, IncludeSubdomainsDoesntReportSuccess) { … }
TEST_P(NetworkErrorLoggingServiceTest,
IncludeSubdomainsReportsSameOriginSuccess) { … }
TEST_P(NetworkErrorLoggingServiceTest, RemoveAllBrowsingData) { … }
TEST_P(NetworkErrorLoggingServiceTest, RemoveSomeBrowsingData) { … }
TEST_P(NetworkErrorLoggingServiceTest, Nested) { … }
TEST_P(NetworkErrorLoggingServiceTest, NestedTooDeep) { … }
TEST_P(NetworkErrorLoggingServiceTest, StatusAsValue) { … }
TEST_P(NetworkErrorLoggingServiceTest, InvalidHeaderData) { … }
TEST_P(NetworkErrorLoggingServiceTest, NoReportingService_SignedExchange) { … }
TEST_P(NetworkErrorLoggingServiceTest, NoPolicyForOrigin_SignedExchange) { … }
TEST_P(NetworkErrorLoggingServiceTest, SuccessFraction0_SignedExchange) { … }
TEST_P(NetworkErrorLoggingServiceTest, SuccessReportQueued_SignedExchange) { … }
TEST_P(NetworkErrorLoggingServiceTest, FailureReportQueued_SignedExchange) { … }
TEST_P(NetworkErrorLoggingServiceTest, MismatchingSubdomain_SignedExchange) { … }
TEST_P(NetworkErrorLoggingServiceTest, MismatchingIPAddress_SignedExchange) { … }
TEST_P(NetworkErrorLoggingServiceTest,
SignedExchangeNetworkAnonymizationKeyDisabled) { … }
TEST_P(NetworkErrorLoggingServiceTest, EvictAllExpiredPoliciesFirst) { … }
TEST_P(NetworkErrorLoggingServiceTest, EvictLeastRecentlyUsedPolicy) { … }
TEST_P(NetworkErrorLoggingServiceTest, SendsCommandsToStoreSynchronous) { … }
TEST_P(NetworkErrorLoggingServiceTest, DuplicateEntriesInStore) { … }
TEST_P(NetworkErrorLoggingServiceTest, SendsCommandsToStoreDeferred) { … }
TEST_P(NetworkErrorLoggingServiceTest,
SendsCommandsToStoreSynchronousLoadFailed) { … }
TEST_P(NetworkErrorLoggingServiceTest, SendsCommandsToStoreDeferredLoadFailed) { … }
TEST_P(NetworkErrorLoggingServiceTest, FlushesStoreOnDestruction) { … }
TEST_P(NetworkErrorLoggingServiceTest,
DoesntFlushStoreOnDestructionBeforeLoad) { … }
TEST_P(NetworkErrorLoggingServiceTest, DoNothingIfShutDown) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
}