| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_utils.h" | 5 #include "cc/layers/layer_utils.h" |
| 6 | 6 |
| 7 #include "cc/animation/animation_host.h" | 7 #include "cc/animation/animation_host.h" |
| 8 #include "cc/animation/animation_id_provider.h" | 8 #include "cc/animation/animation_id_provider.h" |
| 9 #include "cc/animation/transform_operations.h" | 9 #include "cc/animation/transform_operations.h" |
| 10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
| 11 #include "cc/test/animation_test_common.h" | 11 #include "cc/test/animation_test_common.h" |
| 12 #include "cc/test/fake_impl_task_runner_provider.h" | 12 #include "cc/test/fake_impl_task_runner_provider.h" |
| 13 #include "cc/test/fake_layer_tree_host_impl.h" | 13 #include "cc/test/fake_layer_tree_host_impl.h" |
| 14 #include "cc/test/test_shared_bitmap_manager.h" | |
| 15 #include "cc/test/test_task_graph_runner.h" | 14 #include "cc/test/test_task_graph_runner.h" |
| 16 #include "cc/trees/layer_tree_host_common.h" | 15 #include "cc/trees/layer_tree_host_common.h" |
| 17 #include "cc/trees/layer_tree_impl.h" | 16 #include "cc/trees/layer_tree_impl.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "ui/gfx/geometry/box_f.h" | 18 #include "ui/gfx/geometry/box_f.h" |
| 20 #include "ui/gfx/test/gfx_util.h" | 19 #include "ui/gfx/test/gfx_util.h" |
| 21 | 20 |
| 22 namespace cc { | 21 namespace cc { |
| 23 namespace { | 22 namespace { |
| 24 | 23 |
| 25 float diagonal(float width, float height) { | 24 float diagonal(float width, float height) { |
| 26 return std::sqrt(width * width + height * height); | 25 return std::sqrt(width * width + height * height); |
| 27 } | 26 } |
| 28 | 27 |
| 29 class LayerUtilsGetAnimationBoundsTest : public testing::Test { | 28 class LayerUtilsGetAnimationBoundsTest : public testing::Test { |
| 30 public: | 29 public: |
| 31 LayerUtilsGetAnimationBoundsTest() | 30 LayerUtilsGetAnimationBoundsTest() |
| 32 : host_impl_(&task_runner_provider_, | 31 : host_impl_(&task_runner_provider_, &task_graph_runner_), |
| 33 &shared_bitmap_manager_, | |
| 34 &task_graph_runner_), | |
| 35 root_(CreateTwoForkTree(&host_impl_)), | 32 root_(CreateTwoForkTree(&host_impl_)), |
| 36 parent1_(root_->test_properties()->children[0]), | 33 parent1_(root_->test_properties()->children[0]), |
| 37 parent2_(root_->test_properties()->children[1]), | 34 parent2_(root_->test_properties()->children[1]), |
| 38 child1_(parent1_->test_properties()->children[0]), | 35 child1_(parent1_->test_properties()->children[0]), |
| 39 child2_(parent2_->test_properties()->children[0]), | 36 child2_(parent2_->test_properties()->children[0]), |
| 40 grand_child_(child2_->test_properties()->children[0]), | 37 grand_child_(child2_->test_properties()->children[0]), |
| 41 great_grand_child_(grand_child_->test_properties()->children[0]) { | 38 great_grand_child_(grand_child_->test_properties()->children[0]) { |
| 42 timeline_ = | 39 timeline_ = |
| 43 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); | 40 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
| 44 host_impl_.animation_host()->AddAnimationTimeline(timeline_); | 41 host_impl_.animation_host()->AddAnimationTimeline(timeline_); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 ->children[0] | 78 ->children[0] |
| 82 ->test_properties() | 79 ->test_properties() |
| 83 ->children[0] | 80 ->children[0] |
| 84 ->test_properties() | 81 ->test_properties() |
| 85 ->AddChild(LayerImpl::Create(host_impl->active_tree(), 7)); | 82 ->AddChild(LayerImpl::Create(host_impl->active_tree(), 7)); |
| 86 host_impl->active_tree()->SetRootLayerForTesting(std::move(root)); | 83 host_impl->active_tree()->SetRootLayerForTesting(std::move(root)); |
| 87 return root_ptr; | 84 return root_ptr; |
| 88 } | 85 } |
| 89 | 86 |
| 90 FakeImplTaskRunnerProvider task_runner_provider_; | 87 FakeImplTaskRunnerProvider task_runner_provider_; |
| 91 TestSharedBitmapManager shared_bitmap_manager_; | |
| 92 TestTaskGraphRunner task_graph_runner_; | 88 TestTaskGraphRunner task_graph_runner_; |
| 93 FakeLayerTreeHostImpl host_impl_; | 89 FakeLayerTreeHostImpl host_impl_; |
| 94 LayerImpl* root_; | 90 LayerImpl* root_; |
| 95 LayerImpl* parent1_; | 91 LayerImpl* parent1_; |
| 96 LayerImpl* parent2_; | 92 LayerImpl* parent2_; |
| 97 LayerImpl* child1_; | 93 LayerImpl* child1_; |
| 98 LayerImpl* child2_; | 94 LayerImpl* child2_; |
| 99 LayerImpl* grand_child_; | 95 LayerImpl* grand_child_; |
| 100 LayerImpl* great_grand_child_; | 96 LayerImpl* great_grand_child_; |
| 101 scoped_refptr<AnimationTimeline> timeline_; | 97 scoped_refptr<AnimationTimeline> timeline_; |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 // Same as RotateXWithPerspectiveUnderAncestorsWithPositionOr2DTransform test, | 576 // Same as RotateXWithPerspectiveUnderAncestorsWithPositionOr2DTransform test, |
| 581 // except for the perspective calculations. | 577 // except for the perspective calculations. |
| 582 | 578 |
| 583 gfx::BoxF expected(295.f, 180.f, -25.f, 50.f, 50.f, 50.f); | 579 gfx::BoxF expected(295.f, 180.f, -25.f, 50.f, 50.f, 50.f); |
| 584 EXPECT_BOXF_EQ(expected, box); | 580 EXPECT_BOXF_EQ(expected, box); |
| 585 } | 581 } |
| 586 | 582 |
| 587 } // namespace | 583 } // namespace |
| 588 | 584 |
| 589 } // namespace cc | 585 } // namespace cc |
| OLD | NEW |