| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |