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

Side by Side Diff: cc/layers/layer_iterator_unittest.cc

Issue 2084233002: cc: Move LayerImpl::AddChild and RemoveChild to LayerImplTestProperties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/layers/layer_list_iterator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layer_iterator.h" 5 #include "cc/layers/layer_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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 std::unique_ptr<TestLayerImpl> second = CreateLayer(); 124 std::unique_ptr<TestLayerImpl> second = CreateLayer();
125 std::unique_ptr<TestLayerImpl> third = CreateLayer(); 125 std::unique_ptr<TestLayerImpl> third = CreateLayer();
126 std::unique_ptr<TestLayerImpl> fourth = CreateLayer(); 126 std::unique_ptr<TestLayerImpl> fourth = CreateLayer();
127 127
128 TestLayerImpl* root_ptr = root_layer.get(); 128 TestLayerImpl* root_ptr = root_layer.get();
129 TestLayerImpl* first_ptr = first.get(); 129 TestLayerImpl* first_ptr = first.get();
130 TestLayerImpl* second_ptr = second.get(); 130 TestLayerImpl* second_ptr = second.get();
131 TestLayerImpl* third_ptr = third.get(); 131 TestLayerImpl* third_ptr = third.get();
132 TestLayerImpl* fourth_ptr = fourth.get(); 132 TestLayerImpl* fourth_ptr = fourth.get();
133 133
134 root_layer->AddChild(std::move(first)); 134 root_layer->test_properties()->AddChild(std::move(first));
135 root_layer->AddChild(std::move(second)); 135 root_layer->test_properties()->AddChild(std::move(second));
136 root_layer->AddChild(std::move(third)); 136 root_layer->test_properties()->AddChild(std::move(third));
137 root_layer->AddChild(std::move(fourth)); 137 root_layer->test_properties()->AddChild(std::move(fourth));
138 138
139 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); 139 host_impl_.active_tree()->SetRootLayer(std::move(root_layer));
140 140
141 LayerImplList render_surface_layer_list; 141 LayerImplList render_surface_layer_list;
142 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 142 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
143 root_ptr, root_ptr->bounds(), &render_surface_layer_list); 143 root_ptr, root_ptr->bounds(), &render_surface_layer_list);
144 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 144 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
145 145
146 IterateFrontToBack(&render_surface_layer_list); 146 IterateFrontToBack(&render_surface_layer_list);
147 EXPECT_COUNT(root_ptr, 5, -1, 4); 147 EXPECT_COUNT(root_ptr, 5, -1, 4);
(...skipping 17 matching lines...) Expand all
165 TestLayerImpl* root_ptr = root_layer.get(); 165 TestLayerImpl* root_ptr = root_layer.get();
166 TestLayerImpl* root1_ptr = root1.get(); 166 TestLayerImpl* root1_ptr = root1.get();
167 TestLayerImpl* root2_ptr = root2.get(); 167 TestLayerImpl* root2_ptr = root2.get();
168 TestLayerImpl* root3_ptr = root3.get(); 168 TestLayerImpl* root3_ptr = root3.get();
169 TestLayerImpl* root21_ptr = root21.get(); 169 TestLayerImpl* root21_ptr = root21.get();
170 TestLayerImpl* root22_ptr = root22.get(); 170 TestLayerImpl* root22_ptr = root22.get();
171 TestLayerImpl* root23_ptr = root23.get(); 171 TestLayerImpl* root23_ptr = root23.get();
172 TestLayerImpl* root221_ptr = root221.get(); 172 TestLayerImpl* root221_ptr = root221.get();
173 TestLayerImpl* root231_ptr = root231.get(); 173 TestLayerImpl* root231_ptr = root231.get();
174 174
175 root22->AddChild(std::move(root221)); 175 root22->test_properties()->AddChild(std::move(root221));
176 root23->AddChild(std::move(root231)); 176 root23->test_properties()->AddChild(std::move(root231));
177 root2->AddChild(std::move(root21)); 177 root2->test_properties()->AddChild(std::move(root21));
178 root2->AddChild(std::move(root22)); 178 root2->test_properties()->AddChild(std::move(root22));
179 root2->AddChild(std::move(root23)); 179 root2->test_properties()->AddChild(std::move(root23));
180 root_layer->AddChild(std::move(root1)); 180 root_layer->test_properties()->AddChild(std::move(root1));
181 root_layer->AddChild(std::move(root2)); 181 root_layer->test_properties()->AddChild(std::move(root2));
182 root_layer->AddChild(std::move(root3)); 182 root_layer->test_properties()->AddChild(std::move(root3));
183 183
184 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); 184 host_impl_.active_tree()->SetRootLayer(std::move(root_layer));
185 185
186 LayerImplList render_surface_layer_list; 186 LayerImplList render_surface_layer_list;
187 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 187 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
188 root_ptr, root_ptr->bounds(), &render_surface_layer_list); 188 root_ptr, root_ptr->bounds(), &render_surface_layer_list);
189 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 189 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
190 190
191 IterateFrontToBack(&render_surface_layer_list); 191 IterateFrontToBack(&render_surface_layer_list);
192 EXPECT_COUNT(root_ptr, 9, -1, 8); 192 EXPECT_COUNT(root_ptr, 9, -1, 8);
(...skipping 24 matching lines...) Expand all
217 TestLayerImpl* root3_ptr = root3.get(); 217 TestLayerImpl* root3_ptr = root3.get();
218 TestLayerImpl* root21_ptr = root21.get(); 218 TestLayerImpl* root21_ptr = root21.get();
219 TestLayerImpl* root22_ptr = root22.get(); 219 TestLayerImpl* root22_ptr = root22.get();
220 TestLayerImpl* root23_ptr = root23.get(); 220 TestLayerImpl* root23_ptr = root23.get();
221 TestLayerImpl* root221_ptr = root221.get(); 221 TestLayerImpl* root221_ptr = root221.get();
222 TestLayerImpl* root231_ptr = root231.get(); 222 TestLayerImpl* root231_ptr = root231.get();
223 223
224 root22->test_properties()->force_render_surface = true; 224 root22->test_properties()->force_render_surface = true;
225 root23->test_properties()->force_render_surface = true; 225 root23->test_properties()->force_render_surface = true;
226 root2->test_properties()->force_render_surface = true; 226 root2->test_properties()->force_render_surface = true;
227 root22->AddChild(std::move(root221)); 227 root22->test_properties()->AddChild(std::move(root221));
228 root23->AddChild(std::move(root231)); 228 root23->test_properties()->AddChild(std::move(root231));
229 root2->SetDrawsContent(false); 229 root2->SetDrawsContent(false);
230 root2->AddChild(std::move(root21)); 230 root2->test_properties()->AddChild(std::move(root21));
231 root2->AddChild(std::move(root22)); 231 root2->test_properties()->AddChild(std::move(root22));
232 root2->AddChild(std::move(root23)); 232 root2->test_properties()->AddChild(std::move(root23));
233 root_layer->AddChild(std::move(root1)); 233 root_layer->test_properties()->AddChild(std::move(root1));
234 root_layer->AddChild(std::move(root2)); 234 root_layer->test_properties()->AddChild(std::move(root2));
235 root_layer->AddChild(std::move(root3)); 235 root_layer->test_properties()->AddChild(std::move(root3));
236 236
237 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); 237 host_impl_.active_tree()->SetRootLayer(std::move(root_layer));
238 238
239 LayerImplList render_surface_layer_list; 239 LayerImplList render_surface_layer_list;
240 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 240 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
241 root_ptr, root_ptr->bounds(), &render_surface_layer_list); 241 root_ptr, root_ptr->bounds(), &render_surface_layer_list);
242 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 242 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
243 243
244 IterateFrontToBack(&render_surface_layer_list); 244 IterateFrontToBack(&render_surface_layer_list);
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, -1, -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, -1, -1, 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, -1, -1, 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, -1, -1, 1);
253 EXPECT_COUNT(root3_ptr, -1, -1, 0); 253 EXPECT_COUNT(root3_ptr, -1, -1, 0);
254 } 254 }
255 255
256 } // namespace 256 } // namespace
257 } // namespace cc 257 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/layers/layer_list_iterator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698