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

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

Issue 2430813002: Switch to shorter names for property tree storage and updates (Closed)
Patch Set: Created 4 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 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"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 testing::MatchesRegex("root .*" 75 testing::MatchesRegex("root .*"
76 " Scroll \\(.*\\) .*")); 76 " Scroll \\(.*\\) .*"));
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 ObjectPaintProperties* transformedObjectProperties = 85 const auto* transformedObjectProperties =
86 transformedObject->objectPaintProperties(); 86 transformedObject->paintProperties();
87 String transformPathAsString = transformPaintPropertyPathAsString( 87 String transformPathAsString = transformPaintPropertyPathAsString(
88 transformedObjectProperties->transform()); 88 transformedObjectProperties->transform());
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 ObjectPaintProperties* clippedObjectProperties = 102 const auto* clippedObjectProperties = clippedObject->paintProperties();
103 clippedObject->objectPaintProperties();
104 String clipPathAsString = 103 String clipPathAsString =
105 clipPaintPropertyPathAsString(clippedObjectProperties->cssClip()); 104 clipPaintPropertyPathAsString(clippedObjectProperties->cssClip());
106 EXPECT_THAT(clipPathAsString.ascii().data(), 105 EXPECT_THAT(clipPathAsString.ascii().data(),
107 testing::MatchesRegex("root .* rect.*" 106 testing::MatchesRegex("root .* rect.*"
108 " .* rect.*" 107 " .* rect.*"
109 " .* rect.*")); 108 " .* rect.*"));
110 } 109 }
111 110
112 TEST_P(PaintPropertyTreePrinterTest, SimpleEffectTreePath) { 111 TEST_P(PaintPropertyTreePrinterTest, SimpleEffectTreePath) {
113 setBodyInnerHTML("<div id='effect' style='opacity: 0.9;'></div>"); 112 setBodyInnerHTML("<div id='effect' style='opacity: 0.9;'></div>");
114 LayoutObject* effectObject = 113 LayoutObject* effectObject =
115 document().getElementById("effect")->layoutObject(); 114 document().getElementById("effect")->layoutObject();
116 const ObjectPaintProperties* effectObjectProperties = 115 const auto* effectObjectProperties = effectObject->paintProperties();
117 effectObject->objectPaintProperties();
118 String effectPathAsString = 116 String effectPathAsString =
119 effectPaintPropertyPathAsString(effectObjectProperties->effect()); 117 effectPaintPropertyPathAsString(effectObjectProperties->effect());
120 EXPECT_THAT(effectPathAsString.ascii().data(), 118 EXPECT_THAT(effectPathAsString.ascii().data(),
121 testing::MatchesRegex("root .* opacity.*" 119 testing::MatchesRegex("root .* opacity.*"
122 " .* opacity.*")); 120 " .* opacity.*"));
123 } 121 }
124 122
125 TEST_P(PaintPropertyTreePrinterTest, SimpleScrollTreePath) { 123 TEST_P(PaintPropertyTreePrinterTest, SimpleScrollTreePath) {
126 setBodyInnerHTML( 124 setBodyInnerHTML(
127 "<div id='scroll' style='overflow: scroll; height: 100px;'>" 125 "<div id='scroll' style='overflow: scroll; height: 100px;'>"
128 " <div id='forceScroll' style='height: 4000px;'></div>" 126 " <div id='forceScroll' style='height: 4000px;'></div>"
129 "</div>"); 127 "</div>");
130 LayoutObject* scrollObject = 128 LayoutObject* scrollObject =
131 document().getElementById("scroll")->layoutObject(); 129 document().getElementById("scroll")->layoutObject();
132 const ObjectPaintProperties* scrollObjectProperties = 130 const auto* scrollObjectProperties = scrollObject->paintProperties();
133 scrollObject->objectPaintProperties();
134 String scrollPathAsString = 131 String scrollPathAsString =
135 scrollPaintPropertyPathAsString(scrollObjectProperties->scroll()); 132 scrollPaintPropertyPathAsString(scrollObjectProperties->scroll());
136 EXPECT_THAT(scrollPathAsString.ascii().data(), 133 EXPECT_THAT(scrollPathAsString.ascii().data(),
137 testing::MatchesRegex("root .* scroll.*" 134 testing::MatchesRegex("root .* scroll.*"
138 " .* scroll.*")); 135 " .* scroll.*"));
139 } 136 }
140 137
141 } // namespace blink 138 } // namespace blink
142 139
143 #endif 140 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698