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

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: Address on hiroshige's review Created 4 years, 6 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 3224ca770e8408c423130bb22e676fcc47f811ee..5476023e900d940413b5d9706591df147ec88287 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
@@ -167,7 +167,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());
@@ -232,12 +232,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)
@@ -287,9 +289,9 @@ TEST(ImageResourceTest, ReloadIfLoFi)
cachedImage->reloadIfLoFi(fetcher);
ASSERT_FALSE(cachedImage->errorOccurred());
- ASSERT_FALSE(cachedImage->resourceBuffer());
+ ASSERT_TRUE(cachedImage->resourceBuffer());
ASSERT_TRUE(cachedImage->hasImage());
- ASSERT_EQ(client->imageChangedCount(), 3);
+ ASSERT_EQ(client->imageChangedCount(), 2);
cachedImage->loader()->didReceiveResponse(nullptr, WrappedResourceResponse(resourceResponse), nullptr);
cachedImage->loader()->didReceiveData(nullptr, reinterpret_cast<const char*>(jpeg.data()), jpeg.size(), jpeg.size());

Powered by Google App Engine
This is Rietveld 408576698