#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/domain_reliability/monitor.h"
#include <stddef.h>
#include <map>
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/domain_reliability/baked_in_configs.h"
#include "components/domain_reliability/beacon.h"
#include "components/domain_reliability/config.h"
#include "components/domain_reliability/features.h"
#include "components/domain_reliability/google_configs.h"
#include "components/domain_reliability/test_util.h"
#include "net/base/isolation_info.h"
#include "net/base/load_timing_info.h"
#include "net/base/net_errors.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/proxy_chain.h"
#include "net/base/request_priority.h"
#include "net/http/http_connection_info.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
#include "net/http/http_util.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/gtest_util.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_error_codes.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace domain_reliability {
namespace {
BeaconVector;
const char kBeaconOutcomeHistogram[] = …;
scoped_refptr<net::HttpResponseHeaders> MakeHttpResponseHeaders(
std::string_view headers) { … }
size_t CountQueuedBeacons(const DomainReliabilityContext* context) { … }
}
class DomainReliabilityMonitorTest : public testing::Test { … };
namespace {
TEST_F(DomainReliabilityMonitorTest, Create) { … }
TEST_F(DomainReliabilityMonitorTest, NoContext) { … }
TEST_F(DomainReliabilityMonitorTest, NetworkFailure) { … }
TEST_F(DomainReliabilityMonitorTest, GoAwayWithPortMigrationDetected) { … }
TEST_F(DomainReliabilityMonitorTest, ServerFailure) { … }
TEST_F(DomainReliabilityMonitorTest, DidNotAccessNetwork) { … }
TEST_F(DomainReliabilityMonitorTest, DoNotSendCookies) { … }
TEST_F(DomainReliabilityMonitorTest, LocalError) { … }
TEST_F(DomainReliabilityMonitorTest, WasFetchedViaProxy) { … }
TEST_F(DomainReliabilityMonitorTest,
NoCachedIPFromSuccessfulRevalidationRequest) { … }
TEST_F(DomainReliabilityMonitorTest, NoCachedIPFromFailedRevalidationRequest) { … }
TEST_F(DomainReliabilityMonitorTest, Upload) { … }
TEST_F(DomainReliabilityMonitorTest, NetworkAnonymizationKey) { … }
TEST_F(DomainReliabilityMonitorTest, BakedInAndGoogleConfigs) { … }
TEST_F(DomainReliabilityMonitorTest, GoogleConfigOnDemand) { … }
TEST_F(DomainReliabilityMonitorTest, ClearBeacons) { … }
TEST_F(DomainReliabilityMonitorTest, ClearBeaconsWithFilter) { … }
TEST_F(DomainReliabilityMonitorTest, ClearContexts) { … }
TEST_F(DomainReliabilityMonitorTest, ClearContextsWithFilter) { … }
TEST_F(DomainReliabilityMonitorTest, WildcardMatchesSelf) { … }
TEST_F(DomainReliabilityMonitorTest, WildcardMatchesSubdomain) { … }
TEST_F(DomainReliabilityMonitorTest, WildcardDoesntMatchSubsubdomain) { … }
TEST_F(DomainReliabilityMonitorTest, WildcardPrefersSelfToParentWildcard) { … }
TEST_F(DomainReliabilityMonitorTest,
WildcardPrefersSelfWildcardToParentWildcard) { … }
TEST_F(DomainReliabilityMonitorTest, RealRequest) { … }
}
}