Index: third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp |
index 2249f1768fccf2982d57565fd78bf0e097a350ad..ff4549feb805873272ce4085e076a02e404b1108 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp |
@@ -37,7 +37,7 @@ protected: |
int numCachedNewItems() const { return m_paintController->m_numCachedNewItems; } |
-#if DCHECK_IS_ON() |
+#ifndef NDEBUG |
int numSequentialMatches() const { return m_paintController->m_numSequentialMatches; } |
int numOutOfOrderMatches() const { return m_paintController->m_numOutOfOrderMatches; } |
int numIndexedItems() const { return m_paintController->m_numIndexedItems; } |
@@ -104,10 +104,8 @@ void drawClippedRect(GraphicsContext& context, const FakeDisplayItemClient& clie |
enum TestConfigurations { |
SPv1, |
SPv2, |
-#if DCHECK_IS_ON() |
UnderInvalidationCheckingSPv1, |
UnderInvalidationCheckingSPv2, |
-#endif |
}; |
// Tests using this class will be tested with under-invalidation-checking enabled and disabled. |
@@ -127,15 +125,13 @@ protected: |
case SPv2: |
RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); |
break; |
-#if DCHECK_IS_ON() |
case UnderInvalidationCheckingSPv1: |
- RuntimeEnabledFeatures::setSlimmingPaintUnderInvalidationCheckingEnabled(true); |
+ RuntimeEnabledFeatures::setPaintUnderInvalidationCheckingEnabled(true); |
break; |
case UnderInvalidationCheckingSPv2: |
RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); |
- RuntimeEnabledFeatures::setSlimmingPaintUnderInvalidationCheckingEnabled(true); |
+ RuntimeEnabledFeatures::setPaintUnderInvalidationCheckingEnabled(true); |
break; |
-#endif |
} |
} |
@@ -143,11 +139,7 @@ protected: |
PaintChunk::Id m_rootPaintChunkId; |
}; |
-#if DCHECK_IS_ON() |
INSTANTIATE_TEST_CASE_P(All, PaintControllerTest, ::testing::Values(SPv1, SPv2, UnderInvalidationCheckingSPv1, UnderInvalidationCheckingSPv2)); |
-#else |
-INSTANTIATE_TEST_CASE_P(All, PaintControllerTest, ::testing::Values(SPv1, SPv2)); |
-#endif |
TEST_P(PaintControllerTest, NestedRecorders) |
{ |
@@ -204,7 +196,7 @@ TEST_P(PaintControllerTest, UpdateBasic) |
drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300)); |
EXPECT_EQ(2, numCachedNewItems()); |
-#if DCHECK_IS_ON() |
+#ifndef NDEBUG |
EXPECT_EQ(2, numSequentialMatches()); |
EXPECT_EQ(0, numOutOfOrderMatches()); |
EXPECT_EQ(1, numIndexedItems()); |
@@ -258,7 +250,7 @@ TEST_P(PaintControllerTest, UpdateSwapOrder) |
drawRect(context, unaffected, foregroundDrawingType, FloatRect(300, 300, 10, 10)); |
EXPECT_EQ(6, numCachedNewItems()); |
-#if DCHECK_IS_ON() |
+#ifndef NDEBUG |
EXPECT_EQ(5, numSequentialMatches()); // second, first foreground, unaffected |
EXPECT_EQ(1, numOutOfOrderMatches()); // first |
EXPECT_EQ(2, numIndexedItems()); // first |
@@ -319,7 +311,7 @@ TEST_P(PaintControllerTest, UpdateSwapOrderWithInvalidation) |
drawRect(context, unaffected, foregroundDrawingType, FloatRect(300, 300, 10, 10)); |
EXPECT_EQ(4, numCachedNewItems()); |
-#if DCHECK_IS_ON() |
+#ifndef NDEBUG |
EXPECT_EQ(4, numSequentialMatches()); // second, unaffected |
EXPECT_EQ(0, numOutOfOrderMatches()); |
EXPECT_EQ(2, numIndexedItems()); |
@@ -368,7 +360,7 @@ TEST_P(PaintControllerTest, UpdateNewItemInMiddle) |
drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200)); |
EXPECT_EQ(2, numCachedNewItems()); |
-#if DCHECK_IS_ON() |
+#ifndef NDEBUG |
EXPECT_EQ(2, numSequentialMatches()); // first, second |
EXPECT_EQ(0, numOutOfOrderMatches()); |
EXPECT_EQ(0, numIndexedItems()); |
@@ -425,7 +417,7 @@ TEST_P(PaintControllerTest, UpdateInvalidationWithPhases) |
drawRect(context, third, foregroundDrawingType, FloatRect(300, 100, 50, 50)); |
EXPECT_EQ(4, numCachedNewItems()); |
-#if DCHECK_IS_ON() |
+#ifndef NDEBUG |
EXPECT_EQ(4, numSequentialMatches()); |
EXPECT_EQ(0, numOutOfOrderMatches()); |
EXPECT_EQ(2, numIndexedItems()); |
@@ -498,7 +490,7 @@ TEST_P(PaintControllerTest, UpdateAddFirstOverlap) |
drawRect(context, second, foregroundDrawingType, FloatRect(150, 150, 100, 100)); |
EXPECT_EQ(2, numCachedNewItems()); |
-#if DCHECK_IS_ON() |
+#ifndef NDEBUG |
EXPECT_EQ(2, numSequentialMatches()); |
EXPECT_EQ(0, numOutOfOrderMatches()); |
EXPECT_EQ(2, numIndexedItems()); |
@@ -616,7 +608,7 @@ TEST_P(PaintControllerTest, UpdateClip) |
drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 200, 200)); |
EXPECT_EQ(1, numCachedNewItems()); |
-#if DCHECK_IS_ON() |
+#ifndef NDEBUG |
EXPECT_EQ(1, numSequentialMatches()); |
EXPECT_EQ(0, numOutOfOrderMatches()); |
EXPECT_EQ(1, numIndexedItems()); |
@@ -697,7 +689,7 @@ TEST_P(PaintControllerTest, CachedDisplayItems) |
// The first display item should be updated. |
EXPECT_NE(firstPicture, static_cast<const DrawingDisplayItem&>(getPaintController().getDisplayItemList()[0]).picture()); |
// The second display item should be cached. |
- if (!RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) |
+ if (!RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) |
EXPECT_EQ(secondPicture, static_cast<const DrawingDisplayItem&>(getPaintController().getDisplayItemList()[1]).picture()); |
EXPECT_TRUE(getPaintController().clientCacheIsValid(first)); |
EXPECT_TRUE(getPaintController().clientCacheIsValid(second)); |
@@ -835,7 +827,7 @@ TEST_P(PaintControllerTest, CachedSubsequenceSwapOrder) |
} |
// Simulate the situation when container1 e.g. gets a z-index that is now greater than container2. |
- if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) { |
+ if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
// When under-invalidation-checking is enabled, useCachedSubsequenceIfPossible is forced off, |
// and the client is expected to create the same painting as in the previous paint. |
EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, container2)); |
@@ -868,7 +860,7 @@ TEST_P(PaintControllerTest, CachedSubsequenceSwapOrder) |
} |
EXPECT_EQ(12, numCachedNewItems()); |
-#if DCHECK_IS_ON() |
+#ifndef NDEBUG |
EXPECT_EQ(1, numSequentialMatches()); |
EXPECT_EQ(1, numOutOfOrderMatches()); |
EXPECT_EQ(5, numIndexedItems()); |
@@ -1044,7 +1036,7 @@ TEST_P(PaintControllerTest, CachedNestedSubsequenceUpdate) |
EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, container1)); |
SubsequenceRecorder r(context, container1); |
// Use cached subsequence of content1. |
- if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) { |
+ if (RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled()) { |
// When under-invalidation-checking is enabled, useCachedSubsequenceIfPossible is forced off, |
// and the client is expected to create the same painting as in the previous paint. |
EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, content1)); |
@@ -1066,7 +1058,7 @@ TEST_P(PaintControllerTest, CachedNestedSubsequenceUpdate) |
} |
EXPECT_EQ(4, numCachedNewItems()); |
-#if DCHECK_IS_ON() |
+#ifndef NDEBUG |
EXPECT_EQ(1, numSequentialMatches()); |
EXPECT_EQ(0, numOutOfOrderMatches()); |
EXPECT_EQ(2, numIndexedItems()); |
@@ -1154,7 +1146,7 @@ TEST_P(PaintControllerTest, SkipCache) |
getPaintController().endSkippingCache(); |
EXPECT_EQ(1, numCachedNewItems()); |
-#if DCHECK_IS_ON() |
+#ifndef NDEBUG |
EXPECT_EQ(1, numSequentialMatches()); |
EXPECT_EQ(0, numOutOfOrderMatches()); |
EXPECT_EQ(0, numIndexedItems()); |
@@ -1247,7 +1239,7 @@ TEST_P(PaintControllerTest, PartialSkipCache) |
drawRect(context, content, foregroundDrawingType, rect3); |
EXPECT_EQ(0, numCachedNewItems()); |
-#if DCHECK_IS_ON() |
+#ifndef NDEBUG |
EXPECT_EQ(0, numSequentialMatches()); |
EXPECT_EQ(0, numOutOfOrderMatches()); |
EXPECT_EQ(0, numIndexedItems()); |
@@ -1483,16 +1475,15 @@ TEST_F(PaintControllerTestBase, DISABLED_IsNotSuitableForGpuRasterizationConcave |
} |
} |
-// Under-invalidation checking is only available when DCHECK_IS_ON(). |
// Death tests don't work properly on Android. |
-#if DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) |
+#if defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) |
class PaintControllerUnderInvalidationTest : public PaintControllerTestBase { |
protected: |
void SetUp() override |
{ |
PaintControllerTestBase::SetUp(); |
- RuntimeEnabledFeatures::setSlimmingPaintUnderInvalidationCheckingEnabled(true); |
+ RuntimeEnabledFeatures::setPaintUnderInvalidationCheckingEnabled(true); |
} |
void testChangeDrawing() |
@@ -1761,6 +1752,6 @@ TEST_F(PaintControllerUnderInvalidationTest, FoldCompositingDrawingInSubsequence |
testFoldCompositingDrawingInSubsequence(); |
} |
-#endif // DCHECK_IS_ON() && defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) |
+#endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) |
} // namespace blink |