Chromium Code Reviews| 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 |