Index: Source/web/tests/WebFrameTest.cpp |
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp |
index 19911983b5549fb078b1ef8486fc0f597816ff0e..f6260f92c7510de32f9a285ebf00fd5c251a82cb 100644 |
--- a/Source/web/tests/WebFrameTest.cpp |
+++ b/Source/web/tests/WebFrameTest.cpp |
@@ -5508,40 +5508,55 @@ TEST_F(WebFrameTest, ReloadBypassingCache) |
EXPECT_EQ(WebURLRequest::ReloadBypassingCache, frame->dataSource()->request().cachePolicy()); |
} |
-TEST_F(WebFrameTest, NodeImageTestCSSTransform) |
+static void nodeImageTestValidation(const WebCore::IntSize& referenceBitmapSize, WebCore::DragImage* dragImage) |
{ |
- FrameTestHelpers::WebViewHelper webViewHelper; |
- OwnPtr<WebCore::DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-transform")); |
- EXPECT_TRUE(dragImage); |
- |
+ // Prepare the reference bitmap. |
SkBitmap bitmap; |
- ASSERT_TRUE(bitmap.allocN32Pixels(40, 40)); |
+ ASSERT_TRUE(bitmap.allocN32Pixels(referenceBitmapSize.width(), referenceBitmapSize.height())); |
SkCanvas canvas(bitmap); |
canvas.drawColor(SK_ColorGREEN); |
- EXPECT_EQ(40, dragImage->size().width()); |
- EXPECT_EQ(40, dragImage->size().height()); |
+ EXPECT_EQ(referenceBitmapSize.width(), dragImage->size().width()); |
+ EXPECT_EQ(referenceBitmapSize.height(), dragImage->size().height()); |
const SkBitmap& dragBitmap = dragImage->bitmap(); |
SkAutoLockPixels lockPixel(dragBitmap); |
EXPECT_EQ(0, memcmp(bitmap.getPixels(), dragBitmap.getPixels(), bitmap.getSize())); |
} |
+TEST_F(WebFrameTest, NodeImageTestCSSTransform) |
+{ |
+ FrameTestHelpers::WebViewHelper webViewHelper; |
+ OwnPtr<WebCore::DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-transform")); |
+ EXPECT_TRUE(dragImage); |
+ |
+ nodeImageTestValidation(WebCore::IntSize(40, 40), dragImage.get()); |
+} |
+ |
TEST_F(WebFrameTest, NodeImageTestCSS3DTransform) |
{ |
FrameTestHelpers::WebViewHelper webViewHelper; |
OwnPtr<WebCore::DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-css-3dtransform")); |
EXPECT_TRUE(dragImage); |
- SkBitmap bitmap; |
- ASSERT_TRUE(bitmap.allocN32Pixels(20, 40)); |
- SkCanvas canvas(bitmap); |
- canvas.drawColor(SK_ColorGREEN); |
+ nodeImageTestValidation(WebCore::IntSize(20, 40), dragImage.get()); |
+} |
- EXPECT_EQ(20, dragImage->size().width()); |
- EXPECT_EQ(40, dragImage->size().height()); |
- const SkBitmap& dragBitmap = dragImage->bitmap(); |
- SkAutoLockPixels lockPixel(dragBitmap); |
- EXPECT_EQ(0, memcmp(bitmap.getPixels(), dragBitmap.getPixels(), bitmap.getSize())); |
+TEST_F(WebFrameTest, NodeImageTestInlineBlock) |
+{ |
+ FrameTestHelpers::WebViewHelper webViewHelper; |
+ OwnPtr<WebCore::DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-inlineblock")); |
+ EXPECT_TRUE(dragImage); |
+ |
+ nodeImageTestValidation(WebCore::IntSize(40, 40), dragImage.get()); |
+} |
+ |
+TEST_F(WebFrameTest, NodeImageTestFloatLeft) |
+{ |
+ FrameTestHelpers::WebViewHelper webViewHelper; |
+ OwnPtr<WebCore::DragImage> dragImage = nodeImageTestSetup(&webViewHelper, std::string("case-float-left-overflow-hidden")); |
+ EXPECT_TRUE(dragImage); |
+ |
+ nodeImageTestValidation(WebCore::IntSize(40, 40), dragImage.get()); |
} |
class BrandColorTestWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |