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

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp

Issue 2341893002: Don't attempt to revalidate a Resource with a 304 response. (Closed)
Patch Set: Fix comment issues Created 4 years, 3 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 | « third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
index 25a9180e2096cb173e249c04d8b5aa4cc4dd3198..4c3ffdb9bf639ac3c1c8180d5985e452cbf23a66 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
@@ -661,4 +661,26 @@ TEST_F(ResourceFetcherTest, LinkPreloadImageMultipleFetchersAndUse)
EXPECT_FALSE(resource->isPreloaded());
}
+TEST_F(ResourceFetcherTest, Revalidate304)
+{
+ KURL url(ParsedURLString, "http://127.0.0.1:8000/foo.html");
+ Resource* resource = Resource::create(url, Resource::Raw);
+ memoryCache()->add(resource);
+ ResourceResponse response;
+ response.setURL(url);
+ response.setHTTPStatusCode(304);
+ response.setHTTPHeaderField("etag", "1234567890");
+ resource->responseReceived(response, nullptr);
+ resource->finish();
+
+ ResourceFetcher* fetcher = ResourceFetcher::create(ResourceFetcherTestMockFetchContext::create());
+ FetchRequest fetchRequest = FetchRequest(url, FetchInitiatorInfo());
+ Platform::current()->getURLLoaderMockFactory()->registerURL(url, WebURLResponse(), "");
+ Resource* newResource = fetcher->requestResource(fetchRequest, TestResourceFactory(Resource::Raw));
+ fetcher->stopFetching();
+ Platform::current()->getURLLoaderMockFactory()->unregisterURL(url);
+
+ EXPECT_NE(resource, newResource);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698