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

Unified Diff: Source/core/paint/DrawingRecorderTest.cpp

Issue 794323004: Emit dummy display item when recorded picture is empty (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add a missed "override" Created 6 years 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: Source/core/paint/DrawingRecorderTest.cpp
diff --git a/Source/core/paint/DrawingRecorderTest.cpp b/Source/core/paint/DrawingRecorderTest.cpp
index b284f1f967fbdc0a0f45f8cbe08a072ae076339c..ccb87dca70b3cd51780128ce26bb8869ebc0201c 100644
--- a/Source/core/paint/DrawingRecorderTest.cpp
+++ b/Source/core/paint/DrawingRecorderTest.cpp
@@ -61,7 +61,10 @@ TEST_F(DrawingRecorderTest, DrawingRecorderTest_Nothing)
EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size());
drawNothing(&context, renderView(), PaintPhaseForeground, bound);
- EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size());
+ EXPECT_EQ((size_t)1, rootDisplayItemList().paintList().size());
+#ifndef NDEBUG
+ EXPECT_STREQ("Dummy", rootDisplayItemList().paintList()[0]->name());
+#endif
}
TEST_F(DrawingRecorderTest, DrawingRecorderTest_Rect)
@@ -70,6 +73,30 @@ TEST_F(DrawingRecorderTest, DrawingRecorderTest_Rect)
FloatRect bound = renderView()->viewRect();
drawRect(&context, renderView(), PaintPhaseForeground, bound);
EXPECT_EQ((size_t)1, rootDisplayItemList().paintList().size());
+#ifndef NDEBUG
+ EXPECT_STREQ("Drawing", rootDisplayItemList().paintList()[0]->name());
+#endif
+}
+
+TEST_F(DrawingRecorderTest, DrawingRecorderTest_Cached)
+{
+ GraphicsContext context(nullptr, &rootDisplayItemList());
+ FloatRect bound = renderView()->viewRect();
+ drawNothing(&context, renderView(), PaintPhaseBlockBackground, bound);
+ drawRect(&context, renderView(), PaintPhaseForeground, bound);
+ EXPECT_EQ((size_t)2, rootDisplayItemList().paintList().size());
+#ifndef NDEBUG
+ EXPECT_STREQ("Dummy", rootDisplayItemList().paintList()[0]->name());
+ EXPECT_STREQ("Drawing", rootDisplayItemList().paintList()[1]->name());
+#endif
+
+ drawNothing(&context, renderView(), PaintPhaseBlockBackground, bound);
+ drawRect(&context, renderView(), PaintPhaseForeground, bound);
+ EXPECT_EQ((size_t)2, rootDisplayItemList().paintList().size());
+#ifndef NDEBUG
+ EXPECT_STREQ("Dummy", rootDisplayItemList().paintList()[0]->name());
+ EXPECT_STREQ("Drawing", rootDisplayItemList().paintList()[1]->name());
+#endif
}
}
« no previous file with comments | « no previous file | Source/core/paint/ViewDisplayListTest.cpp » ('j') | Source/platform/graphics/paint/DisplayItem.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698