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

Unified Diff: third_party/WebKit/Source/core/paint/DisplayItemListPaintTest.h

Issue 1401363003: Rename DisplayItemList to PaintController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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: third_party/WebKit/Source/core/paint/DisplayItemListPaintTest.h
diff --git a/third_party/WebKit/Source/core/paint/DisplayItemListPaintTest.h b/third_party/WebKit/Source/core/paint/DisplayItemListPaintTest.h
deleted file mode 100644
index 0355fa2b2bff74486d9f1a855537a858874cbe6f..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/core/paint/DisplayItemListPaintTest.h
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef DisplayItemListPaintTest_h
-#define DisplayItemListPaintTest_h
-
-#include "core/frame/FrameView.h"
-#include "core/layout/LayoutTestHelper.h"
-#include "core/layout/LayoutView.h"
-#include "core/paint/PaintLayer.h"
-#include "platform/graphics/GraphicsLayer.h"
-#include <gtest/gtest.h>
-
-namespace blink {
-
-class DisplayItemListPaintTest : public RenderingTest {
-public:
- DisplayItemListPaintTest()
- : m_originalSlimmingPaintSubsequenceCachingEnabled(RuntimeEnabledFeatures::slimmingPaintSubsequenceCachingEnabled())
- , m_originalSlimmingPaintOffsetCachingEnabled(RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled())
- { }
-
-protected:
- LayoutView& layoutView() { return *document().layoutView(); }
- DisplayItemList& rootDisplayItemList() { return *layoutView().layer()->graphicsLayerBacking()->displayItemList(); }
-
-private:
- void SetUp() override
- {
- RenderingTest::SetUp();
- enableCompositing();
- }
- void TearDown() override
- {
- RuntimeEnabledFeatures::setSlimmingPaintSubsequenceCachingEnabled(m_originalSlimmingPaintSubsequenceCachingEnabled);
- RuntimeEnabledFeatures::setSlimmingPaintOffsetCachingEnabled(m_originalSlimmingPaintOffsetCachingEnabled);
- }
-
- bool m_originalSlimmingPaintSubsequenceCachingEnabled;
- bool m_originalSlimmingPaintOffsetCachingEnabled;
-};
-
-// Slimming paint v2 has subtly different behavior on some paint tests. This
-// class is used to test only v2 behavior while maintaining v1 test coverage.
-class DisplayItemListPaintTestForSlimmingPaintV2 : public RenderingTest {
-public:
- DisplayItemListPaintTestForSlimmingPaintV2()
- : m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { }
-
-protected:
- LayoutView& layoutView() { return *document().layoutView(); }
- DisplayItemList& rootDisplayItemList() { return *layoutView().layer()->graphicsLayerBacking()->displayItemList(); }
- void setNeedsDisplayForRoot()
- {
- layoutView().layer()->graphicsLayerBacking()->setNeedsDisplay();
- }
- void setNeedsDisplayWithoutInvalidationForRoot()
- {
- layoutView().layer()->graphicsLayerBacking()->setNeedsDisplayWithoutInvalidateForTesting();
- }
-
- // Expose some document lifecycle steps for checking new display items before commiting.
- void updateLifecyclePhasesToPaintClean(const LayoutRect& interestRect = LayoutRect(LayoutRect::infiniteIntRect()))
- {
- document().view()->updateLifecyclePhasesInternal(FrameView::OnlyUpToCompositingCleanPlusScrolling, nullptr);
- document().view()->invalidateTreeIfNeededRecursive();
- document().view()->updatePaintProperties();
- document().view()->synchronizedPaint(&interestRect);
- }
- void compositeForSlimmingPaintV2() { document().view()->compositeForSlimmingPaintV2(); }
-
-private:
- void SetUp() override
- {
- RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true);
-
- RenderingTest::SetUp();
- enableCompositing();
- GraphicsLayer::setDrawDebugRedFillForTesting(false);
- }
-
- void TearDown() override
- {
- GraphicsLayer::setDrawDebugRedFillForTesting(true);
- RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPaintV2Enabled);
- }
-
- bool m_originalSlimmingPaintV2Enabled;
-};
-
-class TestDisplayItem final : public DisplayItem {
-public:
- TestDisplayItem(const DisplayItemClientWrapper& client, Type type) : DisplayItem(client, type, sizeof(*this)) { }
-
- void replay(GraphicsContext&) const final { ASSERT_NOT_REACHED(); }
- void appendToWebDisplayItemList(WebDisplayItemList*) const final { ASSERT_NOT_REACHED(); }
-};
-
-#ifndef NDEBUG
-#define TRACE_DISPLAY_ITEMS(i, expected, actual) \
- String trace = String::format("%d: ", (int)i) + "Expected: " + (expected).asDebugString() + " Actual: " + (actual).asDebugString(); \
- SCOPED_TRACE(trace.utf8().data());
-#else
-#define TRACE_DISPLAY_ITEMS(i, expected, actual)
-#endif
-
-#define EXPECT_DISPLAY_LIST(actual, expectedSize, ...) \
- do { \
- EXPECT_EQ((size_t)expectedSize, actual.size()); \
- if (expectedSize != actual.size()) \
- break; \
- const TestDisplayItem expected[] = { __VA_ARGS__ }; \
- for (size_t index = 0; index < std::min<size_t>(actual.size(), expectedSize); index++) { \
- TRACE_DISPLAY_ITEMS(index, expected[index], actual[index]); \
- EXPECT_EQ(expected[index].client(), actual[index].client()); \
- EXPECT_EQ(expected[index].type(), actual[index].type()); \
- } \
- } while (false);
-
-// Shorter names for frequently used display item types in tests.
-const DisplayItem::Type backgroundType = DisplayItem::BoxDecorationBackground;
-const DisplayItem::Type cachedBackgroundType = DisplayItem::drawingTypeToCachedDrawingType(backgroundType);
-const DisplayItem::Type foregroundType = DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground);
-const DisplayItem::Type cachedForegroundType = DisplayItem::drawingTypeToCachedDrawingType(foregroundType);
-const DisplayItem::Type subsequenceType = DisplayItem::SubsequenceNormalFlowAndPositiveZOrder;
-const DisplayItem::Type endSubsequenceType = DisplayItem::subsequenceTypeToEndSubsequenceType(subsequenceType);
-const DisplayItem::Type cachedSubsequenceType = DisplayItem::subsequenceTypeToCachedSubsequenceType(subsequenceType);
-
-} // namespace blink
-
-#endif // DisplayItemListPaintTest_h

Powered by Google App Engine
This is Rietveld 408576698