#include "net/http/http_cache.h"
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <optional>
#include <set>
#include <utility>
#include <vector>
#include "base/files/scoped_temp_dir.h"
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_clock.h"
#include "base/time/time.h"
#include "base/trace_event/memory_allocator_dump.h"
#include "base/trace_event/memory_dump_request_args.h"
#include "base/trace_event/process_memory_dump.h"
#include "net/base/cache_type.h"
#include "net/base/completion_repeating_callback.h"
#include "net/base/elements_upload_data_stream.h"
#include "net/base/features.h"
#include "net/base/host_port_pair.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/load_flags.h"
#include "net/base/load_timing_info.h"
#include "net/base/load_timing_info_test_util.h"
#include "net/base/net_errors.h"
#include "net/base/schemeful_site.h"
#include "net/base/tracing.h"
#include "net/base/upload_bytes_element_reader.h"
#include "net/cert/cert_status_flags.h"
#include "net/cert/x509_certificate.h"
#include "net/disk_cache/disk_cache.h"
#include "net/http/http_byte_range.h"
#include "net/http/http_cache_transaction.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_request_info.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_headers_test_util.h"
#include "net/http/http_response_info.h"
#include "net/http/http_transaction.h"
#include "net/http/http_transaction_test_util.h"
#include "net/http/http_util.h"
#include "net/http/mock_http_cache.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_source.h"
#include "net/log/net_log_with_source.h"
#include "net/log/test_net_log.h"
#include "net/log/test_net_log_util.h"
#include "net/socket/client_socket_handle.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_connection_status_flags.h"
#include "net/test/cert_test_util.h"
#include "net/test/gtest_util.h"
#include "net/test/scoped_mutually_exclusive_feature_list.h"
#include "net/test/test_data_directory.h"
#include "net/test/test_with_task_environment.h"
#include "net/websockets/websocket_handshake_stream_base.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"
IsError;
IsOk;
AllOf;
ByRef;
Contains;
ElementsAre;
Eq;
Field;
Gt;
IsEmpty;
NotNull;
Time;
namespace net {
CacheEntryStatus;
class WebSocketEndpointLockManager;
namespace {
constexpr auto ToSimpleString = …;
void TestLoadTimingNetworkRequest(const LoadTimingInfo& load_timing_info) { … }
void TestLoadTimingCachedResponse(const LoadTimingInfo& load_timing_info) { … }
void DeferCallback(bool* defer) { … }
class DeleteCacheCompletionCallback
: public TestGetBackendCompletionCallbackBase { … };
void ReadAndVerifyTransaction(HttpTransaction* trans,
const MockTransaction& trans_info) { … }
void ReadRemainingAndVerifyTransaction(HttpTransaction* trans,
const std::string& already_read,
const MockTransaction& trans_info) { … }
void RunTransactionTestBase(HttpCache* cache,
const MockTransaction& trans_info,
const MockHttpRequest& request,
HttpResponseInfo* response_info,
const NetLogWithSource& net_log,
LoadTimingInfo* load_timing_info,
int64_t* sent_bytes,
int64_t* received_bytes,
IPEndPoint* remote_endpoint) { … }
void RunTransactionTestWithRequest(HttpCache* cache,
const MockTransaction& trans_info,
const MockHttpRequest& request,
HttpResponseInfo* response_info) { … }
void RunTransactionTestAndGetTiming(HttpCache* cache,
const MockTransaction& trans_info,
const NetLogWithSource& log,
LoadTimingInfo* load_timing_info) { … }
void RunTransactionTestAndGetTimingAndConnectedSocketAddress(
HttpCache* cache,
const MockTransaction& trans_info,
const NetLogWithSource& log,
LoadTimingInfo* load_timing_info,
IPEndPoint* remote_endpoint) { … }
void RunTransactionTest(HttpCache* cache, const MockTransaction& trans_info) { … }
void RunTransactionTestWithLog(HttpCache* cache,
const MockTransaction& trans_info,
const NetLogWithSource& log) { … }
void RunTransactionTestWithResponseInfo(HttpCache* cache,
const MockTransaction& trans_info,
HttpResponseInfo* response) { … }
void RunTransactionTestWithResponseInfoAndGetTiming(
HttpCache* cache,
const MockTransaction& trans_info,
HttpResponseInfo* response,
const NetLogWithSource& log,
LoadTimingInfo* load_timing_info) { … }
void RunTransactionTestWithResponse(HttpCache* cache,
const MockTransaction& trans_info,
std::string* response_headers) { … }
void RunTransactionTestWithResponseAndGetTiming(
HttpCache* cache,
const MockTransaction& trans_info,
std::string* response_headers,
const NetLogWithSource& log,
LoadTimingInfo* load_timing_info) { … }
class FastTransactionServer { … };
bool FastTransactionServer::no_store;
const MockTransaction kFastNoStoreGET_Transaction = …;
class RangeTransactionServer { … };
bool RangeTransactionServer::not_modified_ = …;
bool RangeTransactionServer::modified_ = …;
bool RangeTransactionServer::bad_200_ = …;
bool RangeTransactionServer::redirect_ = …;
int64_t RangeTransactionServer::length_ = …;
#define EXTRA_HEADER_LINE …
#define EXTRA_HEADER …
static const char kExtraHeaderKey[] = …;
void RangeTransactionServer::RangeHandler(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) { … }
const MockTransaction kRangeGET_TransactionOK = …;
const char kFullRangeData[] = …;
void Verify206Response(const std::string& response, int start, int end) { … }
void CreateTruncatedEntry(std::string raw_headers, MockHttpCache* cache) { … }
void VerifyTruncatedFlag(MockHttpCache* cache,
const std::string& key,
bool flag_value,
int data_size) { … }
struct Response { … };
struct Context { … };
class FakeWebSocketHandshakeStreamCreateHelper
: public WebSocketHandshakeStreamBase::CreateHelper { … };
bool ShouldIgnoreLogEntry(const NetLogEntry& entry) { … }
std::vector<NetLogEntry> GetFilteredNetLogEntries(
const RecordingNetLogObserver& net_log_observer) { … }
bool LogContainsEventType(const RecordingNetLogObserver& net_log_observer,
NetLogEventType expected) { … }
TransportInfo TestTransportInfoWithPort(uint16_t port) { … }
TransportInfo TestTransportInfo() { … }
TransportInfo CachedTestTransportInfo() { … }
std::string GenerateCacheKey(const std::string& url) { … }
}
HttpCacheTest;
class HttpCacheIOCallbackTest : public HttpCacheTest { … };
class HttpSplitCacheKeyTest : public HttpCacheTest { … };
TEST_F(HttpCacheTest, CreateThenDestroy) { … }
TEST_F(HttpCacheTest, GetBackend) { … }
HttpCacheSimpleGetTest;
TEST_F(HttpCacheSimpleGetTest, Basic) { … }
TEST_F(HttpCacheSimpleGetTest, ConnectedCallback) { … }
TEST_F(HttpCacheSimpleGetTest, ConnectedCallbackReturnError) { … }
TEST_F(HttpCacheSimpleGetTest, ConnectedCallbackOnCacheHit) { … }
TEST_F(HttpCacheSimpleGetTest, ConnectedCallbackOnCacheHitReturnError) { … }
TEST_F(HttpCacheSimpleGetTest,
ConnectedCallbackOnCacheHitReturnInconsistentIpError) { … }
TEST_F(HttpCacheSimpleGetTest,
ConnectedCallbackOnCacheHitReturnPrivateNetworkAccessBlockedError) { … }
TEST_F(HttpCacheSimpleGetTest, ConnectedCallbackOnCacheHitFromProxy) { … }
TEST_F(HttpCacheSimpleGetTest, DelayedCacheLock) { … }
TEST_F(HttpCacheTest, GetExperimentMode) { … }
enum class SplitCacheTestCase { … };
const struct { … } kTestCaseToFeatureMapping[] = …;
class HttpCacheTestSplitCacheFeature
: public HttpCacheTest,
public ::testing::WithParamInterface<SplitCacheTestCase> { … };
TEST_P(HttpCacheTestSplitCacheFeature, SimpleGetVerifyGoogleFontMetrics) { … }
INSTANTIATE_TEST_SUITE_P(…);
class HttpCacheTestSplitCacheFeatureEnabled : public HttpCacheTest { … };
TEST_F(HttpCacheSimpleGetTest, NoDiskCache) { … }
TEST_F(HttpCacheSimpleGetTest, NoDiskCache2) { … }
TEST_F(HttpCacheTest, ReleaseBuffer) { … }
TEST_F(HttpCacheSimpleGetTest, WithDiskFailures) { … }
TEST_F(HttpCacheSimpleGetTest, WithDiskFailures2) { … }
TEST_F(HttpCacheSimpleGetTest, WithDiskFailures3) { … }
TEST_F(HttpCacheSimpleGetTest, LoadOnlyFromCacheHit) { … }
TEST_F(HttpCacheSimpleGetTest, LoadOnlyFromCacheMiss) { … }
TEST_F(HttpCacheSimpleGetTest, LoadPreferringCacheHit) { … }
TEST_F(HttpCacheSimpleGetTest, LoadPreferringCacheMiss) { … }
TEST_F(HttpCacheSimpleGetTest, LoadPreferringCacheVaryMatch) { … }
TEST_F(HttpCacheSimpleGetTest, LoadPreferringCacheVaryMismatch) { … }
TEST_F(HttpCacheSimpleGetTest, LoadSkipCacheValidationVaryStar) { … }
TEST_F(HttpCacheSimpleGetTest, CacheSignalFailure) { … }
TEST_F(HttpCacheTest, RecordHistogramsCantConditionalize) { … }
TEST_F(HttpCacheSimpleGetTest, NetworkAccessedNetwork) { … }
TEST_F(HttpCacheSimpleGetTest, NetworkAccessedCache) { … }
TEST_F(HttpCacheSimpleGetTest, LoadBypassCache) { … }
TEST_F(HttpCacheSimpleGetTest, LoadBypassCacheImplicit) { … }
TEST_F(HttpCacheSimpleGetTest, LoadBypassCacheImplicit2) { … }
TEST_F(HttpCacheSimpleGetTest, LoadValidateCache) { … }
TEST_F(HttpCacheSimpleGetTest, LoadValidateCacheImplicit) { … }
TEST_F(HttpCacheSimpleGetTest, UnusedSincePrefetch) { … }
TEST_F(HttpCacheSimpleGetTest, RestrictedPrefetchIsRestrictedUntilReuse) { … }
TEST_F(HttpCacheSimpleGetTest, RestrictedPrefetchReuseIsLimited) { … }
TEST_F(HttpCacheSimpleGetTest, UnusedSincePrefetchWriteError) { … }
TEST_F(HttpCacheTest, PrefetchTruncateCancelInConnectedCallback) { … }
TEST_F(HttpCacheTest, StaleWhiteRevalidateTruncateCancelInConnectedCallback) { … }
static const auto kPreserveRequestHeaders = …;
TEST_F(HttpCacheSimpleGetTest, PreserveRequestHeaders) { … }
TEST_F(HttpCacheTest, ConditionalizedGetPreserveRequestHeaders) { … }
TEST_F(HttpCacheSimpleGetTest, ManyReaders) { … }
HttpCacheRangeGetTest;
TEST_F(HttpCacheRangeGetTest, FullAfterPartial) { … }
TEST_F(HttpCacheRangeGetTest, OverlappingRangesCouldntConditionalize) { … }
TEST_F(HttpCacheRangeGetTest, FullAfterPartialReuse) { … }
TEST_F(HttpCacheRangeGetTest, ConnectedCallbackCalledForEachRange) { … }
TEST_F(HttpCacheRangeGetTest, ConnectedCallbackReturnInconsistentIpError) { … }
TEST_F(HttpCacheRangeGetTest,
ConnectedCallbackReturnInconsistentIpErrorForNetwork) { … }
TEST_F(HttpCacheRangeGetTest, ConnectedCallbackReturnErrorSecondTime) { … }
TEST_F(HttpCacheRangeGetTest, ConnectedCallbackCalledForEachRangeWithPrefix) { … }
TEST_F(HttpCacheRangeGetTest, FailedCacheAccess) { … }
TEST_F(HttpCacheRangeGetTest, ParallelValidationNoMatch) { … }
TEST_F(HttpCacheRangeGetTest, ParallelValidationNoMatchDoomEntry) { … }
TEST_F(HttpCacheRangeGetTest, ParallelValidationNoMatchDoomEntry1) { … }
TEST_F(HttpCacheRangeGetTest, ParallelValidationDifferentRanges) { … }
TEST_F(HttpCacheRangeGetTest, DoNotCreateWritersWhenReaderExists) { … }
TEST_F(HttpCacheRangeGetTest, ParallelValidationCacheLockTimeout) { … }
TEST_F(HttpCacheRangeGetTest, ParallelValidationCouldntConditionalize) { … }
TEST_F(HttpCacheRangeGetTest, ParallelValidationCouldConditionalize) { … }
TEST_F(HttpCacheRangeGetTest, ParallelValidationOverlappingRanges) { … }
TEST_F(HttpCacheRangeGetTest, ParallelValidationRestartDoneHeaders) { … }
TEST_F(HttpCacheRangeGetTest, CachedRedirect) { … }
TEST_F(HttpCacheSimpleGetTest, ValidationFailureWithCreateFailure) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelValidationNoMatch) { … }
TEST_F(HttpCacheRangeGetTest, Enormous) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelValidationNoMatch1) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelValidationDelete) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelValidationCancelValidated) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelWritingCancelIdleTransaction) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelValidationValidatedTimeout) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelValidationCancelReader) { … }
TEST_F(HttpCacheSimpleGetTest, HangingCacheWriteCleanup) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelWritingCancelWriter) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelWritingNetworkReadFailed) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelWritingCacheWriteFailed) { … }
HttpCacheSimplePostTest;
TEST_F(HttpCacheSimplePostTest, ParallelWritingDisallowed) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelWritingSuccess) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelWritingHuge) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelWritingVerifyNetworkBytes) { … }
TEST_F(HttpCacheSimpleGetTest, ExtraRead) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelValidationCancelWriter) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelValidationStopCaching) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelWritersStopCachingNoOp) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelValidationCancelHeaders) { … }
TEST_F(HttpCacheSimpleGetTest, ParallelWritersFailWrite) { … }
TEST_F(HttpCacheSimpleGetTest, RacingReaders) { … }
TEST_F(HttpCacheSimpleGetTest, DoomWithPending) { … }
TEST_F(HttpCacheTest, DoomDoesNotSetHints) { … }
TEST_F(HttpCacheTest, FastNoStoreGetDoneWithPending) { … }
TEST_F(HttpCacheSimpleGetTest, ManyWritersCancelFirst) { … }
TEST_F(HttpCacheSimpleGetTest, ManyWritersCancelCreate) { … }
TEST_F(HttpCacheSimpleGetTest, CancelCreate) { … }
TEST_F(HttpCacheSimpleGetTest, ManyWritersBypassCache) { … }
TEST_F(HttpCacheSimpleGetTest, WriterTimeout) { … }
TEST_F(HttpCacheSimpleGetTest, WriterTimeoutReadOnlyError) { … }
TEST_F(HttpCacheSimpleGetTest, AbandonedCacheRead) { … }
TEST_F(HttpCacheSimpleGetTest, ManyWritersDeleteCache) { … }
TEST_F(HttpCacheSimpleGetTest, WaitForBackend) { … }
TEST_F(HttpCacheSimpleGetTest, WaitForBackend_CancelCreate) { … }
TEST_F(HttpCacheTest, DeleteCacheWaitingForBackend) { … }
TEST_F(HttpCacheTest, DeleteCacheWaitingForBackend2) { … }
TEST_F(HttpCacheTest, TypicalGetConditionalRequest) { … }
static const auto kETagGetConditionalRequestHandler = …;
HttpCacheETagGetTest;
TEST_F(HttpCacheETagGetTest, ConditionalRequest304) { … }
class RevalidationServer { … };
HttpCacheGetTest;
TEST_F(HttpCacheGetTest, ValidateCacheVaryMatch) { … }
TEST_F(HttpCacheGetTest, ValidateCacheVaryMismatch) { … }
TEST_F(HttpCacheGetTest, ValidateCacheVaryMismatchStar) { … }
TEST_F(HttpCacheGetTest, DontValidateCacheVaryMismatch) { … }
TEST_F(HttpCacheGetTest, ValidateCacheVaryMatchUpdateVary) { … }
TEST_F(HttpCacheGetTest, ValidateCacheVaryMismatchUpdateRequestHeader) { … }
TEST_F(HttpCacheGetTest, ValidateCacheVaryMatchDontDeleteVary) { … }
TEST_F(HttpCacheGetTest, ValidateCacheVaryMismatchDontDeleteVary) { … }
static void ETagGet_UnconditionalRequest_Handler(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) { … }
TEST_F(HttpCacheETagGetTest, Http10) { … }
TEST_F(HttpCacheETagGetTest, Http10Range) { … }
static void ETagGet_ConditionalRequest_NoStore_Handler(
const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) { … }
TEST_F(HttpCacheETagGetTest, ConditionalRequest304NoStore) { … }
static void ConditionalizedRequestUpdatesCacheHelper(
const Response& net_response_1,
const Response& net_response_2,
const Response& cached_response_2,
const char* extra_request_headers) { … }
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache1) { … }
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache2) { … }
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache3) { … }
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache4) { … }
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache5) { … }
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache6) { … }
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache7) { … }
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache8) { … }
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache9) { … }
TEST_F(HttpCacheTest, ConditionalizedRequestUpdatesCache10) { … }
TEST_F(HttpCacheTest, UrlContainingHash) { … }
TEST_F(HttpCacheSimplePostTest, SkipsCache) { … }
TEST_F(HttpCacheSimplePostTest, DisabledCache) { … }
TEST_F(HttpCacheSimplePostTest, LoadOnlyFromCacheMiss) { … }
HttpCacheSimplePostTest;
TEST_F(HttpCacheSimplePostTest, LoadOnlyFromCacheHit) { … }
TEST_F(HttpCacheSimplePostTest, WithRanges) { … }
TEST_F(HttpCacheSimplePostTest, SeparateCache) { … }
TEST_F(HttpCacheSimplePostTest, Invalidate205) { … }
TEST_F(HttpCacheTestSplitCacheFeatureEnabled,
SimplePostInvalidate205SplitCache) { … }
TEST_F(HttpCacheSimplePostTest, NoUploadIdInvalidate205) { … }
TEST_F(HttpCacheSimplePostTest, NoUploadIdNoBackend) { … }
TEST_F(HttpCacheSimplePostTest, DontInvalidate100) { … }
HttpCacheSimpleHeadTest;
TEST_F(HttpCacheSimpleHeadTest, LoadOnlyFromCacheMiss) { … }
TEST_F(HttpCacheSimpleHeadTest, LoadOnlyFromCacheHit) { … }
TEST_F(HttpCacheSimpleHeadTest, ContentLengthOnHitRead) { … }
TEST_F(HttpCacheTest, ETagHeadContentLengthOnHitReadWrite) { … }
TEST_F(HttpCacheSimpleHeadTest, WithRanges) { … }
TEST_F(HttpCacheSimpleHeadTest, WithCachedRanges) { … }
TEST_F(HttpCacheSimpleHeadTest, WithTruncatedEntry) { … }
HttpCacheTypicalHeadTest;
TEST_F(HttpCacheTypicalHeadTest, UpdatesResponse) { … }
TEST_F(HttpCacheTypicalHeadTest, ConditionalizedRequestUpdatesResponse) { … }
TEST_F(HttpCacheSimpleHeadTest, InvalidatesEntry) { … }
HttpCacheSimplePutTest;
TEST_F(HttpCacheSimplePutTest, Miss) { … }
TEST_F(HttpCacheSimplePutTest, Invalidate) { … }
TEST_F(HttpCacheSimplePutTest, Invalidate305) { … }
TEST_F(HttpCacheSimplePutTest, DontInvalidate404) { … }
HttpCacheSimpleDeleteTest;
TEST_F(HttpCacheSimpleDeleteTest, Miss) { … }
TEST_F(HttpCacheSimpleDeleteTest, Invalidate) { … }
TEST_F(HttpCacheSimpleDeleteTest, Invalidate301) { … }
TEST_F(HttpCacheSimpleDeleteTest, DontInvalidate416) { … }
HttpCacheSimplePatchTest;
TEST_F(HttpCacheSimplePatchTest, Invalidate) { … }
TEST_F(HttpCacheSimplePatchTest, Invalidate301) { … }
TEST_F(HttpCacheSimplePatchTest, DontInvalidate416) { … }
TEST_F(HttpCacheSimpleGetTest, DontInvalidateOnFailure) { … }
TEST_F(HttpCacheRangeGetTest, SkipsCache) { … }
TEST_F(HttpCacheRangeGetTest, SkipsCache2) { … }
TEST_F(HttpCacheSimpleGetTest, DoesntLogHeaders) { … }
TEST_F(HttpCacheRangeGetTest, LogsHeaders) { … }
TEST_F(HttpCacheTest, ExternalValidationLogsHeaders) { … }
TEST_F(HttpCacheTest, SpecialHeadersLogsHeaders) { … }
TEST_F(HttpCacheGetTest, Crazy206) { … }
TEST_F(HttpCacheGetTest, Crazy416) { … }
TEST_F(HttpCacheRangeGetTest, NoStrongValidators) { … }
TEST_F(HttpCacheRangeGetTest, NoConditionalization) { … }
TEST_F(HttpCacheRangeGetTest, NoValidationLogsRestart) { … }
TEST_F(HttpCacheGetTest, NoConditionalization) { … }
TEST_F(HttpCacheRangeGetTest, NoConditionalization2) { … }
TEST_F(HttpCacheRangeGetTest, NoContentLength) { … }
TEST_F(HttpCacheRangeGetTest, OK) { … }
TEST_F(HttpCacheRangeGetTest, CacheReadError) { … }
TEST_F(HttpCacheRangeGetTest, NoStore) { … }
TEST_F(HttpCacheRangeGetTest, NoStore304) { … }
TEST_F(HttpCacheRangeGetTest, SyncOK) { … }
TEST_F(HttpCacheTest, SparseWaitForEntry) { … }
TEST_F(HttpCacheRangeGetTest, Revalidate1) { … }
TEST_F(HttpCacheRangeGetTest, Revalidate2) { … }
TEST_F(HttpCacheRangeGetTest, 304) { … }
TEST_F(HttpCacheRangeGetTest, ModifiedResult) { … }
TEST_F(HttpCacheRangeGetTest, 206ReturnsSubrangeRangeNoCachedContent) { … }
TEST_F(HttpCacheRangeGetTest, 206ReturnsSubrangeRangeCachedContent) { … }
TEST_F(HttpCacheGetTest, 206ReturnsSubrangeRangeCachedContent) { … }
TEST_F(HttpCacheRangeGetTest, 206ReturnsWrongRangeNoCachedContent) { … }
TEST_F(HttpCacheRangeGetTest, 206ReturnsWrongRangeCachedContent) { … }
TEST_F(HttpCacheRangeGetTest, 206ReturnsSmallerFileNoCachedContent) { … }
TEST_F(HttpCacheRangeGetTest, 206ReturnsSmallerFileCachedContent) { … }
TEST_F(HttpCacheRangeGetTest, 416NoCachedContent) { … }
TEST_F(HttpCacheRangeGetTest, MovedPermanently301) { … }
HttpCacheUnknownRangeGetTest;
TEST_F(HttpCacheUnknownRangeGetTest, SuffixRangeThenIntRange) { … }
TEST_F(HttpCacheUnknownRangeGetTest, IntRangeThenSuffixRange) { … }
TEST_F(HttpCacheUnknownRangeGetTest, SuffixRangeEmptyResponse) { … }
TEST_F(HttpCacheUnknownRangeGetTest, Empty302) { … }
TEST_F(HttpCacheUnknownRangeGetTest, Empty302Replaced) { … }
TEST_F(HttpCacheUnknownRangeGetTest, Basic304) { … }
TEST_F(HttpCacheGetTest, Previous206) { … }
TEST_F(HttpCacheGetTest, Previous206NotModified) { … }
TEST_F(HttpCacheGetTest, Previous206NewContent) { … }
TEST_F(HttpCacheGetTest, Previous206NotSparse) { … }
TEST_F(HttpCacheRangeGetTest, Previous206NotSparser2) { … }
TEST_F(HttpCacheGetTest, Previous206NotValidation) { … }
TEST_F(HttpCacheRangeGetTest, Previous200) { … }
TEST_F(HttpCacheTest, RangeRequestResultsIn200) { … }
TEST_F(HttpCacheRangeGetTest, MoreThanCurrentSize) { … }
TEST_F(HttpCacheRangeGetTest, Cancel) { … }
TEST_F(HttpCacheRangeGetTest, CancelWhileReading) { … }
TEST_F(HttpCacheRangeGetTest, Cancel2) { … }
TEST_F(HttpCacheRangeGetTest, Cancel3) { … }
TEST_F(HttpCacheRangeGetTest, InvalidResponse1) { … }
TEST_F(HttpCacheRangeGetTest, InvalidResponse2) { … }
TEST_F(HttpCacheRangeGetTest, InvalidResponse3) { … }
TEST_F(HttpCacheRangeGetTest, LargeValues) { … }
TEST_F(HttpCacheRangeGetTest, NoDiskCache) { … }
TEST_F(HttpCacheTest, RangeHead) { … }
TEST_F(HttpCacheRangeGetTest, FastFlakyServer) { … }
TEST_F(HttpCacheRangeGetTest, FastFlakyServer2) { … }
TEST_F(HttpCacheRangeGetTest, OkLoadOnlyFromCache) { … }
TEST_F(HttpCacheTest, WriteResponseInfoTruncated) { … }
TEST_F(HttpCacheTest, PersistHttpResponseInfo) { … }
TEST_F(HttpCacheTest, DoomOnDestruction) { … }
TEST_F(HttpCacheTest, DoomOnDestruction2) { … }
TEST_F(HttpCacheTest, DoomOnDestruction3) { … }
TEST_F(HttpCacheTest, SetTruncatedFlag) { … }
TEST_F(HttpCacheTest, DontSetTruncatedFlagForGarbledResponseCode) { … }
TEST_F(HttpCacheTest, DontSetTruncatedFlag) { … }
TEST_F(HttpCacheRangeGetTest, DontTruncate) { … }
TEST_F(HttpCacheRangeGetTest, DontTruncate2) { … }
TEST_F(HttpCacheGetTest, IncompleteResource) { … }
TEST_F(HttpCacheGetTest, IncompleteResourceNoStore) { … }
TEST_F(HttpCacheGetTest, IncompleteResourceCancel) { … }
TEST_F(HttpCacheGetTest, IncompleteResource2) { … }
TEST_F(HttpCacheGetTest, IncompleteResource3) { … }
TEST_F(HttpCacheGetTest, IncompleteResourceWithAuth) { … }
TEST_F(HttpCacheTest, TransactionRetryLimit) { … }
TEST_F(HttpCacheGetTest, IncompleteResource4) { … }
TEST_F(HttpCacheGetTest, CancelIncompleteResource) { … }
TEST_F(HttpCacheRangeGetTest, IncompleteResource) { … }
TEST_F(HttpCacheTest, SyncRead) { … }
TEST_F(HttpCacheTest, ValidationResultsIn200) { … }
TEST_F(HttpCacheTest, CachedRedirect) { … }
TEST_F(HttpCacheTest, CacheControlNoCacheNormalLoad) { … }
TEST_F(HttpCacheTest, CacheControlNoCacheHistoryLoad) { … }
TEST_F(HttpCacheTest, CacheControlNoStore) { … }
TEST_F(HttpCacheTest, CacheControlNoStore2) { … }
TEST_F(HttpCacheTest, CacheControlNoStore3) { … }
TEST_F(HttpCacheSimpleGetTest, SSLError) { … }
TEST_F(HttpCacheTest, OutlivedTransactions) { … }
TEST_F(HttpCacheTest, CacheDisabledMode) { … }
TEST_F(HttpCacheTest, UpdatesRequestResponseTimeOn304) { … }
TEST_F(HttpCacheTestSplitCacheFeatureEnabled,
SplitCacheWithNetworkIsolationKey) { … }
TEST_F(HttpCacheTest, HttpCacheProfileThirdPartyCSS) { … }
TEST_F(HttpCacheTest, HttpCacheProfileThirdPartyJavaScript) { … }
TEST_F(HttpCacheTest, HttpCacheProfileThirdPartyFont) { … }
TEST_P(HttpCacheTestSplitCacheFeature, SplitCache) { … }
TEST_P(HttpCacheTestSplitCacheFeature, GenerateCacheKeyForRequestFailures) { … }
TEST_F(HttpCacheTest, SplitCacheEnabledByDefault) { … }
TEST_F(HttpCacheTest, SplitCacheEnabledByDefaultButOverridden) { … }
TEST_F(HttpCacheTestSplitCacheFeatureEnabled, SplitCacheUsesRegistrableDomain) { … }
TEST_F(HttpCacheTest, NonSplitCache) { … }
TEST_F(HttpCacheTest, SkipVaryCheck) { … }
TEST_F(HttpCacheTest, SkipVaryCheckStar) { … }
TEST_F(HttpCacheTest, ValidLoadOnlyFromCache) { … }
TEST_F(HttpCacheTest, InvalidLoadFlagCombination) { … }
TEST_F(HttpCacheTest, FilterCompletion) { … }
TEST_F(HttpCacheTest, DoneReading) { … }
TEST_F(HttpCacheTest, StopCachingDeletesEntry) { … }
TEST_F(HttpCacheTest, StopCachingThenDoneReadingDeletesEntry) { … }
TEST_F(HttpCacheTest, StopCachingWithAuthDeletesEntry) { … }
TEST_F(HttpCacheTest, StopCachingSavesEntry) { … }
TEST_F(HttpCacheTest, StopCachingTruncatedEntry) { … }
namespace {
enum class TransactionPhase { … };
CacheInitializer;
HugeCacheTestConfiguration;
class HttpCacheHugeResourceTest
: public ::testing::TestWithParam<HugeCacheTestConfiguration>,
public WithTaskEnvironment { … };
const int64_t HttpCacheHugeResourceTest::kTotalSize;
void HttpCacheHugeResourceTest::LargeResourceTransactionHandler(
const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) { … }
int HttpCacheHugeResourceTest::LargeBufferReader(int64_t content_length,
int64_t offset,
IOBuffer* buf,
int buf_len) { … }
void HttpCacheHugeResourceTest::SetFlagOnBeforeNetworkStart(bool* started,
bool* ) { … }
void HttpCacheHugeResourceTest::SetupTruncatedCacheEntry(MockHttpCache* cache) { … }
void HttpCacheHugeResourceTest::SetupPrefixSparseCacheEntry(
MockHttpCache* cache) { … }
void HttpCacheHugeResourceTest::SetupInfixSparseCacheEntry(
MockHttpCache* cache) { … }
std::list<HugeCacheTestConfiguration>
HttpCacheHugeResourceTest::GetTestModes() { … }
std::list<HugeCacheTestConfiguration> HttpCacheHugeResourceTest::kTestModes = …;
INSTANTIATE_TEST_SUITE_P(…);
}
TEST_P(HttpCacheHugeResourceTest,
StopCachingFollowedByReadForHugeTruncatedResource) { … }
TEST_F(HttpCacheTest, TruncatedByContentLength) { … }
TEST_F(HttpCacheTest, TruncatedByContentLength2) { … }
TEST_F(HttpCacheTest, SetPriority) { … }
TEST_F(HttpCacheTest, SetWebSocketHandshakeStreamCreateHelper) { … }
TEST_F(HttpCacheTest, SetPriorityNewTransaction) { … }
namespace {
void RunTransactionAndGetNetworkBytes(MockHttpCache* cache,
const MockTransaction& trans_info,
int64_t* sent_bytes,
int64_t* received_bytes) { … }
}
TEST_F(HttpCacheTest, NetworkBytesCacheMissAndThenHit) { … }
TEST_F(HttpCacheTest, NetworkBytesConditionalRequest304) { … }
TEST_F(HttpCacheTest, NetworkBytesConditionalRequest200) { … }
TEST_F(HttpCacheTest, NetworkBytesRange) { … }
class HttpCachePrefetchValidationTest : public TestWithTaskEnvironment { … };
TEST_F(HttpCachePrefetchValidationTest, SkipValidationShortlyAfterPrefetch) { … }
TEST_F(HttpCachePrefetchValidationTest, ValidateLongAfterPrefetch) { … }
TEST_F(HttpCachePrefetchValidationTest, SkipValidationOnceOnly) { … }
TEST_F(HttpCachePrefetchValidationTest, SkipValidationOnceReadOnly) { … }
TEST_F(HttpCachePrefetchValidationTest, BypassCacheOverwritesPrefetch) { … }
TEST_F(HttpCachePrefetchValidationTest,
SkipValidationOnExistingEntryThatNeedsValidation) { … }
TEST_F(HttpCachePrefetchValidationTest,
SkipValidationOnExistingEntryThatDoesNotNeedValidation) { … }
TEST_F(HttpCachePrefetchValidationTest, PrefetchMultipleTimes) { … }
TEST_F(HttpCachePrefetchValidationTest, ValidateOnDelayedSecondPrefetch) { … }
TEST_F(HttpCacheTest, StaleContentNotUsedWhenLoadFlagNotSet) { … }
TEST_F(HttpCacheTest, StaleContentUsedWhenLoadFlagSetAndUsableThenTimesout) { … }
TEST_F(HttpCacheTest, StaleContentUsedWhenLoadFlagSetAndUsable) { … }
TEST_F(HttpCacheTest, StaleContentNotUsedWhenUnusable) { … }
TEST_F(HttpCacheTest, StaleContentWriteError) { … }
TEST_F(HttpCacheRangeGetTest, MultipleRequests) { … }
TEST_F(HttpCacheRangeGetTest, Previous200LoadOnlyFromCache) { … }
TEST_F(HttpCacheTest, NoStoreResponseShouldNotBlockFollowingRequests) { … }
TEST_F(HttpCacheTest, CachePreservesSSLInfo) { … }
TEST_F(HttpCacheTest, RevalidationUpdatesSSLInfo) { … }
TEST_F(HttpCacheTest, CacheEntryStatusOther) { … }
TEST_F(HttpCacheTest, CacheEntryStatusNotInCache) { … }
TEST_F(HttpCacheTest, CacheEntryStatusUsed) { … }
TEST_F(HttpCacheTest, CacheEntryStatusValidated) { … }
TEST_F(HttpCacheTest, CacheEntryStatusUpdated) { … }
TEST_F(HttpCacheTest, CacheEntryStatusCantConditionalize) { … }
TEST_F(HttpSplitCacheKeyTest, GetResourceURLFromHttpCacheKey) { … }
TEST_F(HttpCacheTest, GetResourceURLFromHttpCacheKey) { … }
class TestCompletionCallbackForHttpCache : public TestCompletionCallbackBase { … };
TEST_F(HttpCacheIOCallbackTest, FailedDoomFollowedByOpen) { … }
TEST_F(HttpCacheIOCallbackTest, FailedDoomFollowedByCreate) { … }
TEST_F(HttpCacheIOCallbackTest, FailedDoomFollowedByDoom) { … }
TEST_F(HttpCacheIOCallbackTest, FailedOpenFollowedByCreate) { … }
TEST_F(HttpCacheIOCallbackTest, FailedCreateFollowedByOpen) { … }
TEST_F(HttpCacheIOCallbackTest, FailedCreateFollowedByCreate) { … }
TEST_F(HttpCacheIOCallbackTest, CreateFollowedByCreate) { … }
TEST_F(HttpCacheIOCallbackTest, OperationFollowedByDoom) { … }
TEST_F(HttpCacheIOCallbackTest, CreateFollowedByOpenOrCreate) { … }
TEST_F(HttpCacheIOCallbackTest, FailedCreateFollowedByOpenOrCreate) { … }
TEST_F(HttpCacheIOCallbackTest, OpenFollowedByOpenOrCreate) { … }
TEST_F(HttpCacheIOCallbackTest, FailedOpenFollowedByOpenOrCreate) { … }
TEST_F(HttpCacheIOCallbackTest, OpenOrCreateFollowedByCreate) { … }
TEST_F(HttpCacheIOCallbackTest, OpenOrCreateFollowedByOpenOrCreate) { … }
TEST_F(HttpCacheIOCallbackTest, FailedOpenOrCreateFollowedByOpenOrCreate) { … }
TEST_F(HttpCacheTest, DnsAliasesNoRevalidation) { … }
TEST_F(HttpCacheTest, NoDnsAliasesNoRevalidation) { … }
TEST_F(HttpCacheTest, DnsAliasesRevalidation) { … }
HttpCacheFirstPartySetsBypassCacheTest;
TEST_F(HttpCacheFirstPartySetsBypassCacheTest, ShouldBypassNoId) { … }
TEST_F(HttpCacheFirstPartySetsBypassCacheTest, ShouldBypassIdTooSmall) { … }
TEST_F(HttpCacheFirstPartySetsBypassCacheTest, ShouldNotBypass) { … }
TEST_F(HttpCacheFirstPartySetsBypassCacheTest, ShouldNotBypassNoFilter) { … }
TEST_F(HttpCacheTest, SecurityHeadersAreCopiedToConditionalizedResponse) { … }
}