| Index: net/http/http_cache_unittest.cc
|
| diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
|
| index 60c7ed7c8d75d286465b15c12b4806d86acc6b87..05d1ca4d2ec629c379b298bf6710aa6ae466c2b7 100644
|
| --- a/net/http/http_cache_unittest.cc
|
| +++ b/net/http/http_cache_unittest.cc
|
| @@ -639,7 +639,7 @@ bool LogContainsEventType(const BoundTestNetLog& log,
|
| // Tests.
|
|
|
| TEST(HttpCache, CreateThenDestroy) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| std::unique_ptr<HttpTransaction> trans;
|
| EXPECT_THAT(cache.CreateTransaction(&trans), IsOk());
|
| @@ -647,7 +647,7 @@ TEST(HttpCache, CreateThenDestroy) {
|
| }
|
|
|
| TEST(HttpCache, GetBackend) {
|
| - MockHttpCache cache(HttpCache::DefaultBackend::InMemory(0));
|
| + MockHttpCache cache(HttpCache::DefaultBackend::InMemory(0), false);
|
|
|
| disk_cache::Backend* backend;
|
| TestCompletionCallback cb;
|
| @@ -657,7 +657,7 @@ TEST(HttpCache, GetBackend) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| BoundTestNetLog log;
|
| LoadTimingInfo load_timing_info;
|
|
|
| @@ -672,7 +672,7 @@ TEST(HttpCache, SimpleGET) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGETNoDiskCache) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| cache.disk_cache()->set_fail_requests();
|
|
|
| @@ -715,7 +715,7 @@ TEST(HttpCache, SimpleGETNoDiskCache2) {
|
| new MockBlockingBackendFactory());
|
| factory->set_fail(true);
|
| factory->FinishCreation(); // We'll complete synchronously.
|
| - MockHttpCache cache(std::move(factory));
|
| + MockHttpCache cache(std::move(factory), false);
|
|
|
| // Read from the network, and don't use the cache.
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
| @@ -726,7 +726,7 @@ TEST(HttpCache, SimpleGETNoDiskCache2) {
|
|
|
| // Tests that IOBuffers are not referenced after IO completes.
|
| TEST(HttpCache, ReleaseBuffer) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
| @@ -747,7 +747,7 @@ TEST(HttpCache, ReleaseBuffer) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGETWithDiskFailures) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| cache.disk_cache()->set_soft_failures(true);
|
|
|
| @@ -769,7 +769,7 @@ TEST(HttpCache, SimpleGETWithDiskFailures) {
|
| // Tests that disk failures after the transaction has started don't cause the
|
| // request to fail.
|
| TEST(HttpCache, SimpleGETWithDiskFailures2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
|
|
| @@ -806,7 +806,7 @@ TEST(HttpCache, SimpleGETWithDiskFailures2) {
|
|
|
| // Tests that we handle failures to read from the cache.
|
| TEST(HttpCache, SimpleGETWithDiskFailures3) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Read from the network, and write to the cache.
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
| @@ -841,7 +841,7 @@ TEST(HttpCache, SimpleGETWithDiskFailures3) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Hit) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| BoundTestNetLog log;
|
| LoadTimingInfo load_timing_info;
|
| @@ -913,7 +913,7 @@ TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Hit) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Miss) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // force this transaction to read from the cache
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| @@ -938,7 +938,7 @@ TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Miss) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET_LoadPreferringCache_Hit) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // write to the cache
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
| @@ -955,7 +955,7 @@ TEST(HttpCache, SimpleGET_LoadPreferringCache_Hit) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET_LoadPreferringCache_Miss) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // force this transaction to read from the cache if valid
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| @@ -970,7 +970,7 @@ TEST(HttpCache, SimpleGET_LoadPreferringCache_Miss) {
|
|
|
| // Tests LOAD_SKIP_CACHE_VALIDATION in the presence of vary headers.
|
| TEST(HttpCache, SimpleGET_LoadPreferringCache_VaryMatch) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| @@ -992,7 +992,7 @@ TEST(HttpCache, SimpleGET_LoadPreferringCache_VaryMatch) {
|
|
|
| // Tests LOAD_SKIP_CACHE_VALIDATION in the presence of vary headers.
|
| TEST(HttpCache, SimpleGET_LoadPreferringCache_VaryMismatch) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| @@ -1021,7 +1021,7 @@ TEST(HttpCache, SimpleGET_LoadPreferringCache_VaryMismatch) {
|
| // Tests that was_cached was set properly on a failure, even if the cached
|
| // response wasn't returned.
|
| TEST(HttpCache, SimpleGET_CacheSignal_Failure) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Prime cache.
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| @@ -1056,7 +1056,7 @@ TEST(HttpCache, SimpleGET_CacheSignal_Failure) {
|
|
|
| // Confirm if we have an empty cache, a read is marked as network verified.
|
| TEST(HttpCache, SimpleGET_NetworkAccessed_Network) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // write to the cache
|
| HttpResponseInfo response_info;
|
| @@ -1074,7 +1074,7 @@ TEST(HttpCache, SimpleGET_NetworkAccessed_Network) {
|
| // Confirm if we have a fresh entry in cache, it isn't marked as
|
| // network verified.
|
| TEST(HttpCache, SimpleGET_NetworkAccessed_Cache) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Prime cache.
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| @@ -1095,7 +1095,7 @@ TEST(HttpCache, SimpleGET_NetworkAccessed_Cache) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET_LoadBypassCache) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
| @@ -1141,7 +1141,7 @@ TEST(HttpCache, SimpleGET_LoadBypassCache) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET_LoadBypassCache_Implicit) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // write to the cache
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
| @@ -1158,7 +1158,7 @@ TEST(HttpCache, SimpleGET_LoadBypassCache_Implicit) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET_LoadBypassCache_Implicit2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // write to the cache
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
| @@ -1175,7 +1175,7 @@ TEST(HttpCache, SimpleGET_LoadBypassCache_Implicit2) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET_LoadValidateCache) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
| @@ -1202,7 +1202,7 @@ TEST(HttpCache, SimpleGET_LoadValidateCache) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET_LoadValidateCache_Implicit) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // write to the cache
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
| @@ -1224,7 +1224,7 @@ TEST(HttpCache, SimpleGET_LoadValidateCache_Implicit) {
|
| // Tests that |unused_since_prefetch| is updated accordingly (e.g. it is set to
|
| // true after a prefetch and set back to false when the prefetch is used).
|
| TEST(HttpCache, SimpleGET_UnusedSincePrefetch) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| HttpResponseInfo response_info;
|
|
|
| // A normal load does not have |unused_since_prefetch| set.
|
| @@ -1274,7 +1274,7 @@ static void PreserveRequestHeaders_Handler(const HttpRequestInfo* request,
|
|
|
| // Tests that we don't remove extra headers for simple requests.
|
| TEST(HttpCache, SimpleGET_PreserveRequestHeaders) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| transaction.handler = PreserveRequestHeaders_Handler;
|
| @@ -1294,7 +1294,7 @@ TEST(HttpCache, SimpleGET_PreserveRequestHeaders) {
|
|
|
| // Tests that we don't remove extra headers for conditionalized requests.
|
| TEST(HttpCache, ConditionalizedGET_PreserveRequestHeaders) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| RunTransactionTest(cache.http_cache(), kETagGET_Transaction);
|
| @@ -1314,7 +1314,7 @@ TEST(HttpCache, ConditionalizedGET_PreserveRequestHeaders) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET_ManyReaders) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
|
|
| @@ -1380,7 +1380,7 @@ TEST(HttpCache, SimpleGET_ManyReaders) {
|
| // finishing, we have to make sure that we remove both transactions from the
|
| // entry.
|
| TEST(HttpCache, SimpleGET_RacingReaders) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
| MockHttpRequest reader_request(kSimpleGET_Transaction);
|
| @@ -1464,7 +1464,7 @@ TEST(HttpCache, SimpleGET_RacingReaders) {
|
| // See http://code.google.com/p/chromium/issues/detail?id=25588
|
| TEST(HttpCache, SimpleGET_DoomWithPending) {
|
| // We need simultaneous doomed / not_doomed entries so let's use a real cache.
|
| - MockHttpCache cache(HttpCache::DefaultBackend::InMemory(1024 * 1024));
|
| + MockHttpCache cache(HttpCache::DefaultBackend::InMemory(1024 * 1024), false);
|
|
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
| MockHttpRequest writer_request(kSimpleGET_Transaction);
|
| @@ -1510,7 +1510,7 @@ TEST(HttpCache, SimpleGET_DoomWithPending) {
|
| // We may attempt to delete an entry synchronously with the act of adding a new
|
| // transaction to said entry.
|
| TEST(HttpCache, FastNoStoreGET_DoneWithPending) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // The headers will be served right from the call to Start() the request.
|
| MockHttpRequest request(kFastNoStoreGET_Transaction);
|
| @@ -1560,7 +1560,7 @@ TEST(HttpCache, FastNoStoreGET_DoneWithPending) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET_ManyWriters_CancelFirst) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
|
|
| @@ -1620,7 +1620,7 @@ TEST(HttpCache, SimpleGET_ManyWriters_CancelFirst) {
|
| // Tests that we can cancel requests that are queued waiting to open the disk
|
| // cache entry.
|
| TEST(HttpCache, SimpleGET_ManyWriters_CancelCreate) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
|
|
| @@ -1676,7 +1676,7 @@ TEST(HttpCache, SimpleGET_ManyWriters_CancelCreate) {
|
|
|
| // Tests that we can cancel a single request to open a disk cache entry.
|
| TEST(HttpCache, SimpleGET_CancelCreate) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
|
|
| @@ -1700,7 +1700,7 @@ TEST(HttpCache, SimpleGET_CancelCreate) {
|
|
|
| // Tests that we delete/create entries even if multiple requests are queued.
|
| TEST(HttpCache, SimpleGET_ManyWriters_BypassCache) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
| request.load_flags = LOAD_BYPASS_CACHE;
|
| @@ -1747,7 +1747,7 @@ TEST(HttpCache, SimpleGET_ManyWriters_BypassCache) {
|
| // Tests that a (simulated) timeout allows transactions waiting on the cache
|
| // lock to continue.
|
| TEST(HttpCache, SimpleGET_WriterTimeout) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| cache.BypassCacheLock();
|
|
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
| @@ -1770,7 +1770,7 @@ TEST(HttpCache, SimpleGET_WriterTimeout) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET_AbandonedCacheRead) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // write to the cache
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
| @@ -1802,7 +1802,7 @@ TEST(HttpCache, SimpleGET_AbandonedCacheRead) {
|
| // ("waiting for the backend" as opposed to Active or Doomed entries).
|
| TEST(HttpCache, SimpleGET_ManyWriters_DeleteCache) {
|
| std::unique_ptr<MockHttpCache> cache(
|
| - new MockHttpCache(base::WrapUnique(new MockBackendNoCbFactory())));
|
| + new MockHttpCache(base::WrapUnique(new MockBackendNoCbFactory()), false));
|
|
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
|
|
| @@ -1839,7 +1839,7 @@ TEST(HttpCache, SimpleGET_ManyWriters_DeleteCache) {
|
| // Tests that we queue requests when initializing the backend.
|
| TEST(HttpCache, SimpleGET_WaitForBackend) {
|
| MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
|
| - MockHttpCache cache(base::WrapUnique(factory));
|
| + MockHttpCache cache(base::WrapUnique(factory), false);
|
|
|
| MockHttpRequest request0(kSimpleGET_Transaction);
|
| MockHttpRequest request1(kTypicalGET_Transaction);
|
| @@ -1885,7 +1885,7 @@ TEST(HttpCache, SimpleGET_WaitForBackend) {
|
| // to be initialized.
|
| TEST(HttpCache, SimpleGET_WaitForBackend_CancelCreate) {
|
| MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
|
| - MockHttpCache cache(base::WrapUnique(factory));
|
| + MockHttpCache cache(base::WrapUnique(factory), false);
|
|
|
| MockHttpRequest request0(kSimpleGET_Transaction);
|
| MockHttpRequest request1(kTypicalGET_Transaction);
|
| @@ -1940,7 +1940,7 @@ TEST(HttpCache, SimpleGET_WaitForBackend_CancelCreate) {
|
| TEST(HttpCache, DeleteCacheWaitingForBackend) {
|
| MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
|
| std::unique_ptr<MockHttpCache> cache(
|
| - new MockHttpCache(base::WrapUnique(factory)));
|
| + new MockHttpCache(base::WrapUnique(factory), false));
|
|
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
|
|
| @@ -1972,7 +1972,7 @@ TEST(HttpCache, DeleteCacheWaitingForBackend) {
|
| // one of the callbacks.
|
| TEST(HttpCache, DeleteCacheWaitingForBackend2) {
|
| MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
|
| - MockHttpCache* cache = new MockHttpCache(base::WrapUnique(factory));
|
| + MockHttpCache* cache = new MockHttpCache(base::WrapUnique(factory), false);
|
|
|
| DeleteCacheCompletionCallback cb(cache);
|
| disk_cache::Backend* backend;
|
| @@ -2017,7 +2017,7 @@ TEST(HttpCache, DeleteCacheWaitingForBackend2) {
|
| #define MAYBE_TypicalGET_ConditionalRequest TypicalGET_ConditionalRequest
|
| #endif
|
| TEST(HttpCache, MAYBE_TypicalGET_ConditionalRequest) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // write to the cache
|
| RunTransactionTest(cache.http_cache(), kTypicalGET_Transaction);
|
| @@ -2051,7 +2051,7 @@ static void ETagGet_ConditionalRequest_Handler(const HttpRequestInfo* request,
|
| }
|
|
|
| TEST(HttpCache, ETagGET_ConditionalRequest_304) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kETagGET_Transaction);
|
|
|
| @@ -2127,7 +2127,7 @@ void RevalidationServer::Handler(const HttpRequestInfo* request,
|
|
|
| // Tests revalidation after a vary match.
|
| TEST(HttpCache, GET_ValidateCache_VaryMatch) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| MockTransaction transaction(kTypicalGET_Transaction);
|
| @@ -2160,7 +2160,7 @@ TEST(HttpCache, GET_ValidateCache_VaryMatch) {
|
|
|
| // Tests revalidation after a vary mismatch if etag is present.
|
| TEST(HttpCache, GET_ValidateCache_VaryMismatch) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| MockTransaction transaction(kTypicalGET_Transaction);
|
| @@ -2194,7 +2194,7 @@ TEST(HttpCache, GET_ValidateCache_VaryMismatch) {
|
|
|
| // Tests lack of revalidation after a vary mismatch and no etag.
|
| TEST(HttpCache, GET_DontValidateCache_VaryMismatch) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| MockTransaction transaction(kTypicalGET_Transaction);
|
| @@ -2227,7 +2227,7 @@ TEST(HttpCache, GET_DontValidateCache_VaryMismatch) {
|
|
|
| // Tests that a new vary header provided when revalidating an entry is saved.
|
| TEST(HttpCache, GET_ValidateCache_VaryMatch_UpdateVary) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| ScopedMockTransaction transaction(kTypicalGET_Transaction);
|
| @@ -2266,7 +2266,7 @@ TEST(HttpCache, GET_ValidateCache_VaryMatch_UpdateVary) {
|
| // Tests that new request headers causing a vary mismatch are paired with the
|
| // new response when the server says the old response can be used.
|
| TEST(HttpCache, GET_ValidateCache_VaryMismatch_UpdateRequestHeader) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| ScopedMockTransaction transaction(kTypicalGET_Transaction);
|
| @@ -2301,7 +2301,7 @@ TEST(HttpCache, GET_ValidateCache_VaryMismatch_UpdateRequestHeader) {
|
| // Tests that a 304 without vary headers doesn't delete the previously stored
|
| // vary data after a vary match revalidation.
|
| TEST(HttpCache, GET_ValidateCache_VaryMatch_DontDeleteVary) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| ScopedMockTransaction transaction(kTypicalGET_Transaction);
|
| @@ -2338,7 +2338,7 @@ TEST(HttpCache, GET_ValidateCache_VaryMatch_DontDeleteVary) {
|
| // Tests that a 304 without vary headers doesn't delete the previously stored
|
| // vary data after a vary mismatch.
|
| TEST(HttpCache, GET_ValidateCache_VaryMismatch_DontDeleteVary) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| ScopedMockTransaction transaction(kTypicalGET_Transaction);
|
| @@ -2382,7 +2382,7 @@ static void ETagGet_UnconditionalRequest_Handler(const HttpRequestInfo* request,
|
| }
|
|
|
| TEST(HttpCache, ETagGET_Http10) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kETagGET_Transaction);
|
| transaction.status = "HTTP/1.0 200 OK";
|
| @@ -2405,7 +2405,7 @@ TEST(HttpCache, ETagGET_Http10) {
|
| }
|
|
|
| TEST(HttpCache, ETagGET_Http10_Range) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kETagGET_Transaction);
|
| transaction.status = "HTTP/1.0 200 OK";
|
| @@ -2441,7 +2441,7 @@ static void ETagGet_ConditionalRequest_NoStore_Handler(
|
| }
|
|
|
| TEST(HttpCache, ETagGET_ConditionalRequest_304_NoStore) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kETagGET_Transaction);
|
|
|
| @@ -2485,7 +2485,7 @@ static void ConditionalizedRequestUpdatesCacheHelper(
|
| const Response& net_response_2,
|
| const Response& cached_response_2,
|
| const char* extra_request_headers) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // The URL we will be requesting.
|
| const char kUrl[] = "http://foobar.com/main.css";
|
| @@ -2674,7 +2674,7 @@ TEST(HttpCache, ConditionalizedRequestUpdatesCache3) {
|
| // and there is no corresponding cache entry, a new cache entry is NOT
|
| // created (304 response).
|
| TEST(HttpCache, ConditionalizedRequestUpdatesCache4) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| const char kUrl[] = "http://foobar.com/main.css";
|
|
|
| @@ -2718,7 +2718,7 @@ TEST(HttpCache, ConditionalizedRequestUpdatesCache4) {
|
| // and there is no corresponding cache entry, a new cache entry is NOT
|
| // created (200 response).
|
| TEST(HttpCache, ConditionalizedRequestUpdatesCache5) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| const char kUrl[] = "http://foobar.com/main.css";
|
|
|
| @@ -2904,7 +2904,7 @@ TEST(HttpCache, ConditionalizedRequestUpdatesCache10) {
|
| }
|
|
|
| TEST(HttpCache, UrlContainingHash) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Do a typical GET request -- should write an entry into our cache.
|
| MockTransaction trans(kTypicalGET_Transaction);
|
| @@ -2930,7 +2930,7 @@ TEST(HttpCache, UrlContainingHash) {
|
| // Tests that we skip the cache for POST requests that do not have an upload
|
| // identifier.
|
| TEST(HttpCache, SimplePOST_SkipsCache) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| RunTransactionTest(cache.http_cache(), kSimplePOST_Transaction);
|
|
|
| @@ -2941,7 +2941,7 @@ TEST(HttpCache, SimplePOST_SkipsCache) {
|
|
|
| // Tests POST handling with a disabled cache (no DCHECK).
|
| TEST(HttpCache, SimplePOST_DisabledCache) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| cache.http_cache()->set_mode(HttpCache::Mode::DISABLE);
|
|
|
| RunTransactionTest(cache.http_cache(), kSimplePOST_Transaction);
|
| @@ -2952,7 +2952,7 @@ TEST(HttpCache, SimplePOST_DisabledCache) {
|
| }
|
|
|
| TEST(HttpCache, SimplePOST_LoadOnlyFromCache_Miss) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimplePOST_Transaction);
|
| transaction.load_flags |= LOAD_ONLY_FROM_CACHE | LOAD_SKIP_CACHE_VALIDATION;
|
| @@ -2975,7 +2975,7 @@ TEST(HttpCache, SimplePOST_LoadOnlyFromCache_Miss) {
|
| }
|
|
|
| TEST(HttpCache, SimplePOST_LoadOnlyFromCache_Hit) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Test that we hit the cache for POST requests.
|
|
|
| @@ -3009,7 +3009,7 @@ TEST(HttpCache, SimplePOST_LoadOnlyFromCache_Hit) {
|
|
|
| // Test that we don't hit the cache for POST requests if there is a byte range.
|
| TEST(HttpCache, SimplePOST_WithRanges) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimplePOST_Transaction);
|
| transaction.request_headers = "Range: bytes = 0-4\r\n";
|
| @@ -3035,7 +3035,7 @@ TEST(HttpCache, SimplePOST_WithRanges) {
|
|
|
| // Tests that a POST is cached separately from a GET.
|
| TEST(HttpCache, SimplePOST_SeparateCache) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| std::vector<std::unique_ptr<UploadElementReader>> element_readers;
|
| element_readers.push_back(
|
| @@ -3064,7 +3064,7 @@ TEST(HttpCache, SimplePOST_SeparateCache) {
|
|
|
| // Tests that a successful POST invalidates a previously cached GET.
|
| TEST(HttpCache, SimplePOST_Invalidate_205) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| AddMockTransaction(&transaction);
|
| @@ -3104,7 +3104,7 @@ TEST(HttpCache, SimplePOST_Invalidate_205) {
|
| // Tests that a successful POST invalidates a previously cached GET, even when
|
| // there is no upload identifier.
|
| TEST(HttpCache, SimplePOST_NoUploadId_Invalidate_205) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| AddMockTransaction(&transaction);
|
| @@ -3148,7 +3148,7 @@ TEST(HttpCache, SimplePOST_NoUploadId_NoBackend) {
|
| new MockBlockingBackendFactory());
|
| factory->set_fail(true);
|
| factory->FinishCreation();
|
| - MockHttpCache cache(std::move(factory));
|
| + MockHttpCache cache(std::move(factory), false);
|
|
|
| std::vector<std::unique_ptr<UploadElementReader>> element_readers;
|
| element_readers.push_back(
|
| @@ -3167,7 +3167,7 @@ TEST(HttpCache, SimplePOST_NoUploadId_NoBackend) {
|
|
|
| // Tests that we don't invalidate entries as a result of a failed POST.
|
| TEST(HttpCache, SimplePOST_DontInvalidate_100) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| AddMockTransaction(&transaction);
|
| @@ -3206,7 +3206,7 @@ TEST(HttpCache, SimplePOST_DontInvalidate_100) {
|
|
|
| // Tests that a HEAD request is not cached by itself.
|
| TEST(HttpCache, SimpleHEAD_LoadOnlyFromCache_Miss) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| MockTransaction transaction(kSimplePOST_Transaction);
|
| AddMockTransaction(&transaction);
|
| transaction.load_flags |= LOAD_ONLY_FROM_CACHE | LOAD_SKIP_CACHE_VALIDATION;
|
| @@ -3232,7 +3232,7 @@ TEST(HttpCache, SimpleHEAD_LoadOnlyFromCache_Miss) {
|
|
|
| // Tests that a HEAD request is served from a cached GET.
|
| TEST(HttpCache, SimpleHEAD_LoadOnlyFromCache_Hit) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| AddMockTransaction(&transaction);
|
|
|
| @@ -3257,7 +3257,7 @@ TEST(HttpCache, SimpleHEAD_LoadOnlyFromCache_Hit) {
|
|
|
| // Tests that a read-only request served from the cache preserves CL.
|
| TEST(HttpCache, SimpleHEAD_ContentLengthOnHit_Read) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| AddMockTransaction(&transaction);
|
| transaction.response_headers = "Content-Length: 42\n";
|
| @@ -3279,7 +3279,7 @@ TEST(HttpCache, SimpleHEAD_ContentLengthOnHit_Read) {
|
|
|
| // Tests that a read-write request served from the cache preserves CL.
|
| TEST(HttpCache, ETagHEAD_ContentLengthOnHit_ReadWrite) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| MockTransaction transaction(kETagGET_Transaction);
|
| AddMockTransaction(&transaction);
|
| std::string server_headers(kETagGET_Transaction.response_headers);
|
| @@ -3302,7 +3302,7 @@ TEST(HttpCache, ETagHEAD_ContentLengthOnHit_ReadWrite) {
|
|
|
| // Tests that a HEAD request that includes byte ranges bypasses the cache.
|
| TEST(HttpCache, SimpleHEAD_WithRanges) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| AddMockTransaction(&transaction);
|
|
|
| @@ -3323,7 +3323,7 @@ TEST(HttpCache, SimpleHEAD_WithRanges) {
|
|
|
| // Tests that a HEAD request can be served from a partialy cached resource.
|
| TEST(HttpCache, SimpleHEAD_WithCachedRanges) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| // Write to the cache (40-49).
|
| @@ -3352,7 +3352,7 @@ TEST(HttpCache, SimpleHEAD_WithCachedRanges) {
|
|
|
| // Tests that a HEAD request can be served from a truncated resource.
|
| TEST(HttpCache, SimpleHEAD_WithTruncatedEntry) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| std::string raw_headers("HTTP/1.1 200 OK\n"
|
| @@ -3385,7 +3385,7 @@ TEST(HttpCache, SimpleHEAD_WithTruncatedEntry) {
|
|
|
| // Tests that a HEAD request updates the cached response.
|
| TEST(HttpCache, TypicalHEAD_UpdatesResponse) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| MockTransaction transaction(kTypicalGET_Transaction);
|
| AddMockTransaction(&transaction);
|
|
|
| @@ -3423,7 +3423,7 @@ TEST(HttpCache, TypicalHEAD_UpdatesResponse) {
|
|
|
| // Tests that an externally conditionalized HEAD request updates the cache.
|
| TEST(HttpCache, TypicalHEAD_ConditionalizedRequestUpdatesResponse) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| MockTransaction transaction(kTypicalGET_Transaction);
|
| AddMockTransaction(&transaction);
|
|
|
| @@ -3463,7 +3463,7 @@ TEST(HttpCache, TypicalHEAD_ConditionalizedRequestUpdatesResponse) {
|
|
|
| // Tests that a HEAD request invalidates an old cached entry.
|
| TEST(HttpCache, SimpleHEAD_InvalidatesEntry) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| MockTransaction transaction(kTypicalGET_Transaction);
|
| AddMockTransaction(&transaction);
|
|
|
| @@ -3487,7 +3487,7 @@ TEST(HttpCache, SimpleHEAD_InvalidatesEntry) {
|
|
|
| // Tests that we do not cache the response of a PUT.
|
| TEST(HttpCache, SimplePUT_Miss) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimplePOST_Transaction);
|
| transaction.method = "PUT";
|
| @@ -3510,7 +3510,7 @@ TEST(HttpCache, SimplePUT_Miss) {
|
|
|
| // Tests that we invalidate entries as a result of a PUT.
|
| TEST(HttpCache, SimplePUT_Invalidate) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| MockHttpRequest req1(transaction);
|
| @@ -3546,7 +3546,7 @@ TEST(HttpCache, SimplePUT_Invalidate) {
|
|
|
| // Tests that we invalidate entries as a result of a PUT.
|
| TEST(HttpCache, SimplePUT_Invalidate_305) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| AddMockTransaction(&transaction);
|
| @@ -3585,7 +3585,7 @@ TEST(HttpCache, SimplePUT_Invalidate_305) {
|
|
|
| // Tests that we don't invalidate entries as a result of a failed PUT.
|
| TEST(HttpCache, SimplePUT_DontInvalidate_404) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| AddMockTransaction(&transaction);
|
| @@ -3624,7 +3624,7 @@ TEST(HttpCache, SimplePUT_DontInvalidate_404) {
|
|
|
| // Tests that we do not cache the response of a DELETE.
|
| TEST(HttpCache, SimpleDELETE_Miss) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimplePOST_Transaction);
|
| transaction.method = "DELETE";
|
| @@ -3647,7 +3647,7 @@ TEST(HttpCache, SimpleDELETE_Miss) {
|
|
|
| // Tests that we invalidate entries as a result of a DELETE.
|
| TEST(HttpCache, SimpleDELETE_Invalidate) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| MockHttpRequest req1(transaction);
|
| @@ -3683,7 +3683,7 @@ TEST(HttpCache, SimpleDELETE_Invalidate) {
|
|
|
| // Tests that we invalidate entries as a result of a DELETE.
|
| TEST(HttpCache, SimpleDELETE_Invalidate_301) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| AddMockTransaction(&transaction);
|
| @@ -3715,7 +3715,7 @@ TEST(HttpCache, SimpleDELETE_Invalidate_301) {
|
|
|
| // Tests that we don't invalidate entries as a result of a failed DELETE.
|
| TEST(HttpCache, SimpleDELETE_DontInvalidate_416) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| AddMockTransaction(&transaction);
|
| @@ -3748,7 +3748,7 @@ TEST(HttpCache, SimpleDELETE_DontInvalidate_416) {
|
|
|
| // Tests that we don't invalidate entries after a failed network transaction.
|
| TEST(HttpCache, SimpleGET_DontInvalidateOnFailure) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Populate the cache.
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
| @@ -3775,7 +3775,7 @@ TEST(HttpCache, SimpleGET_DontInvalidateOnFailure) {
|
| }
|
|
|
| TEST(HttpCache, RangeGET_SkipsCache) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Test that we skip the cache for range GET requests. Eventually, we will
|
| // want to cache these, but we'll still have cases where skipping the cache
|
| @@ -3807,7 +3807,7 @@ TEST(HttpCache, RangeGET_SkipsCache) {
|
| // Test that we skip the cache for range requests that include a validation
|
| // header.
|
| TEST(HttpCache, RangeGET_SkipsCache2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kRangeGET_Transaction);
|
| transaction.request_headers = "If-None-Match: foo\r\n"
|
| @@ -3840,7 +3840,7 @@ TEST(HttpCache, RangeGET_SkipsCache2) {
|
| }
|
|
|
| TEST(HttpCache, SimpleGET_DoesntLogHeaders) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| BoundTestNetLog log;
|
| RunTransactionTestWithLog(cache.http_cache(), kSimpleGET_Transaction,
|
| @@ -3851,7 +3851,7 @@ TEST(HttpCache, SimpleGET_DoesntLogHeaders) {
|
| }
|
|
|
| TEST(HttpCache, RangeGET_LogsHeaders) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| BoundTestNetLog log;
|
| RunTransactionTestWithLog(cache.http_cache(), kRangeGET_Transaction,
|
| @@ -3862,7 +3862,7 @@ TEST(HttpCache, RangeGET_LogsHeaders) {
|
| }
|
|
|
| TEST(HttpCache, ExternalValidation_LogsHeaders) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| BoundTestNetLog log;
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| @@ -3874,7 +3874,7 @@ TEST(HttpCache, ExternalValidation_LogsHeaders) {
|
| }
|
|
|
| TEST(HttpCache, SpecialHeaders_LogsHeaders) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| BoundTestNetLog log;
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| @@ -3887,7 +3887,7 @@ TEST(HttpCache, SpecialHeaders_LogsHeaders) {
|
|
|
| // Tests that receiving 206 for a regular request is handled correctly.
|
| TEST(HttpCache, GET_Crazy206) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| MockTransaction transaction(kRangeGET_TransactionOK);
|
| @@ -3911,7 +3911,7 @@ TEST(HttpCache, GET_Crazy206) {
|
|
|
| // Tests that receiving 416 for a regular request is handled correctly.
|
| TEST(HttpCache, GET_Crazy416) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache.
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| @@ -3928,7 +3928,7 @@ TEST(HttpCache, GET_Crazy416) {
|
|
|
| // Tests that we don't store partial responses that can't be validated.
|
| TEST(HttpCache, RangeGET_NoStrongValidators) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| // Attempt to write to the cache (40-49).
|
| @@ -3955,7 +3955,7 @@ TEST(HttpCache, RangeGET_NoStrongValidators) {
|
|
|
| // Tests failures to conditionalize byte range requests.
|
| TEST(HttpCache, RangeGET_NoConditionalization) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| cache.FailConditionalizations();
|
| std::string headers;
|
|
|
| @@ -3983,7 +3983,7 @@ TEST(HttpCache, RangeGET_NoConditionalization) {
|
| // Tests that restarting a partial request when the cached data cannot be
|
| // revalidated logs an event.
|
| TEST(HttpCache, RangeGET_NoValidation_LogsRestart) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| cache.FailConditionalizations();
|
|
|
| // Write to the cache (40-49).
|
| @@ -4004,7 +4004,7 @@ TEST(HttpCache, RangeGET_NoValidation_LogsRestart) {
|
| // Tests that a failure to conditionalize a regular request (no range) with a
|
| // sparse entry results in a full response.
|
| TEST(HttpCache, GET_NoConditionalization) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| cache.FailConditionalizations();
|
| std::string headers;
|
|
|
| @@ -4043,7 +4043,7 @@ TEST(HttpCache, GET_NoConditionalization) {
|
| // require the cache to modify the range to ask, result in a network request
|
| // that matches the user's one.
|
| TEST(HttpCache, RangeGET_NoConditionalization2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| cache.FailConditionalizations();
|
| std::string headers;
|
|
|
| @@ -4081,7 +4081,7 @@ TEST(HttpCache, RangeGET_NoConditionalization2) {
|
|
|
| // Tests that we cache partial responses that lack content-length.
|
| TEST(HttpCache, RangeGET_NoContentLength) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| // Attempt to write to the cache (40-49).
|
| @@ -4119,7 +4119,7 @@ TEST(HttpCache, RangeGET_NoContentLength) {
|
| // Tests that we can cache range requests and fetch random blocks from the
|
| // cache and the network.
|
| TEST(HttpCache, MAYBE_RangeGET_OK) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
| std::string headers;
|
|
|
| @@ -4185,7 +4185,7 @@ TEST(HttpCache, MAYBE_RangeGET_OK) {
|
| // Tests that we can cache range requests and fetch random blocks from the
|
| // cache and the network, with synchronous responses.
|
| TEST(HttpCache, MAYBE_RangeGET_SyncOK) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kRangeGET_TransactionOK);
|
| transaction.test_mode = TEST_MODE_SYNC_ALL;
|
| @@ -4246,7 +4246,7 @@ TEST(HttpCache, MAYBE_RangeGET_SyncOK) {
|
| // IO), a new transaction (that reuses that same ActiveEntry) waits until the
|
| // entry is ready again.
|
| TEST(HttpCache, Sparse_WaitForEntry) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kRangeGET_TransactionOK);
|
|
|
| @@ -4272,7 +4272,7 @@ TEST(HttpCache, Sparse_WaitForEntry) {
|
|
|
| // Tests that we don't revalidate an entry unless we are required to do so.
|
| TEST(HttpCache, RangeGET_Revalidate1) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| // Write to the cache (40-49).
|
| @@ -4327,7 +4327,7 @@ TEST(HttpCache, RangeGET_Revalidate1) {
|
| #endif
|
| // Checks that we revalidate an entry when the headers say so.
|
| TEST(HttpCache, MAYBE_RangeGET_Revalidate2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| // Write to the cache (40-49).
|
| @@ -4359,7 +4359,7 @@ TEST(HttpCache, MAYBE_RangeGET_Revalidate2) {
|
|
|
| // Tests that we deal with 304s for range requests.
|
| TEST(HttpCache, RangeGET_304) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
| std::string headers;
|
|
|
| @@ -4389,7 +4389,7 @@ TEST(HttpCache, RangeGET_304) {
|
|
|
| // Tests that we deal with 206s when revalidating range requests.
|
| TEST(HttpCache, RangeGET_ModifiedResult) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
| std::string headers;
|
|
|
| @@ -4429,7 +4429,7 @@ TEST(HttpCache, RangeGET_ModifiedResult) {
|
| // with the same byte that was requested, but that is not the whole range that
|
| // was requested.
|
| TEST(HttpCache, RangeGET_206ReturnsSubrangeRange_NoCachedContent) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| // Request a large range (40-59). The server sends 40-49.
|
| @@ -4453,7 +4453,7 @@ TEST(HttpCache, RangeGET_206ReturnsSubrangeRange_NoCachedContent) {
|
| // Tests that when a server returns 206 with a sub-range of the requested range,
|
| // and there was an entry stored in the cache, the cache gets out of the way.
|
| TEST(HttpCache, RangeGET_206ReturnsSubrangeRange_CachedContent) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| // Write to the cache (70-79).
|
| @@ -4494,7 +4494,7 @@ TEST(HttpCache, RangeGET_206ReturnsSubrangeRange_CachedContent) {
|
| // and there was an entry stored in the cache, the cache gets out of the way,
|
| // when the caller is not using ranges.
|
| TEST(HttpCache, GET_206ReturnsSubrangeRange_CachedContent) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| // Write to the cache (70-79).
|
| @@ -4532,7 +4532,7 @@ TEST(HttpCache, GET_206ReturnsSubrangeRange_CachedContent) {
|
| // contained). The important part is that the first byte doesn't match the first
|
| // requested byte.
|
| TEST(HttpCache, RangeGET_206ReturnsWrongRange_NoCachedContent) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| // Request a large range (30-59). The server sends (40-49).
|
| @@ -4562,7 +4562,7 @@ TEST(HttpCache, RangeGET_206ReturnsWrongRange_NoCachedContent) {
|
| // Tests that when a server returns 206 with a random range and there is
|
| // an entry stored in the cache, the cache gets out of the way.
|
| TEST(HttpCache, RangeGET_206ReturnsWrongRange_CachedContent) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| // Write to the cache (70-79).
|
| @@ -4600,7 +4600,7 @@ TEST(HttpCache, RangeGET_206ReturnsWrongRange_CachedContent) {
|
| // Tests that when a caller asks for a range beyond EOF, with an empty cache,
|
| // the response matches the one provided by the server.
|
| TEST(HttpCache, RangeGET_206ReturnsSmallerFile_NoCachedContent) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| // Request a large range (70-99). The server sends 70-79.
|
| @@ -4621,7 +4621,7 @@ TEST(HttpCache, RangeGET_206ReturnsSmallerFile_NoCachedContent) {
|
| // Tests that when a caller asks for a range beyond EOF, with a cached entry,
|
| // the cache automatically fixes the request.
|
| TEST(HttpCache, RangeGET_206ReturnsSmallerFile_CachedContent) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| // Write to the cache (40-49).
|
| @@ -4648,7 +4648,7 @@ TEST(HttpCache, RangeGET_206ReturnsSmallerFile_CachedContent) {
|
| // Tests that when a caller asks for a not-satisfiable range, the server's
|
| // response is forwarded to the caller.
|
| TEST(HttpCache, RangeGET_416_NoCachedContent) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| // Request a range beyond EOF (80-99).
|
| @@ -4670,7 +4670,7 @@ TEST(HttpCache, RangeGET_416_NoCachedContent) {
|
|
|
| // Tests that we cache 301s for range requests.
|
| TEST(HttpCache, RangeGET_301) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| ScopedMockTransaction transaction(kRangeGET_TransactionOK);
|
| transaction.status = "HTTP/1.1 301 Moved Permanently";
|
| transaction.response_headers = "Location: http://www.bar.com/\n";
|
| @@ -4693,7 +4693,7 @@ TEST(HttpCache, RangeGET_301) {
|
| // Tests that we can cache range requests when the start or end is unknown.
|
| // We start with one suffix request, followed by a request from a given point.
|
| TEST(HttpCache, UnknownRangeGET_1) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
| std::string headers;
|
|
|
| @@ -4728,7 +4728,7 @@ TEST(HttpCache, UnknownRangeGET_1) {
|
| // We start with one request from a given point, followed by a suffix request.
|
| // We'll also verify that synchronous cache responses work as intended.
|
| TEST(HttpCache, UnknownRangeGET_2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| MockTransaction transaction(kRangeGET_TransactionOK);
|
| @@ -4766,7 +4766,7 @@ TEST(HttpCache, UnknownRangeGET_2) {
|
| // Tests that receiving Not Modified when asking for an open range doesn't mess
|
| // up things.
|
| TEST(HttpCache, UnknownRangeGET_304) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| MockTransaction transaction(kRangeGET_TransactionOK);
|
| @@ -4794,7 +4794,7 @@ TEST(HttpCache, UnknownRangeGET_304) {
|
|
|
| // Tests that we can handle non-range requests when we have cached a range.
|
| TEST(HttpCache, GET_Previous206) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
| std::string headers;
|
| BoundTestNetLog log;
|
| @@ -4831,7 +4831,7 @@ TEST(HttpCache, GET_Previous206) {
|
| // Tests that we can handle non-range requests when we have cached the first
|
| // part of the object and the server replies with 304 (Not Modified).
|
| TEST(HttpCache, GET_Previous206_NotModified) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kRangeGET_TransactionOK);
|
| AddMockTransaction(&transaction);
|
| @@ -4881,7 +4881,7 @@ TEST(HttpCache, GET_Previous206_NotModified) {
|
| // Tests that we can handle a regular request to a sparse entry, that results in
|
| // new content provided by the server (206).
|
| TEST(HttpCache, GET_Previous206_NewContent) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
| std::string headers;
|
|
|
| @@ -4927,7 +4927,7 @@ TEST(HttpCache, GET_Previous206_NewContent) {
|
|
|
| // Tests that we can handle cached 206 responses that are not sparse.
|
| TEST(HttpCache, GET_Previous206_NotSparse) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Create a disk cache entry that stores 206 headers while not being sparse.
|
| disk_cache::Entry* entry;
|
| @@ -4974,7 +4974,7 @@ TEST(HttpCache, GET_Previous206_NotSparse) {
|
| // Tests that we can handle cached 206 responses that are not sparse. This time
|
| // we issue a range request and expect to receive a range.
|
| TEST(HttpCache, RangeGET_Previous206_NotSparse_2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| // Create a disk cache entry that stores 206 headers while not being sparse.
|
| @@ -5016,7 +5016,7 @@ TEST(HttpCache, RangeGET_Previous206_NotSparse_2) {
|
|
|
| // Tests that we can handle cached 206 responses that can't be validated.
|
| TEST(HttpCache, GET_Previous206_NotValidation) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Create a disk cache entry that stores 206 headers.
|
| disk_cache::Entry* entry;
|
| @@ -5065,7 +5065,7 @@ TEST(HttpCache, GET_Previous206_NotValidation) {
|
| #endif
|
| // Tests that we can handle range requests with cached 200 responses.
|
| TEST(HttpCache, MAYBE_RangeGET_Previous200) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Store the whole thing with status 200.
|
| MockTransaction transaction(kTypicalGET_Transaction);
|
| @@ -5134,7 +5134,7 @@ TEST(HttpCache, MAYBE_RangeGET_Previous200) {
|
|
|
| // Tests that we can handle a 200 response when dealing with sparse entries.
|
| TEST(HttpCache, RangeRequestResultsIn200) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
| std::string headers;
|
|
|
| @@ -5174,7 +5174,7 @@ TEST(HttpCache, RangeRequestResultsIn200) {
|
| // Tests that a range request that falls outside of the size that we know about
|
| // only deletes the entry if the resource has indeed changed.
|
| TEST(HttpCache, RangeGET_MoreThanCurrentSize) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
| std::string headers;
|
|
|
| @@ -5213,7 +5213,7 @@ TEST(HttpCache, RangeGET_MoreThanCurrentSize) {
|
| #endif
|
| // Tests that we don't delete a sparse entry when we cancel a request.
|
| TEST(HttpCache, MAYBE_RangeGET_Cancel) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| MockHttpRequest request(kRangeGET_TransactionOK);
|
| @@ -5256,7 +5256,7 @@ TEST(HttpCache, MAYBE_RangeGET_Cancel) {
|
| // Tests that we don't delete a sparse entry when we start a new request after
|
| // cancelling the previous one.
|
| TEST(HttpCache, MAYBE_RangeGET_Cancel2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| RunTransactionTest(cache.http_cache(), kRangeGET_TransactionOK);
|
| @@ -5301,7 +5301,7 @@ TEST(HttpCache, MAYBE_RangeGET_Cancel2) {
|
| // A slight variation of the previous test, this time we cancel two requests in
|
| // a row, making sure that the second is waiting for the entry to be ready.
|
| TEST(HttpCache, RangeGET_Cancel3) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| RunTransactionTest(cache.http_cache(), kRangeGET_TransactionOK);
|
| @@ -5360,7 +5360,7 @@ TEST(HttpCache, RangeGET_Cancel3) {
|
|
|
| // Tests that an invalid range response results in no cached entry.
|
| TEST(HttpCache, RangeGET_InvalidResponse1) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| MockTransaction transaction(kRangeGET_TransactionOK);
|
| @@ -5388,7 +5388,7 @@ TEST(HttpCache, RangeGET_InvalidResponse1) {
|
|
|
| // Tests that we reject a range that doesn't match the content-length.
|
| TEST(HttpCache, RangeGET_InvalidResponse2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| MockTransaction transaction(kRangeGET_TransactionOK);
|
| @@ -5417,7 +5417,7 @@ TEST(HttpCache, RangeGET_InvalidResponse2) {
|
| // Tests that if a server tells us conflicting information about a resource we
|
| // drop the entry.
|
| TEST(HttpCache, RangeGET_InvalidResponse3) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| std::string headers;
|
|
|
| MockTransaction transaction(kRangeGET_TransactionOK);
|
| @@ -5457,7 +5457,7 @@ TEST(HttpCache, RangeGET_InvalidResponse3) {
|
| // Tests that we handle large range values properly.
|
| TEST(HttpCache, RangeGET_LargeValues) {
|
| // We need a real sparse cache for this test.
|
| - MockHttpCache cache(HttpCache::DefaultBackend::InMemory(1024 * 1024));
|
| + MockHttpCache cache(HttpCache::DefaultBackend::InMemory(1024 * 1024), false);
|
| std::string headers;
|
|
|
| MockTransaction transaction(kRangeGET_TransactionOK);
|
| @@ -5493,7 +5493,7 @@ TEST(HttpCache, RangeGET_NoDiskCache) {
|
| new MockBlockingBackendFactory());
|
| factory->set_fail(true);
|
| factory->FinishCreation(); // We'll complete synchronously.
|
| - MockHttpCache cache(std::move(factory));
|
| + MockHttpCache cache(std::move(factory), false);
|
|
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| @@ -5505,7 +5505,7 @@ TEST(HttpCache, RangeGET_NoDiskCache) {
|
|
|
| // Tests that we handle byte range requests that skip the cache.
|
| TEST(HttpCache, RangeHEAD) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| MockTransaction transaction(kRangeGET_TransactionOK);
|
| @@ -5527,7 +5527,7 @@ TEST(HttpCache, RangeHEAD) {
|
| // Tests that we don't crash when after reading from the cache we issue a
|
| // request for the next range and the server gives us a 200 synchronously.
|
| TEST(HttpCache, RangeGET_FastFlakyServer) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kRangeGET_TransactionOK);
|
| transaction.request_headers = "Range: bytes = 40-\r\n" EXTRA_HEADER;
|
| @@ -5554,7 +5554,7 @@ TEST(HttpCache, RangeGET_FastFlakyServer) {
|
| // Tests that when the server gives us less data than expected, we don't keep
|
| // asking for more data.
|
| TEST(HttpCache, RangeGET_FastFlakyServer2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // First, check with an empty cache (WRITE mode).
|
| MockTransaction transaction(kRangeGET_TransactionOK);
|
| @@ -5594,7 +5594,7 @@ TEST(HttpCache, RangeGET_FastFlakyServer2) {
|
| #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
|
| // This test hits a NOTREACHED so it is a release mode only test.
|
| TEST(HttpCache, RangeGET_OK_LoadOnlyFromCache) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| // Write to the cache (40-49).
|
| @@ -5632,7 +5632,7 @@ TEST(HttpCache, RangeGET_OK_LoadOnlyFromCache) {
|
|
|
| // Tests the handling of the "truncation" flag.
|
| TEST(HttpCache, WriteResponseInfo_Truncated) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| disk_cache::Entry* entry;
|
| ASSERT_TRUE(cache.CreateBackendEntry("http://www.google.com", &entry,
|
| NULL));
|
| @@ -5684,7 +5684,7 @@ TEST(HttpCache, PersistHttpResponseInfo) {
|
| // Tests that we delete an entry when the request is cancelled before starting
|
| // to read from the network.
|
| TEST(HttpCache, DoomOnDestruction) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
|
|
| @@ -5714,7 +5714,7 @@ TEST(HttpCache, DoomOnDestruction) {
|
| // Tests that we delete an entry when the request is cancelled if the response
|
| // does not have content-length and strong validators.
|
| TEST(HttpCache, DoomOnDestruction2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
|
|
| @@ -5750,7 +5750,7 @@ TEST(HttpCache, DoomOnDestruction2) {
|
| // Tests that we delete an entry when the request is cancelled if the response
|
| // has an "Accept-Ranges: none" header.
|
| TEST(HttpCache, DoomOnDestruction3) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| transaction.response_headers =
|
| @@ -5794,7 +5794,7 @@ TEST(HttpCache, DoomOnDestruction3) {
|
|
|
| // Tests that we mark an entry as incomplete when the request is cancelled.
|
| TEST(HttpCache, SetTruncatedFlag) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kSimpleGET_Transaction);
|
| transaction.response_headers =
|
| @@ -5847,7 +5847,7 @@ TEST(HttpCache, SetTruncatedFlag) {
|
|
|
| // Tests that we don't mark an entry as truncated when we read everything.
|
| TEST(HttpCache, DontSetTruncatedFlag) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kSimpleGET_Transaction);
|
| transaction.response_headers =
|
| @@ -5877,7 +5877,7 @@ TEST(HttpCache, DontSetTruncatedFlag) {
|
|
|
| // Tests that sparse entries don't set the truncate flag.
|
| TEST(HttpCache, RangeGET_DontTruncate) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kRangeGET_TransactionOK);
|
| transaction.request_headers = "Range: bytes = 0-19\r\n" EXTRA_HEADER;
|
| @@ -5904,7 +5904,7 @@ TEST(HttpCache, RangeGET_DontTruncate) {
|
| // Tests that sparse entries don't set the truncate flag (when the byte range
|
| // starts after 0).
|
| TEST(HttpCache, RangeGET_DontTruncate2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kRangeGET_TransactionOK);
|
| transaction.request_headers = "Range: bytes = 30-49\r\n" EXTRA_HEADER;
|
| @@ -5930,7 +5930,7 @@ TEST(HttpCache, RangeGET_DontTruncate2) {
|
|
|
| // Tests that we can continue with a request that was interrupted.
|
| TEST(HttpCache, GET_IncompleteResource) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| ScopedMockTransaction transaction(kRangeGET_TransactionOK);
|
|
|
| std::string raw_headers("HTTP/1.1 200 OK\n"
|
| @@ -5965,7 +5965,7 @@ TEST(HttpCache, GET_IncompleteResource) {
|
|
|
| // Tests the handling of no-store when revalidating a truncated entry.
|
| TEST(HttpCache, GET_IncompleteResource_NoStore) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| std::string raw_headers("HTTP/1.1 200 OK\n"
|
| @@ -6010,7 +6010,7 @@ TEST(HttpCache, GET_IncompleteResource_NoStore) {
|
|
|
| // Tests cancelling a request after the server sent no-store.
|
| TEST(HttpCache, GET_IncompleteResource_Cancel) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| std::string raw_headers("HTTP/1.1 200 OK\n"
|
| @@ -6068,7 +6068,7 @@ TEST(HttpCache, GET_IncompleteResource_Cancel) {
|
|
|
| // Tests that we delete truncated entries if the server changes its mind midway.
|
| TEST(HttpCache, GET_IncompleteResource2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| // Content-length will be intentionally bad.
|
| @@ -6105,7 +6105,7 @@ TEST(HttpCache, GET_IncompleteResource2) {
|
|
|
| // Tests that we always validate a truncated request.
|
| TEST(HttpCache, GET_IncompleteResource3) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| // This should not require validation for 10 hours.
|
| @@ -6141,7 +6141,7 @@ TEST(HttpCache, GET_IncompleteResource3) {
|
|
|
| // Tests that we handle 401s for truncated resources.
|
| TEST(HttpCache, GET_IncompleteResourceWithAuth) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| std::string raw_headers("HTTP/1.1 200 OK\n"
|
| @@ -6190,7 +6190,7 @@ TEST(HttpCache, GET_IncompleteResourceWithAuth) {
|
| // Test that the transaction won't retry failed partial requests
|
| // after it starts reading data. http://crbug.com/474835
|
| TEST(HttpCache, TransactionRetryLimit) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Cache 0-9, so that we have data to read before failing.
|
| ScopedMockTransaction transaction(kRangeGET_TransactionOK);
|
| @@ -6225,7 +6225,7 @@ TEST(HttpCache, TransactionRetryLimit) {
|
|
|
| // Tests that we cache a 200 response to the validation request.
|
| TEST(HttpCache, GET_IncompleteResource4) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| ScopedMockTransaction transaction(kRangeGET_TransactionOK);
|
|
|
| std::string raw_headers("HTTP/1.1 200 OK\n"
|
| @@ -6254,7 +6254,7 @@ TEST(HttpCache, GET_IncompleteResource4) {
|
| // Tests that when we cancel a request that was interrupted, we mark it again
|
| // as truncated.
|
| TEST(HttpCache, GET_CancelIncompleteResource) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| ScopedMockTransaction transaction(kRangeGET_TransactionOK);
|
|
|
| std::string raw_headers("HTTP/1.1 200 OK\n"
|
| @@ -6296,7 +6296,7 @@ TEST(HttpCache, GET_CancelIncompleteResource) {
|
|
|
| // Tests that we can handle range requests when we have a truncated entry.
|
| TEST(HttpCache, RangeGET_IncompleteResource) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| // Content-length will be intentionally bogus.
|
| @@ -6321,7 +6321,7 @@ TEST(HttpCache, RangeGET_IncompleteResource) {
|
| }
|
|
|
| TEST(HttpCache, SyncRead) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // This test ensures that a read that completes synchronously does not cause
|
| // any problems.
|
| @@ -6359,7 +6359,7 @@ TEST(HttpCache, SyncRead) {
|
| }
|
|
|
| TEST(HttpCache, ValidationResultsIn200) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // This test ensures that a conditional request, which results in a 200
|
| // instead of a 304, properly truncates the existing response data.
|
| @@ -6377,7 +6377,7 @@ TEST(HttpCache, ValidationResultsIn200) {
|
| }
|
|
|
| TEST(HttpCache, CachedRedirect) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction kTestTransaction(kSimpleGET_Transaction);
|
| kTestTransaction.status = "HTTP/1.1 301 Moved Permanently";
|
| @@ -6453,7 +6453,7 @@ TEST(HttpCache, CachedRedirect) {
|
| // Verify that no-cache resources are stored in cache, but are not fetched from
|
| // cache during normal loads.
|
| TEST(HttpCache, CacheControlNoCacheNormalLoad) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kSimpleGET_Transaction);
|
| transaction.response_headers = "cache-control: no-cache\n";
|
| @@ -6480,7 +6480,7 @@ TEST(HttpCache, CacheControlNoCacheNormalLoad) {
|
| // Verify that no-cache resources are stored in cache and fetched from cache
|
| // when the LOAD_SKIP_CACHE_VALIDATION flag is set.
|
| TEST(HttpCache, CacheControlNoCacheHistoryLoad) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kSimpleGET_Transaction);
|
| transaction.response_headers = "cache-control: no-cache\n";
|
| @@ -6506,7 +6506,7 @@ TEST(HttpCache, CacheControlNoCacheHistoryLoad) {
|
| }
|
|
|
| TEST(HttpCache, CacheControlNoStore) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kSimpleGET_Transaction);
|
| transaction.response_headers = "cache-control: no-store\n";
|
| @@ -6533,7 +6533,7 @@ TEST(HttpCache, CacheControlNoStore2) {
|
| // this test is similar to the above test, except that the initial response
|
| // is cachable, but when it is validated, no-store is received causing the
|
| // cached document to be deleted.
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kETagGET_Transaction);
|
|
|
| @@ -6561,7 +6561,7 @@ TEST(HttpCache, CacheControlNoStore3) {
|
| // this test is similar to the above test, except that the response is a 304
|
| // instead of a 200. this should never happen in practice, but it seems like
|
| // a good thing to verify that we still destroy the cache entry.
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kETagGET_Transaction);
|
|
|
| @@ -6588,7 +6588,7 @@ TEST(HttpCache, CacheControlNoStore3) {
|
|
|
| // Ensure that we don't cache requests served over bad HTTPS.
|
| TEST(HttpCache, SimpleGET_SSLError) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction = kSimpleGET_Transaction;
|
| transaction.cert_status = CERT_STATUS_REVOKED;
|
| @@ -6614,7 +6614,7 @@ TEST(HttpCache, SimpleGET_SSLError) {
|
|
|
| // Ensure that we don't crash by if left-behind transactions.
|
| TEST(HttpCache, OutlivedTransactions) {
|
| - MockHttpCache* cache = new MockHttpCache;
|
| + MockHttpCache* cache = new MockHttpCache(false);
|
|
|
| std::unique_ptr<HttpTransaction> trans;
|
| EXPECT_THAT(cache->CreateTransaction(&trans), IsOk());
|
| @@ -6625,7 +6625,7 @@ TEST(HttpCache, OutlivedTransactions) {
|
|
|
| // Test that the disabled mode works.
|
| TEST(HttpCache, CacheDisabledMode) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // write to the cache
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
| @@ -6649,7 +6649,7 @@ TEST(HttpCache, CacheDisabledMode) {
|
| // fields also gets updated.
|
| // http://crbug.com/20594.
|
| TEST(HttpCache, UpdatesRequestResponseTimeOn304) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| const char kUrl[] = "http://foobar";
|
| const char kData[] = "body";
|
| @@ -6719,7 +6719,7 @@ TEST(HttpCache, UpdatesRequestResponseTimeOn304) {
|
|
|
| // Tests that we can write metadata to an entry.
|
| TEST(HttpCache, WriteMetadata_OK) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache
|
| HttpResponseInfo response;
|
| @@ -6758,7 +6758,7 @@ TEST(HttpCache, WriteMetadata_OK) {
|
|
|
| // Tests that we only write metadata to an entry if the time stamp matches.
|
| TEST(HttpCache, WriteMetadata_Fail) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache
|
| HttpResponseInfo response;
|
| @@ -6791,7 +6791,7 @@ TEST(HttpCache, WriteMetadata_Fail) {
|
| // Tests that we ignore VARY checks when writing metadata since the request
|
| // headers for the WriteMetadata transaction are made up.
|
| TEST(HttpCache, WriteMetadata_IgnoreVary) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache
|
| HttpResponseInfo response;
|
| @@ -6828,7 +6828,7 @@ TEST(HttpCache, WriteMetadata_IgnoreVary) {
|
| }
|
|
|
| TEST(HttpCache, SkipVaryCheck) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write a simple vary transaction to the cache.
|
| HttpResponseInfo response;
|
| @@ -6855,7 +6855,7 @@ TEST(HttpCache, SkipVaryCheck) {
|
| // Tests that we only return valid entries with LOAD_ONLY_FROM_CACHE
|
| // transactions unless LOAD_SKIP_CACHE_VALIDATION is set.
|
| TEST(HttpCache, ValidLoadOnlyFromCache) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| base::SimpleTestClock* clock = new base::SimpleTestClock();
|
| cache.http_cache()->SetClockForTesting(base::WrapUnique(clock));
|
| cache.network_layer()->SetClock(clock);
|
| @@ -6879,7 +6879,7 @@ TEST(HttpCache, ValidLoadOnlyFromCache) {
|
| }
|
|
|
| TEST(HttpCache, InvalidLoadFlagCombination) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Put the resource in the cache.
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
| @@ -6897,7 +6897,7 @@ TEST(HttpCache, InvalidLoadFlagCombination) {
|
| // Tests that we can read metadata after validating the entry and with READ mode
|
| // transactions.
|
| TEST(HttpCache, ReadMetadata) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Write to the cache
|
| HttpResponseInfo response;
|
| @@ -6959,7 +6959,7 @@ TEST(HttpCache, ReadMetadata) {
|
| // Tests that we don't mark entries as truncated when a filter detects the end
|
| // of the stream.
|
| TEST(HttpCache, FilterCompletion) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| TestCompletionCallback callback;
|
|
|
| {
|
| @@ -6993,7 +6993,7 @@ TEST(HttpCache, FilterCompletion) {
|
| // entry when DoneReading() is called before any Read() calls, such as
|
| // for a redirect.
|
| TEST(HttpCache, DoneReading) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| TestCompletionCallback callback;
|
|
|
| ScopedMockTransaction transaction(kSimpleGET_Transaction);
|
| @@ -7022,7 +7022,7 @@ TEST(HttpCache, DoneReading) {
|
|
|
| // Tests that we stop caching when told.
|
| TEST(HttpCache, StopCachingDeletesEntry) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| TestCompletionCallback callback;
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
|
|
| @@ -7060,7 +7060,7 @@ TEST(HttpCache, StopCachingDeletesEntry) {
|
| // Tests that we stop caching when told, even if DoneReading is called
|
| // after StopCaching.
|
| TEST(HttpCache, StopCachingThenDoneReadingDeletesEntry) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| TestCompletionCallback callback;
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
|
|
| @@ -7100,7 +7100,7 @@ TEST(HttpCache, StopCachingThenDoneReadingDeletesEntry) {
|
|
|
| // Tests that we stop caching when told, when using auth.
|
| TEST(HttpCache, StopCachingWithAuthDeletesEntry) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| TestCompletionCallback callback;
|
| MockTransaction mock_transaction(kSimpleGET_Transaction);
|
| mock_transaction.status = "HTTP/1.1 401 Unauthorized";
|
| @@ -7135,7 +7135,7 @@ TEST(HttpCache, StopCachingWithAuthDeletesEntry) {
|
|
|
| // Tests that when we are told to stop caching we don't throw away valid data.
|
| TEST(HttpCache, StopCachingSavesEntry) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| TestCompletionCallback callback;
|
| MockHttpRequest request(kSimpleGET_Transaction);
|
|
|
| @@ -7172,7 +7172,7 @@ TEST(HttpCache, StopCachingSavesEntry) {
|
|
|
| // Tests that we handle truncated enries when StopCaching is called.
|
| TEST(HttpCache, StopCachingTruncatedEntry) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| TestCompletionCallback callback;
|
| MockHttpRequest request(kRangeGET_TransactionOK);
|
| request.extra_headers.Clear();
|
| @@ -7422,7 +7422,7 @@ TEST_P(HttpCacheHugeResourceTest,
|
| const TransactionPhase stop_caching_phase = GetParam().first;
|
| const CacheInitializer cache_initializer = GetParam().second;
|
|
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| (*cache_initializer)(&cache);
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| @@ -7489,7 +7489,7 @@ TEST_P(HttpCacheHugeResourceTest,
|
| // Tests that we detect truncated resources from the net when there is
|
| // a Content-Length header.
|
| TEST(HttpCache, TruncatedByContentLength) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| TestCompletionCallback callback;
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| @@ -7510,7 +7510,7 @@ TEST(HttpCache, TruncatedByContentLength) {
|
| // Tests that we actually flag entries as truncated when we detect an error
|
| // from the net.
|
| TEST(HttpCache, TruncatedByContentLength2) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| TestCompletionCallback callback;
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| @@ -7528,7 +7528,7 @@ TEST(HttpCache, TruncatedByContentLength2) {
|
| // Make sure that calling SetPriority on a cache transaction passes on
|
| // its priority updates to its underlying network transaction.
|
| TEST(HttpCache, SetPriority) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| std::unique_ptr<HttpTransaction> trans;
|
| ASSERT_THAT(cache.http_cache()->CreateTransaction(IDLE, &trans), IsOk());
|
| @@ -7565,7 +7565,7 @@ TEST(HttpCache, SetPriority) {
|
| // Make sure that calling SetWebSocketHandshakeStreamCreateHelper on a cache
|
| // transaction passes on its argument to the underlying network transaction.
|
| TEST(HttpCache, SetWebSocketHandshakeStreamCreateHelper) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| FakeWebSocketHandshakeStreamCreateHelper create_helper;
|
| std::unique_ptr<HttpTransaction> trans;
|
| @@ -7592,7 +7592,7 @@ TEST(HttpCache, SetWebSocketHandshakeStreamCreateHelper) {
|
| // Make sure that a cache transaction passes on its priority to
|
| // newly-created network transactions.
|
| TEST(HttpCache, SetPriorityNewTransaction) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
|
|
| std::string raw_headers("HTTP/1.1 200 OK\n"
|
| @@ -7645,7 +7645,7 @@ void RunTransactionAndGetNetworkBytes(MockHttpCache& cache,
|
| } // namespace
|
|
|
| TEST(HttpCache, NetworkBytesCacheMissAndThenHit) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kSimpleGET_Transaction);
|
| int64_t sent, received;
|
| @@ -7659,7 +7659,7 @@ TEST(HttpCache, NetworkBytesCacheMissAndThenHit) {
|
| }
|
|
|
| TEST(HttpCache, NetworkBytesConditionalRequest304) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kETagGET_Transaction);
|
| int64_t sent, received;
|
| @@ -7675,7 +7675,7 @@ TEST(HttpCache, NetworkBytesConditionalRequest304) {
|
| }
|
|
|
| TEST(HttpCache, NetworkBytesConditionalRequest200) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| MockTransaction transaction(kTypicalGET_Transaction);
|
| transaction.request_headers = "Foo: bar\r\n";
|
| @@ -7702,7 +7702,7 @@ TEST(HttpCache, NetworkBytesConditionalRequest200) {
|
| }
|
|
|
| TEST(HttpCache, NetworkBytesRange) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| AddMockTransaction(&kRangeGET_TransactionOK);
|
| MockTransaction transaction(kRangeGET_TransactionOK);
|
|
|
| @@ -7742,7 +7742,8 @@ class HttpCachePrefetchValidationTest : public ::testing::Test {
|
| static const int kMaxAgeSecs = 100;
|
| static const int kRequireValidationSecs = kMaxAgeSecs + 1;
|
|
|
| - HttpCachePrefetchValidationTest() : transaction_(kSimpleGET_Transaction) {
|
| + HttpCachePrefetchValidationTest()
|
| + : cache_(false), transaction_(kSimpleGET_Transaction) {
|
| DCHECK_LT(kMaxAgeSecs, prefetch_reuse_mins() * kNumSecondsPerMinute);
|
|
|
| clock_ = new base::SimpleTestClock();
|
| @@ -7859,7 +7860,7 @@ static void CheckResourceFreshnessHeader(const HttpRequestInfo* request,
|
| // Verify that the Resource-Freshness header is sent on a revalidation if the
|
| // stale-while-revalidate directive was on the response.
|
| TEST(HttpCache, ResourceFreshnessHeaderSent) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction stale_while_revalidate_transaction(
|
| kSimpleGET_Transaction);
|
| @@ -7891,7 +7892,7 @@ static void CheckResourceFreshnessAbsent(const HttpRequestInfo* request,
|
| // Verify that the Resource-Freshness header is not sent when
|
| // stale-while-revalidate is 0.
|
| TEST(HttpCache, ResourceFreshnessHeaderNotSent) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction stale_while_revalidate_transaction(
|
| kSimpleGET_Transaction);
|
| @@ -7914,7 +7915,7 @@ TEST(HttpCache, ResourceFreshnessHeaderNotSent) {
|
| }
|
|
|
| TEST(HttpCache, StaleContentNotUsedWhenLoadFlagNotSet) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction stale_while_revalidate_transaction(
|
| kSimpleGET_Transaction);
|
| @@ -7939,7 +7940,7 @@ TEST(HttpCache, StaleContentNotUsedWhenLoadFlagNotSet) {
|
| }
|
|
|
| TEST(HttpCache, StaleContentUsedWhenLoadFlagSetAndUsable) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction stale_while_revalidate_transaction(
|
| kSimpleGET_Transaction);
|
| @@ -7965,7 +7966,7 @@ TEST(HttpCache, StaleContentUsedWhenLoadFlagSetAndUsable) {
|
| }
|
|
|
| TEST(HttpCache, StaleContentNotUsedWhenUnusable) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction stale_while_revalidate_transaction(
|
| kSimpleGET_Transaction);
|
| @@ -7993,7 +7994,7 @@ TEST(HttpCache, StaleContentNotUsedWhenUnusable) {
|
| // Tests that we allow multiple simultaneous, non-overlapping transactions to
|
| // take place on a sparse entry.
|
| TEST(HttpCache, RangeGET_MultipleRequests) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| // Create a transaction for bytes 0-9.
|
| MockHttpRequest request(kRangeGET_TransactionOK);
|
| @@ -8027,7 +8028,7 @@ TEST(HttpCache, RangeGET_MultipleRequests) {
|
| // the same URL can be processed before the response body of the original
|
| // request arrives.
|
| TEST(HttpCache, NoStoreResponseShouldNotBlockFollowingRequests) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| ScopedMockTransaction mock_transaction(kSimpleGET_Transaction);
|
| mock_transaction.response_headers = "Cache-Control: no-store\n";
|
| MockHttpRequest request(mock_transaction);
|
| @@ -8077,7 +8078,7 @@ TEST(HttpCache, CachePreservesSSLInfo) {
|
| scoped_refptr<X509Certificate> cert =
|
| ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem");
|
|
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kSimpleGET_Transaction);
|
| transaction.cert = cert;
|
| @@ -8130,7 +8131,7 @@ TEST(HttpCache, RevalidationUpdatesSSLInfo) {
|
| scoped_refptr<X509Certificate> cert2 =
|
| ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem");
|
|
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| ScopedMockTransaction transaction(kTypicalGET_Transaction);
|
| transaction.cert = cert1;
|
| @@ -8174,7 +8175,7 @@ TEST(HttpCache, RevalidationUpdatesSSLInfo) {
|
| }
|
|
|
| TEST(HttpCache, CacheEntryStatusOther) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| HttpResponseInfo response_info;
|
| RunTransactionTestWithResponseInfo(cache.http_cache(), kRangeGET_Transaction,
|
| @@ -8186,7 +8187,7 @@ TEST(HttpCache, CacheEntryStatusOther) {
|
| }
|
|
|
| TEST(HttpCache, CacheEntryStatusNotInCache) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
|
|
| HttpResponseInfo response_info;
|
| RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction,
|
| @@ -8199,7 +8200,7 @@ TEST(HttpCache, CacheEntryStatusNotInCache) {
|
| }
|
|
|
| TEST(HttpCache, CacheEntryStatusUsed) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
|
|
|
| HttpResponseInfo response_info;
|
| @@ -8212,7 +8213,7 @@ TEST(HttpCache, CacheEntryStatusUsed) {
|
| }
|
|
|
| TEST(HttpCache, CacheEntryStatusValidated) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| RunTransactionTest(cache.http_cache(), kETagGET_Transaction);
|
|
|
| ScopedMockTransaction still_valid(kETagGET_Transaction);
|
| @@ -8230,7 +8231,7 @@ TEST(HttpCache, CacheEntryStatusValidated) {
|
| }
|
|
|
| TEST(HttpCache, CacheEntryStatusUpdated) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| RunTransactionTest(cache.http_cache(), kETagGET_Transaction);
|
|
|
| ScopedMockTransaction update(kETagGET_Transaction);
|
| @@ -8246,7 +8247,7 @@ TEST(HttpCache, CacheEntryStatusUpdated) {
|
| }
|
|
|
| TEST(HttpCache, CacheEntryStatusCantConditionalize) {
|
| - MockHttpCache cache;
|
| + MockHttpCache cache(false);
|
| cache.FailConditionalizations();
|
| RunTransactionTest(cache.http_cache(), kTypicalGET_Transaction);
|
|
|
|
|