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

Side by Side Diff: cc/layers/layer_list_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_iterator_unittest.cc ('k') | cc/layers/layer_utils_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 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 "cc/layers/layer_list_iterator.h" 5 #include "cc/layers/layer_list_iterator.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/containers/adapters.h" 9 #include "base/containers/adapters.h"
10 #include "cc/test/fake_impl_task_runner_provider.h" 10 #include "cc/test/fake_impl_task_runner_provider.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 LayerImpl::Create(host_impl.active_tree(), 3); 223 LayerImpl::Create(host_impl.active_tree(), 3);
224 std::unique_ptr<LayerImpl> layer4 = 224 std::unique_ptr<LayerImpl> layer4 =
225 LayerImpl::Create(host_impl.active_tree(), 4); 225 LayerImpl::Create(host_impl.active_tree(), 4);
226 std::unique_ptr<LayerImpl> layer5 = 226 std::unique_ptr<LayerImpl> layer5 =
227 LayerImpl::Create(host_impl.active_tree(), 5); 227 LayerImpl::Create(host_impl.active_tree(), 5);
228 std::unique_ptr<LayerImpl> layer6 = 228 std::unique_ptr<LayerImpl> layer6 =
229 LayerImpl::Create(host_impl.active_tree(), 6); 229 LayerImpl::Create(host_impl.active_tree(), 6);
230 std::unique_ptr<LayerImpl> layer7 = 230 std::unique_ptr<LayerImpl> layer7 =
231 LayerImpl::Create(host_impl.active_tree(), 7); 231 LayerImpl::Create(host_impl.active_tree(), 7);
232 232
233 layer2->AddChild(std::move(layer3)); 233 layer2->test_properties()->AddChild(std::move(layer3));
234 layer2->AddChild(std::move(layer4)); 234 layer2->test_properties()->AddChild(std::move(layer4));
235 235
236 layer5->AddChild(std::move(layer6)); 236 layer5->test_properties()->AddChild(std::move(layer6));
237 layer5->AddChild(std::move(layer7)); 237 layer5->test_properties()->AddChild(std::move(layer7));
238 238
239 layer1->AddChild(std::move(layer2)); 239 layer1->test_properties()->AddChild(std::move(layer2));
240 layer1->AddChild(std::move(layer5)); 240 layer1->test_properties()->AddChild(std::move(layer5));
241 241
242 host_impl.active_tree()->SetRootLayer(std::move(layer1)); 242 host_impl.active_tree()->SetRootLayer(std::move(layer1));
243 host_impl.active_tree()->BuildLayerListForTesting(); 243 host_impl.active_tree()->BuildLayerListForTesting();
244 244
245 int i = 1; 245 int i = 1;
246 for (auto* layer : *host_impl.active_tree()) { 246 for (auto* layer : *host_impl.active_tree()) {
247 EXPECT_EQ(i++, layer->id()); 247 EXPECT_EQ(i++, layer->id());
248 } 248 }
249 EXPECT_EQ(8, i); 249 EXPECT_EQ(8, i);
250 } 250 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 LayerImpl::Create(host_impl.active_tree(), 3); 313 LayerImpl::Create(host_impl.active_tree(), 3);
314 std::unique_ptr<LayerImpl> layer4 = 314 std::unique_ptr<LayerImpl> layer4 =
315 LayerImpl::Create(host_impl.active_tree(), 4); 315 LayerImpl::Create(host_impl.active_tree(), 4);
316 std::unique_ptr<LayerImpl> layer5 = 316 std::unique_ptr<LayerImpl> layer5 =
317 LayerImpl::Create(host_impl.active_tree(), 5); 317 LayerImpl::Create(host_impl.active_tree(), 5);
318 std::unique_ptr<LayerImpl> layer6 = 318 std::unique_ptr<LayerImpl> layer6 =
319 LayerImpl::Create(host_impl.active_tree(), 6); 319 LayerImpl::Create(host_impl.active_tree(), 6);
320 std::unique_ptr<LayerImpl> layer7 = 320 std::unique_ptr<LayerImpl> layer7 =
321 LayerImpl::Create(host_impl.active_tree(), 7); 321 LayerImpl::Create(host_impl.active_tree(), 7);
322 322
323 layer2->AddChild(std::move(layer3)); 323 layer2->test_properties()->AddChild(std::move(layer3));
324 layer2->AddChild(std::move(layer4)); 324 layer2->test_properties()->AddChild(std::move(layer4));
325 325
326 layer5->AddChild(std::move(layer6)); 326 layer5->test_properties()->AddChild(std::move(layer6));
327 layer5->AddChild(std::move(layer7)); 327 layer5->test_properties()->AddChild(std::move(layer7));
328 328
329 layer1->AddChild(std::move(layer2)); 329 layer1->test_properties()->AddChild(std::move(layer2));
330 layer1->AddChild(std::move(layer5)); 330 layer1->test_properties()->AddChild(std::move(layer5));
331 331
332 host_impl.active_tree()->SetRootLayer(std::move(layer1)); 332 host_impl.active_tree()->SetRootLayer(std::move(layer1));
333 host_impl.active_tree()->BuildLayerListForTesting(); 333 host_impl.active_tree()->BuildLayerListForTesting();
334 334
335 int i = 7; 335 int i = 7;
336 336
337 for (auto* layer : base::Reversed(*host_impl.active_tree())) { 337 for (auto* layer : base::Reversed(*host_impl.active_tree())) {
338 EXPECT_EQ(i--, layer->id()); 338 EXPECT_EQ(i--, layer->id());
339 } 339 }
340 340
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 LayerListReverseIterator<LayerImpl> it(nullptr); 372 LayerListReverseIterator<LayerImpl> it(nullptr);
373 LayerListReverseIterator<LayerImpl> end(nullptr); 373 LayerListReverseIterator<LayerImpl> end(nullptr);
374 374
375 EXPECT_EQ(it, end); 375 EXPECT_EQ(it, end);
376 ++it; 376 ++it;
377 EXPECT_EQ(it, end); 377 EXPECT_EQ(it, end);
378 } 378 }
379 379
380 } // namespace 380 } // namespace
381 } // namespace cc 381 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_iterator_unittest.cc ('k') | cc/layers/layer_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698