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

Unified Diff: Source/core/page/ImageBitmapTest.cpp

Issue 22613002: Allow ImageBitmaps derived from HTMLImageElements to be evicted from RAM. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add test. Created 7 years, 4 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 | « Source/core/page/ImageBitmap.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/ImageBitmapTest.cpp
diff --git a/Source/core/animation/AnimatableNeutralTest.cpp b/Source/core/page/ImageBitmapTest.cpp
similarity index 65%
copy from Source/core/animation/AnimatableNeutralTest.cpp
copy to Source/core/page/ImageBitmapTest.cpp
index 0eb0188666d28d1cb73d6699b85ae7f2766a0622..9a692e3bd8868c1167dc8974628a64233ee6d861 100644
--- a/Source/core/animation/AnimatableNeutralTest.cpp
+++ b/Source/core/page/ImageBitmapTest.cpp
@@ -29,29 +29,29 @@
*/
#include "config.h"
-#include "core/animation/AnimatableNeutral.h"
+#include "core/page/ImageBitmap.h"
-#include "core/animation/AnimatableUnknown.h"
-#include "core/css/CSSArrayFunctionValue.h"
+#include "core/dom/Document.h"
+#include "core/html/HTMLImageElement.h"
+#include "core/loader/cache/CachedImage.h"
+#include "core/platform/graphics/BitmapImage.h"
#include <gtest/gtest.h>
-using namespace WebCore;
+namespace WebCore {
-namespace {
+class ImageBitmapTest : public ::testing::Test {
+};
-TEST(AnimatableNeutral, Create)
+// Verifies that the cached image help by an ImageBitmap is the same as the
Justin Novosad 2013/08/08 13:18:28 help -> held
+// one held by the HTMLImageElement.
+TEST_F(ImageBitmapTest, CachedImageConsistency)
{
- EXPECT_TRUE(AnimatableValue::neutralValue());
+ RefPtr<HTMLImageElement> imageElement = HTMLImageElement::create(Document::create().get());
+ CachedImage* cachedImage = new CachedImage(BitmapImage::create().get());
Justin Novosad 2013/08/08 13:18:28 I think this code leaks the cachedImage. Should pu
+ imageElement->setCachedImage(cachedImage);
+ RefPtr<ImageBitmap> imageBitmap = ImageBitmap::create(imageElement.get(), IntRect(0, 0, 50, 50));
Justin Novosad 2013/08/08 13:18:28 Would be good to test different scenarios here: cr
+ ASSERT_EQ(imageBitmap->bitmapImage().get(), cachedImage->image());
}
-TEST(AnimatableNeutral, Add)
-{
- RefPtr<CSSValue> cssValue = CSSArrayFunctionValue::create();
- RefPtr<AnimatableValue> animatableUnknown = AnimatableUnknown::create(cssValue);
-
- EXPECT_EQ(cssValue, AnimatableValue::add(animatableUnknown.get(), AnimatableValue::neutralValue())->toCSSValue());
- EXPECT_EQ(cssValue, AnimatableValue::add(AnimatableValue::neutralValue(), animatableUnknown.get())->toCSSValue());
-}
-
-}
+} // namespace
« no previous file with comments | « Source/core/page/ImageBitmap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698