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

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

Issue 2054643003: Remove duplication of encoded image data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (rebase) Created 4 years, 5 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
Index: third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp b/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
index 6fb9c900df4f1f5d6ba589054ce35872ad8b22d3..e0013a6e045789cd36bda70b02d9f7390204fd80 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
@@ -237,7 +237,7 @@ TEST(ImageResourceTest, MultipartImage)
// This part finishes. The image is created, callbacks are sent, and the data buffer is cleared.
cachedImage->loader()->didFinishLoading(nullptr, 0.0, 0);
- ASSERT_FALSE(cachedImage->resourceBuffer());
+ ASSERT_TRUE(cachedImage->resourceBuffer());
ASSERT_FALSE(cachedImage->errorOccurred());
ASSERT_TRUE(cachedImage->hasImage());
ASSERT_FALSE(cachedImage->getImage()->isNull());
@@ -302,12 +302,14 @@ TEST(ImageResourceTest, DecodedDataRemainsWhileHasClients)
ASSERT_TRUE(cachedImage->hasImage());
ASSERT_FALSE(cachedImage->getImage()->isNull());
- // The ImageResource no longer has clients. The image should be deleted by prune.
+ // The ImageResource no longer has clients. The decoded image data should be
+ // deleted by prune.
client->removeAsClient();
cachedImage->prune();
ASSERT_FALSE(cachedImage->hasClientsOrObservers());
- ASSERT_FALSE(cachedImage->hasImage());
- ASSERT_TRUE(cachedImage->getImage()->isNull());
+ ASSERT_TRUE(cachedImage->hasImage());
+ // TODO(hajimehoshi): Should check cachedImage doesn't have decoded image
+ // data.
}
TEST(ImageResourceTest, UpdateBitmapImages)
@@ -606,7 +608,7 @@ TEST(ImageResourceTest, AddClientAfterPrune)
imageResource->prune();
- EXPECT_FALSE(imageResource->hasImage());
+ EXPECT_TRUE(imageResource->hasImage());
// Re-adds a ResourceClient but not ImageResourceObserver.
Persistent<MockResourceClient> client2 = new MockResourceClient(imageResource);
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.cpp ('k') | third_party/WebKit/Source/core/fetch/Resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698