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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); | 139 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); |
140 | 140 |
141 RenderSurfaceList render_surface_list; | 141 RenderSurfaceList render_surface_list; |
142 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 142 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
143 root_ptr, root_ptr->bounds(), &render_surface_list); | 143 root_ptr, root_ptr->bounds(), &render_surface_list); |
144 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 144 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
145 | 145 |
146 IterateFrontToBack(); | 146 IterateFrontToBack(); |
147 EXPECT_COUNT(root_ptr, 5, -1, 4); | 147 EXPECT_COUNT(root_ptr, 5, -1, 4); |
148 EXPECT_COUNT(first_ptr, -1, -1, 3); | 148 EXPECT_COUNT(first_ptr, 5, -1, 3); |
149 EXPECT_COUNT(second_ptr, -1, -1, 2); | 149 EXPECT_COUNT(second_ptr, 5, -1, 2); |
150 EXPECT_COUNT(third_ptr, -1, -1, 1); | 150 EXPECT_COUNT(third_ptr, 5, -1, 1); |
151 EXPECT_COUNT(fourth_ptr, -1, -1, 0); | 151 EXPECT_COUNT(fourth_ptr, 5, -1, 0); |
152 } | 152 } |
153 | 153 |
154 TEST_F(EffectTreeLayerListIteratorTest, ComplexTree) { | 154 TEST_F(EffectTreeLayerListIteratorTest, ComplexTree) { |
155 std::unique_ptr<TestLayerImpl> root_layer = CreateLayer(); | 155 std::unique_ptr<TestLayerImpl> root_layer = CreateLayer(); |
156 std::unique_ptr<TestLayerImpl> root1 = CreateLayer(); | 156 std::unique_ptr<TestLayerImpl> root1 = CreateLayer(); |
157 std::unique_ptr<TestLayerImpl> root2 = CreateLayer(); | 157 std::unique_ptr<TestLayerImpl> root2 = CreateLayer(); |
158 std::unique_ptr<TestLayerImpl> root3 = CreateLayer(); | 158 std::unique_ptr<TestLayerImpl> root3 = CreateLayer(); |
159 std::unique_ptr<TestLayerImpl> root21 = CreateLayer(); | 159 std::unique_ptr<TestLayerImpl> root21 = CreateLayer(); |
160 std::unique_ptr<TestLayerImpl> root22 = CreateLayer(); | 160 std::unique_ptr<TestLayerImpl> root22 = CreateLayer(); |
161 std::unique_ptr<TestLayerImpl> root23 = CreateLayer(); | 161 std::unique_ptr<TestLayerImpl> root23 = CreateLayer(); |
(...skipping 21 matching lines...) Expand all Loading... |
183 | 183 |
184 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); | 184 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); |
185 | 185 |
186 RenderSurfaceList render_surface_list; | 186 RenderSurfaceList render_surface_list; |
187 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 187 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
188 root_ptr, root_ptr->bounds(), &render_surface_list); | 188 root_ptr, root_ptr->bounds(), &render_surface_list); |
189 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 189 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
190 | 190 |
191 IterateFrontToBack(); | 191 IterateFrontToBack(); |
192 EXPECT_COUNT(root_ptr, 9, -1, 8); | 192 EXPECT_COUNT(root_ptr, 9, -1, 8); |
193 EXPECT_COUNT(root1_ptr, -1, -1, 7); | 193 EXPECT_COUNT(root1_ptr, 9, -1, 7); |
194 EXPECT_COUNT(root2_ptr, -1, -1, 6); | 194 EXPECT_COUNT(root2_ptr, 9, -1, 6); |
195 EXPECT_COUNT(root21_ptr, -1, -1, 5); | 195 EXPECT_COUNT(root21_ptr, 9, -1, 5); |
196 EXPECT_COUNT(root22_ptr, -1, -1, 4); | 196 EXPECT_COUNT(root22_ptr, 9, -1, 4); |
197 EXPECT_COUNT(root221_ptr, -1, -1, 3); | 197 EXPECT_COUNT(root221_ptr, 9, -1, 3); |
198 EXPECT_COUNT(root23_ptr, -1, -1, 2); | 198 EXPECT_COUNT(root23_ptr, 9, -1, 2); |
199 EXPECT_COUNT(root231_ptr, -1, -1, 1); | 199 EXPECT_COUNT(root231_ptr, 9, -1, 1); |
200 EXPECT_COUNT(root3_ptr, -1, -1, 0); | 200 EXPECT_COUNT(root3_ptr, 9, -1, 0); |
201 } | 201 } |
202 | 202 |
203 TEST_F(EffectTreeLayerListIteratorTest, ComplexTreeMultiSurface) { | 203 TEST_F(EffectTreeLayerListIteratorTest, ComplexTreeMultiSurface) { |
204 std::unique_ptr<TestLayerImpl> root_layer = CreateLayer(); | 204 std::unique_ptr<TestLayerImpl> root_layer = CreateLayer(); |
205 std::unique_ptr<TestLayerImpl> root1 = CreateLayer(); | 205 std::unique_ptr<TestLayerImpl> root1 = CreateLayer(); |
206 std::unique_ptr<TestLayerImpl> root2 = CreateLayer(); | 206 std::unique_ptr<TestLayerImpl> root2 = CreateLayer(); |
207 std::unique_ptr<TestLayerImpl> root3 = CreateLayer(); | 207 std::unique_ptr<TestLayerImpl> root3 = CreateLayer(); |
208 std::unique_ptr<TestLayerImpl> root21 = CreateLayer(); | 208 std::unique_ptr<TestLayerImpl> root21 = CreateLayer(); |
209 std::unique_ptr<TestLayerImpl> root22 = CreateLayer(); | 209 std::unique_ptr<TestLayerImpl> root22 = CreateLayer(); |
210 std::unique_ptr<TestLayerImpl> root23 = CreateLayer(); | 210 std::unique_ptr<TestLayerImpl> root23 = CreateLayer(); |
(...skipping 25 matching lines...) Expand all Loading... |
236 | 236 |
237 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); | 237 host_impl_.active_tree()->SetRootLayerForTesting(std::move(root_layer)); |
238 | 238 |
239 RenderSurfaceList render_surface_list; | 239 RenderSurfaceList render_surface_list; |
240 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 240 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
241 root_ptr, root_ptr->bounds(), &render_surface_list); | 241 root_ptr, root_ptr->bounds(), &render_surface_list); |
242 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 242 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
243 | 243 |
244 IterateFrontToBack(); | 244 IterateFrontToBack(); |
245 EXPECT_COUNT(root_ptr, 14, -1, 13); | 245 EXPECT_COUNT(root_ptr, 14, -1, 13); |
246 EXPECT_COUNT(root1_ptr, -1, -1, 12); | 246 EXPECT_COUNT(root1_ptr, 14, -1, 12); |
247 EXPECT_COUNT(root2_ptr, 10, 11, -1); | 247 EXPECT_COUNT(root2_ptr, 10, 11, -1); |
248 EXPECT_COUNT(root21_ptr, -1, -1, 9); | 248 EXPECT_COUNT(root21_ptr, 10, 11, 9); |
249 EXPECT_COUNT(root22_ptr, 7, 8, 6); | 249 EXPECT_COUNT(root22_ptr, 7, 8, 6); |
250 EXPECT_COUNT(root221_ptr, -1, -1, 5); | 250 EXPECT_COUNT(root221_ptr, 7, 8, 5); |
251 EXPECT_COUNT(root23_ptr, 3, 4, 2); | 251 EXPECT_COUNT(root23_ptr, 3, 4, 2); |
252 EXPECT_COUNT(root231_ptr, -1, -1, 1); | 252 EXPECT_COUNT(root231_ptr, 3, 4, 1); |
253 EXPECT_COUNT(root3_ptr, -1, -1, 0); | 253 EXPECT_COUNT(root3_ptr, 14, -1, 0); |
254 } | 254 } |
255 | 255 |
256 } // namespace | 256 } // namespace |
257 } // namespace cc | 257 } // namespace cc |
OLD | NEW |