OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "cc/layers/effect_tree_layer_list_iterator.h" | 5 #include "cc/layers/effect_tree_layer_list_iterator.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 }; | 101 }; |
102 | 102 |
103 TEST_F(EffectTreeLayerListIteratorTest, TreeWithNoDrawnLayers) { | 103 TEST_F(EffectTreeLayerListIteratorTest, TreeWithNoDrawnLayers) { |
104 std::unique_ptr<TestLayerImpl> root_layer = CreateLayer(); | 104 std::unique_ptr<TestLayerImpl> root_layer = CreateLayer(); |
105 root_layer->SetDrawsContent(false); | 105 root_layer->SetDrawsContent(false); |
106 | 106 |
107 TestLayerImpl* root_ptr = root_layer.get(); | 107 TestLayerImpl* root_ptr = root_layer.get(); |
108 | 108 |
109 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); | 109 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); |
110 | 110 |
111 LayerImplList render_surface_layer_list; | 111 RenderSurfaceList render_surface_list; |
112 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 112 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
113 root_ptr, root_ptr->bounds(), &render_surface_layer_list); | 113 root_ptr, root_ptr->bounds(), &render_surface_list); |
114 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 114 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
115 | 115 |
116 IterateFrontToBack(); | 116 IterateFrontToBack(); |
117 EXPECT_COUNT(root_ptr, 0, -1, -1); | 117 EXPECT_COUNT(root_ptr, 0, -1, -1); |
118 } | 118 } |
119 | 119 |
120 TEST_F(EffectTreeLayerListIteratorTest, SimpleTree) { | 120 TEST_F(EffectTreeLayerListIteratorTest, SimpleTree) { |
121 std::unique_ptr<TestLayerImpl> root_layer = CreateLayer(); | 121 std::unique_ptr<TestLayerImpl> root_layer = CreateLayer(); |
122 std::unique_ptr<TestLayerImpl> first = CreateLayer(); | 122 std::unique_ptr<TestLayerImpl> first = CreateLayer(); |
123 std::unique_ptr<TestLayerImpl> second = CreateLayer(); | 123 std::unique_ptr<TestLayerImpl> second = CreateLayer(); |
124 std::unique_ptr<TestLayerImpl> third = CreateLayer(); | 124 std::unique_ptr<TestLayerImpl> third = CreateLayer(); |
125 std::unique_ptr<TestLayerImpl> fourth = CreateLayer(); | 125 std::unique_ptr<TestLayerImpl> fourth = CreateLayer(); |
126 | 126 |
127 TestLayerImpl* root_ptr = root_layer.get(); | 127 TestLayerImpl* root_ptr = root_layer.get(); |
128 TestLayerImpl* first_ptr = first.get(); | 128 TestLayerImpl* first_ptr = first.get(); |
129 TestLayerImpl* second_ptr = second.get(); | 129 TestLayerImpl* second_ptr = second.get(); |
130 TestLayerImpl* third_ptr = third.get(); | 130 TestLayerImpl* third_ptr = third.get(); |
131 TestLayerImpl* fourth_ptr = fourth.get(); | 131 TestLayerImpl* fourth_ptr = fourth.get(); |
132 | 132 |
133 root_layer->test_properties()->AddChild(std::move(first)); | 133 root_layer->test_properties()->AddChild(std::move(first)); |
134 root_layer->test_properties()->AddChild(std::move(second)); | 134 root_layer->test_properties()->AddChild(std::move(second)); |
135 root_layer->test_properties()->AddChild(std::move(third)); | 135 root_layer->test_properties()->AddChild(std::move(third)); |
136 root_layer->test_properties()->AddChild(std::move(fourth)); | 136 root_layer->test_properties()->AddChild(std::move(fourth)); |
137 | 137 |
138 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); | 138 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); |
139 | 139 |
140 LayerImplList render_surface_layer_list; | 140 RenderSurfaceList render_surface_list; |
141 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 141 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
142 root_ptr, root_ptr->bounds(), &render_surface_layer_list); | 142 root_ptr, root_ptr->bounds(), &render_surface_list); |
143 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 143 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
144 | 144 |
145 IterateFrontToBack(); | 145 IterateFrontToBack(); |
146 EXPECT_COUNT(root_ptr, 5, -1, 4); | 146 EXPECT_COUNT(root_ptr, 5, -1, 4); |
147 EXPECT_COUNT(first_ptr, -1, -1, 3); | 147 EXPECT_COUNT(first_ptr, -1, -1, 3); |
148 EXPECT_COUNT(second_ptr, -1, -1, 2); | 148 EXPECT_COUNT(second_ptr, -1, -1, 2); |
149 EXPECT_COUNT(third_ptr, -1, -1, 1); | 149 EXPECT_COUNT(third_ptr, -1, -1, 1); |
150 EXPECT_COUNT(fourth_ptr, -1, -1, 0); | 150 EXPECT_COUNT(fourth_ptr, -1, -1, 0); |
151 } | 151 } |
152 | 152 |
(...skipping 22 matching lines...) Expand all Loading... |
175 root23->test_properties()->AddChild(std::move(root231)); | 175 root23->test_properties()->AddChild(std::move(root231)); |
176 root2->test_properties()->AddChild(std::move(root21)); | 176 root2->test_properties()->AddChild(std::move(root21)); |
177 root2->test_properties()->AddChild(std::move(root22)); | 177 root2->test_properties()->AddChild(std::move(root22)); |
178 root2->test_properties()->AddChild(std::move(root23)); | 178 root2->test_properties()->AddChild(std::move(root23)); |
179 root_layer->test_properties()->AddChild(std::move(root1)); | 179 root_layer->test_properties()->AddChild(std::move(root1)); |
180 root_layer->test_properties()->AddChild(std::move(root2)); | 180 root_layer->test_properties()->AddChild(std::move(root2)); |
181 root_layer->test_properties()->AddChild(std::move(root3)); | 181 root_layer->test_properties()->AddChild(std::move(root3)); |
182 | 182 |
183 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); | 183 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); |
184 | 184 |
185 LayerImplList render_surface_layer_list; | 185 RenderSurfaceList render_surface_list; |
186 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 186 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
187 root_ptr, root_ptr->bounds(), &render_surface_layer_list); | 187 root_ptr, root_ptr->bounds(), &render_surface_list); |
188 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 188 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
189 | 189 |
190 IterateFrontToBack(); | 190 IterateFrontToBack(); |
191 EXPECT_COUNT(root_ptr, 9, -1, 8); | 191 EXPECT_COUNT(root_ptr, 9, -1, 8); |
192 EXPECT_COUNT(root1_ptr, -1, -1, 7); | 192 EXPECT_COUNT(root1_ptr, -1, -1, 7); |
193 EXPECT_COUNT(root2_ptr, -1, -1, 6); | 193 EXPECT_COUNT(root2_ptr, -1, -1, 6); |
194 EXPECT_COUNT(root21_ptr, -1, -1, 5); | 194 EXPECT_COUNT(root21_ptr, -1, -1, 5); |
195 EXPECT_COUNT(root22_ptr, -1, -1, 4); | 195 EXPECT_COUNT(root22_ptr, -1, -1, 4); |
196 EXPECT_COUNT(root221_ptr, -1, -1, 3); | 196 EXPECT_COUNT(root221_ptr, -1, -1, 3); |
197 EXPECT_COUNT(root23_ptr, -1, -1, 2); | 197 EXPECT_COUNT(root23_ptr, -1, -1, 2); |
(...skipping 30 matching lines...) Expand all Loading... |
228 root2->SetDrawsContent(false); | 228 root2->SetDrawsContent(false); |
229 root2->test_properties()->AddChild(std::move(root21)); | 229 root2->test_properties()->AddChild(std::move(root21)); |
230 root2->test_properties()->AddChild(std::move(root22)); | 230 root2->test_properties()->AddChild(std::move(root22)); |
231 root2->test_properties()->AddChild(std::move(root23)); | 231 root2->test_properties()->AddChild(std::move(root23)); |
232 root_layer->test_properties()->AddChild(std::move(root1)); | 232 root_layer->test_properties()->AddChild(std::move(root1)); |
233 root_layer->test_properties()->AddChild(std::move(root2)); | 233 root_layer->test_properties()->AddChild(std::move(root2)); |
234 root_layer->test_properties()->AddChild(std::move(root3)); | 234 root_layer->test_properties()->AddChild(std::move(root3)); |
235 | 235 |
236 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); | 236 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); |
237 | 237 |
238 LayerImplList render_surface_layer_list; | 238 RenderSurfaceList render_surface_list; |
239 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 239 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
240 root_ptr, root_ptr->bounds(), &render_surface_layer_list); | 240 root_ptr, root_ptr->bounds(), &render_surface_list); |
241 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 241 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
242 | 242 |
243 IterateFrontToBack(); | 243 IterateFrontToBack(); |
244 EXPECT_COUNT(root_ptr, 14, -1, 13); | 244 EXPECT_COUNT(root_ptr, 14, -1, 13); |
245 EXPECT_COUNT(root1_ptr, -1, -1, 12); | 245 EXPECT_COUNT(root1_ptr, -1, -1, 12); |
246 EXPECT_COUNT(root2_ptr, 10, 11, -1); | 246 EXPECT_COUNT(root2_ptr, 10, 11, -1); |
247 EXPECT_COUNT(root21_ptr, -1, -1, 9); | 247 EXPECT_COUNT(root21_ptr, -1, -1, 9); |
248 EXPECT_COUNT(root22_ptr, 7, 8, 6); | 248 EXPECT_COUNT(root22_ptr, 7, 8, 6); |
249 EXPECT_COUNT(root221_ptr, -1, -1, 5); | 249 EXPECT_COUNT(root221_ptr, -1, -1, 5); |
250 EXPECT_COUNT(root23_ptr, 3, 4, 2); | 250 EXPECT_COUNT(root23_ptr, 3, 4, 2); |
251 EXPECT_COUNT(root231_ptr, -1, -1, 1); | 251 EXPECT_COUNT(root231_ptr, -1, -1, 1); |
252 EXPECT_COUNT(root3_ptr, -1, -1, 0); | 252 EXPECT_COUNT(root3_ptr, -1, -1, 0); |
253 } | 253 } |
254 | 254 |
255 } // namespace | 255 } // namespace |
256 } // namespace cc | 256 } // namespace cc |
OLD | NEW |