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

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

Issue 2537303003: Fix memory corruption related to load blocking resource move (Closed)
Patch Set: CHECK Created 4 years 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 e938a165650150175a406464b43342482cb3c35d..80ff9d0efa36623385b3cdd5de9bea31237f7063 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
@@ -615,4 +615,30 @@ TEST_F(ResourceFetcherTest, Revalidate304) {
EXPECT_NE(resource, newResource);
}
+TEST_F(ResourceFetcherTest, LinkPreloadImageMultipleFetchersAndMove) {
+ ResourceFetcher* fetcher = ResourceFetcher::create(
+ MockFetchContext::create(MockFetchContext::kShouldLoadNewResource));
+ ResourceFetcher* fetcher2 = ResourceFetcher::create(
+ MockFetchContext::create(MockFetchContext::kShouldLoadNewResource));
+
+ KURL url(ParsedURLString, "http://127.0.0.1:8000/foo.png");
+ URLTestHelpers::registerMockedURLLoad(url, testImageFilename, "image/png");
+
+ FetchRequest fetchRequestOriginal = FetchRequest(url, FetchInitiatorInfo());
+ fetchRequestOriginal.setLinkPreload(true);
+ Resource* resource = ImageResource::fetch(fetchRequestOriginal, fetcher);
+ ASSERT_TRUE(resource);
+ EXPECT_TRUE(resource->isLinkPreload());
+ fetcher->preloadStarted(resource);
+
+ // Image created by parser on the second fetcher
+ FetchRequest fetchRequest2 = FetchRequest(url, FetchInitiatorInfo());
+ Resource* newResource2 = ImageResource::fetch(fetchRequest2, fetcher2);
+ Persistent<MockResourceClient> client2 = new MockResourceClient(newResource2);
+ EXPECT_EQ(resource, newResource2);
+ EXPECT_FALSE(fetcher2->isFetching());
+ Platform::current()->getURLLoaderMockFactory()->serveAsynchronousRequests();
+ Platform::current()->getURLLoaderMockFactory()->unregisterURL(url);
+}
+
} // 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