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

Unified Diff: third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp

Issue 2054643003: Remove duplication of encoded image data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring 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/platform/graphics/BitmapImageTest.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
index eb5de1a909716bea14bfc45f370fd9f8c6ddd291..010e3cc08bc5bb78a02d5a538ea647f15f71d164 100644
--- a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
@@ -140,6 +140,9 @@ public:
return m_imageObserver->m_lastDecodedSizeChangedDelta;
}
+ PassRefPtr<SharedBuffer> data() { return m_image->data(); }
+ PassRefPtr<SharedBuffer> cachedData() { return m_image->cachedData(); }
+
protected:
void SetUp() override
{
@@ -216,6 +219,16 @@ TEST_F(BitmapImageTest, noColorProfile)
EXPECT_FALSE(m_image->hasColorProfile());
}
+TEST_F(BitmapImageTest, noCachedData)
+{
+ loadImage("/LayoutTests/fast/images/resources/green.jpg");
+ EXPECT_TRUE(m_image->isAllDataReceived());
+ // m_image doesn't have its encoded image data. Instead, its
+ // DeferredImageDecoder has it and data() returns this.
+ EXPECT_FALSE(cachedData());
+ EXPECT_TRUE(data());
+}
+
#if USE(QCMSLIB)
TEST_F(BitmapImageTest, jpegHasColorProfile)

Powered by Google App Engine
This is Rietveld 408576698