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

Unified Diff: Source/core/fetch/CachingCorrectnessTest.cpp

Issue 229053004: Allow cache reuse of some requests with Cache-Control headers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months 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
« no previous file with comments | « no previous file | Source/core/fetch/Resource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/CachingCorrectnessTest.cpp
diff --git a/Source/core/fetch/CachingCorrectnessTest.cpp b/Source/core/fetch/CachingCorrectnessTest.cpp
index ab3c77df2ae1a6b7f9ab91ae9da842f66ced1226..98d2b20e07d5a7458fae7ccef9f32ef16812c91d 100644
--- a/Source/core/fetch/CachingCorrectnessTest.cpp
+++ b/Source/core/fetch/CachingCorrectnessTest.cpp
@@ -76,6 +76,18 @@ protected:
return resource;
}
+ ResourcePtr<Resource> resourceFromResourceRequest(ResourceRequest request)
+ {
+ if (request.url().isNull())
+ request.setURL(KURL(ParsedURLString, kResourceURL));
+ ResourcePtr<Resource> resource =
+ new Resource(request, Resource::Raw);
+ resource->setResponse(ResourceResponse(KURL(ParsedURLString, kResourceURL), "text/html", 0, nullAtom, String()));
+ memoryCache()->add(resource.get());
+
+ return resource;
+ }
+
ResourcePtr<Resource> fetch()
{
FetchRequest fetchRequest(ResourceRequest(KURL(ParsedURLString, kResourceURL)), FetchInitiatorInfo());
@@ -269,6 +281,15 @@ TEST_F(CachingCorrectnessTest, FreshButNoCache)
EXPECT_NE(fresh200Nocache, fetched);
}
+TEST_F(CachingCorrectnessTest, RequestWithNoCahe)
+{
+ ResourceRequest noCacheRequest;
+ noCacheRequest.setHTTPHeaderField("Cache-Control", "no-cache");
+ ResourcePtr<Resource> noCacheResource = resourceFromResourceRequest(noCacheRequest);
+ ResourcePtr<Resource> fetched = fetch();
+ EXPECT_NE(noCacheResource, fetched);
+}
+
TEST_F(CachingCorrectnessTest, FreshButNoStore)
{
ResourceResponse fresh200NostoreResponse;
@@ -286,6 +307,15 @@ TEST_F(CachingCorrectnessTest, FreshButNoStore)
EXPECT_NE(fresh200Nostore, fetched);
}
+TEST_F(CachingCorrectnessTest, RequestWithNoStore)
+{
+ ResourceRequest noStoreRequest;
+ noStoreRequest.setHTTPHeaderField("Cache-Control", "no-store");
+ ResourcePtr<Resource> noStoreResource = resourceFromResourceRequest(noStoreRequest);
+ ResourcePtr<Resource> fetched = fetch();
+ EXPECT_NE(noStoreResource, fetched);
+}
+
// FIXME: Determine if ignoring must-revalidate for blink is correct behaviour.
// See crbug.com/340088 .
TEST_F(CachingCorrectnessTest, DISABLED_FreshButMustRevalidate)
« no previous file with comments | « no previous file | Source/core/fetch/Resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698