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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreePrinterTest.cpp

Issue 2647063002: Move property tree debugging code to platform/graphics/paint/ (try #2) (Closed)
Patch Set: none Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/PaintPropertyTreePrinter.h" 5 #include "core/paint/PaintPropertyTreePrinter.h"
6 6
7 #include "core/layout/LayoutObject.h" 7 #include "core/layout/LayoutObject.h"
8 #include "core/layout/LayoutTestHelper.h" 8 #include "core/layout/LayoutTestHelper.h"
9 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" 9 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
10 #include "testing/gmock/include/gmock/gmock-matchers.h" 10 #include "testing/gmock/include/gmock/gmock-matchers.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 #ifndef NDEBUG 13 #if DCHECK_IS_ON()
14 14
15 namespace blink { 15 namespace blink {
16 16
17 typedef bool TestParamRootLayerScrolling; 17 typedef bool TestParamRootLayerScrolling;
18 class PaintPropertyTreePrinterTest 18 class PaintPropertyTreePrinterTest
19 : public ::testing::WithParamInterface<TestParamRootLayerScrolling>, 19 : public ::testing::WithParamInterface<TestParamRootLayerScrolling>,
20 private ScopedSlimmingPaintV2ForTest, 20 private ScopedSlimmingPaintV2ForTest,
21 private ScopedRootLayerScrollingForTest, 21 private ScopedRootLayerScrollingForTest,
22 public RenderingTest { 22 public RenderingTest {
23 public: 23 public:
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 TEST_P(PaintPropertyTreePrinterTest, SimpleTransformTreePath) { 79 TEST_P(PaintPropertyTreePrinterTest, SimpleTransformTreePath) {
80 setBodyInnerHTML( 80 setBodyInnerHTML(
81 "<div id='transform' style='transform: translate3d(10px, 10px, " 81 "<div id='transform' style='transform: translate3d(10px, 10px, "
82 "0px);'></div>"); 82 "0px);'></div>");
83 LayoutObject* transformedObject = 83 LayoutObject* transformedObject =
84 document().getElementById("transform")->layoutObject(); 84 document().getElementById("transform")->layoutObject();
85 const auto* transformedObjectProperties = 85 const auto* transformedObjectProperties =
86 transformedObject->paintProperties(); 86 transformedObject->paintProperties();
87 String transformPathAsString = transformPaintPropertyPathAsString( 87 String transformPathAsString =
88 transformedObjectProperties->transform()); 88 transformedObjectProperties->transform()->toTreeString();
89 EXPECT_THAT(transformPathAsString.ascii().data(), 89 EXPECT_THAT(transformPathAsString.ascii().data(),
90 testing::MatchesRegex("root .* transform.*" 90 testing::MatchesRegex("root .* transform.*"
91 " .* transform.*" 91 " .* transform.*"
92 " .* transform.*" 92 " .* transform.*"
93 " .* transform.*")); 93 " .* transform.*"));
94 } 94 }
95 95
96 TEST_P(PaintPropertyTreePrinterTest, SimpleClipTreePath) { 96 TEST_P(PaintPropertyTreePrinterTest, SimpleClipTreePath) {
97 setBodyInnerHTML( 97 setBodyInnerHTML(
98 "<div id='clip' style='position: absolute; clip: rect(10px, 80px, 70px, " 98 "<div id='clip' style='position: absolute; clip: rect(10px, 80px, 70px, "
99 "40px);'></div>"); 99 "40px);'></div>");
100 LayoutObject* clippedObject = 100 LayoutObject* clippedObject =
101 document().getElementById("clip")->layoutObject(); 101 document().getElementById("clip")->layoutObject();
102 const auto* clippedObjectProperties = clippedObject->paintProperties(); 102 const auto* clippedObjectProperties = clippedObject->paintProperties();
103 String clipPathAsString = 103 String clipPathAsString = clippedObjectProperties->cssClip()->toTreeString();
104 clipPaintPropertyPathAsString(clippedObjectProperties->cssClip());
105 EXPECT_THAT(clipPathAsString.ascii().data(), 104 EXPECT_THAT(clipPathAsString.ascii().data(),
106 testing::MatchesRegex("root .* rect.*" 105 testing::MatchesRegex("root .* rect.*"
107 " .* rect.*" 106 " .* rect.*"
108 " .* rect.*")); 107 " .* rect.*"));
109 } 108 }
110 109
111 TEST_P(PaintPropertyTreePrinterTest, SimpleEffectTreePath) { 110 TEST_P(PaintPropertyTreePrinterTest, SimpleEffectTreePath) {
112 setBodyInnerHTML("<div id='effect' style='opacity: 0.9;'></div>"); 111 setBodyInnerHTML("<div id='effect' style='opacity: 0.9;'></div>");
113 LayoutObject* effectObject = 112 LayoutObject* effectObject =
114 document().getElementById("effect")->layoutObject(); 113 document().getElementById("effect")->layoutObject();
115 const auto* effectObjectProperties = effectObject->paintProperties(); 114 const auto* effectObjectProperties = effectObject->paintProperties();
116 String effectPathAsString = 115 String effectPathAsString = effectObjectProperties->effect()->toTreeString();
117 effectPaintPropertyPathAsString(effectObjectProperties->effect());
118 EXPECT_THAT(effectPathAsString.ascii().data(), 116 EXPECT_THAT(effectPathAsString.ascii().data(),
119 testing::MatchesRegex("root .* opacity.*" 117 testing::MatchesRegex("root .* opacity.*"
120 " .* opacity.*")); 118 " .* opacity.*"));
121 } 119 }
122 120
123 TEST_P(PaintPropertyTreePrinterTest, SimpleScrollTreePath) { 121 TEST_P(PaintPropertyTreePrinterTest, SimpleScrollTreePath) {
124 setBodyInnerHTML( 122 setBodyInnerHTML(
125 "<div id='scroll' style='overflow: scroll; height: 100px;'>" 123 "<div id='scroll' style='overflow: scroll; height: 100px;'>"
126 " <div id='forceScroll' style='height: 4000px;'></div>" 124 " <div id='forceScroll' style='height: 4000px;'></div>"
127 "</div>"); 125 "</div>");
128 LayoutObject* scrollObject = 126 LayoutObject* scrollObject =
129 document().getElementById("scroll")->layoutObject(); 127 document().getElementById("scroll")->layoutObject();
130 const auto* scrollObjectProperties = scrollObject->paintProperties(); 128 const auto* scrollObjectProperties = scrollObject->paintProperties();
131 String scrollPathAsString = 129 String scrollPathAsString = scrollObjectProperties->scroll()->toTreeString();
132 scrollPaintPropertyPathAsString(scrollObjectProperties->scroll());
133 EXPECT_THAT(scrollPathAsString.ascii().data(), 130 EXPECT_THAT(scrollPathAsString.ascii().data(),
134 testing::MatchesRegex("root .* scroll.*" 131 testing::MatchesRegex("root .* scroll.*"
135 " .* scroll.*")); 132 " .* scroll.*"));
136 } 133 }
137 134
138 } // namespace blink 135 } // namespace blink
139 136
140 #endif 137 #endif // if DCHECK_IS_ON()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698