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

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

Issue 892293002: First version of new merge algorithm (not enabled yet) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove scope-related code (accidentally mixed in this CL) Created 5 years, 10 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: Source/core/paint/DrawingRecorderTest.cpp
diff --git a/Source/core/paint/DrawingRecorderTest.cpp b/Source/core/paint/DrawingRecorderTest.cpp
index e07c585a8d121965e3393dcc5c9210d272b06f35..1e31858b8b7838daff97571de29e14679956d938 100644
--- a/Source/core/paint/DrawingRecorderTest.cpp
+++ b/Source/core/paint/DrawingRecorderTest.cpp
@@ -14,7 +14,6 @@
#include <gtest/gtest.h>
namespace blink {
-namespace {
class DrawingRecorderTest : public RenderingTest {
public:
@@ -23,6 +22,7 @@ public:
protected:
RenderView* renderView() { return m_renderView; }
DisplayItemList& rootDisplayItemList() { return *renderView()->layer()->graphicsLayerBacking()->displayItemList(); }
+ const Vector<OwnPtr<DisplayItem>>& newPaintListBeforeUpdate() { return rootDisplayItemList().m_newPaints; }
private:
virtual void SetUp() override
@@ -36,6 +36,12 @@ private:
ASSERT_TRUE(m_renderView);
}
+ virtual void TearDown() override
+ {
+ RuntimeEnabledFeatures::setSlimmingPaintEnabled(false);
+ RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(false);
+ }
+
RenderView* m_renderView;
};
@@ -54,7 +60,7 @@ void drawRect(GraphicsContext* context, RenderView* renderer, PaintPhase phase,
}
-TEST_F(DrawingRecorderTest, DrawingRecorderTest_Nothing)
+TEST_F(DrawingRecorderTest, Nothing)
{
GraphicsContext context(nullptr, &rootDisplayItemList());
FloatRect bound = renderView()->viewRect();
@@ -62,10 +68,10 @@ TEST_F(DrawingRecorderTest, DrawingRecorderTest_Nothing)
drawNothing(&context, renderView(), PaintPhaseForeground, bound);
rootDisplayItemList().endNewPaints();
- EXPECT_EQ((size_t)1, rootDisplayItemList().paintList().size());
+ EXPECT_EQ((size_t)0, rootDisplayItemList().paintList().size());
}
-TEST_F(DrawingRecorderTest, DrawingRecorderTest_Rect)
+TEST_F(DrawingRecorderTest, Rect)
{
GraphicsContext context(nullptr, &rootDisplayItemList());
FloatRect bound = renderView()->viewRect();
@@ -75,22 +81,26 @@ TEST_F(DrawingRecorderTest, DrawingRecorderTest_Rect)
EXPECT_TRUE(rootDisplayItemList().paintList()[0]->isDrawing());
}
-TEST_F(DrawingRecorderTest, DrawingRecorderTest_Cached)
+TEST_F(DrawingRecorderTest, Cached)
{
+ RuntimeEnabledFeatures::setSlimmingPaintDisplayItemCacheEnabled(true);
+
GraphicsContext context(nullptr, &rootDisplayItemList());
FloatRect bound = renderView()->viewRect();
drawNothing(&context, renderView(), PaintPhaseBlockBackground, bound);
drawRect(&context, renderView(), PaintPhaseForeground, bound);
rootDisplayItemList().endNewPaints();
- EXPECT_EQ((size_t)2, rootDisplayItemList().paintList().size());
- EXPECT_TRUE(rootDisplayItemList().paintList()[1]->isDrawing());
+ EXPECT_EQ((size_t)1, rootDisplayItemList().paintList().size());
+ EXPECT_TRUE(rootDisplayItemList().paintList()[0]->isDrawing());
drawNothing(&context, renderView(), PaintPhaseBlockBackground, bound);
drawRect(&context, renderView(), PaintPhaseForeground, bound);
+ EXPECT_EQ((size_t)2, newPaintListBeforeUpdate().size());
+ EXPECT_TRUE(newPaintListBeforeUpdate()[0]->isCached());
+ EXPECT_TRUE(newPaintListBeforeUpdate()[1]->isCached());
rootDisplayItemList().endNewPaints();
- EXPECT_EQ((size_t)2, rootDisplayItemList().paintList().size());
- EXPECT_TRUE(rootDisplayItemList().paintList()[1]->isDrawing());
+ EXPECT_EQ((size_t)1, rootDisplayItemList().paintList().size());
+ EXPECT_TRUE(rootDisplayItemList().paintList()[0]->isDrawing());
}
}
-}

Powered by Google App Engine
This is Rietveld 408576698