Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Unified Diff: net/http/http_cache_unittest.cc

Issue 2508473002: [DevTools] Properly handle cache-only requests when cache is disabled (Closed)
Patch Set: Fix Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/http/http_cache_unittest.cc
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index 459855d1d32a24af8c92825072f721d1fb76e6fb..d21ede7d2fde1b7cbaafd750e6d0c4e1d3acfcd3 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -6770,6 +6770,22 @@ TEST(HttpCache, ValidLoadOnlyFromCache) {
RunTransactionTest(cache.http_cache(), transaction);
}
+TEST(HttpCache, InvalidLoadFlagCombination) {
+ MockHttpCache cache;
+
+ // Put the resource in the cache.
+ RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
+
+ // Now try to fetch it again, but with a flag combination disallowing both
+ // cache and network access.
+ ScopedMockTransaction transaction(kSimpleGET_Transaction);
+ // DevTools relies on this combination of flags for "disable cache" mode
+ // when a resource is only supposed to be loaded from cache.
+ transaction.load_flags = LOAD_ONLY_FROM_CACHE | LOAD_BYPASS_CACHE;
+ transaction.return_code = ERR_CACHE_MISS;
+ RunTransactionTest(cache.http_cache(), transaction);
+}
+
// Tests that we can read metadata after validating the entry and with READ mode
// transactions.
TEST(HttpCache, ReadMetadata) {

Powered by Google App Engine
This is Rietveld 408576698