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" | 14 #include "cc/test/test_shared_bitmap_manager.h" |
15 #include "cc/test/test_task_graph_runner.h" | 15 #include "cc/test/test_task_graph_runner.h" |
16 #include "cc/trees/layer_tree_impl.h" | 16 #include "cc/trees/layer_tree_impl.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "ui/gfx/geometry/box_f.h" | 18 #include "ui/gfx/geometry/box_f.h" |
19 #include "ui/gfx/test/gfx_util.h" | 19 #include "ui/gfx/test/gfx_util.h" |
20 | 20 |
21 namespace cc { | 21 namespace cc { |
22 namespace { | 22 namespace { |
23 | 23 |
24 float diagonal(float width, float height) { | 24 float diagonal(float width, float height) { |
25 return std::sqrt(width * width + height * height); | 25 return std::sqrt(width * width + height * height); |
26 } | 26 } |
27 | 27 |
28 class LayerTreeSettingsForAnimationBoundsTest : public LayerTreeSettings { | |
29 public: | |
30 LayerTreeSettingsForAnimationBoundsTest() { | |
31 use_compositor_animation_timelines = true; | |
32 } | |
33 }; | |
34 | |
35 class LayerUtilsGetAnimationBoundsTest : public testing::Test { | 28 class LayerUtilsGetAnimationBoundsTest : public testing::Test { |
36 public: | 29 public: |
37 LayerUtilsGetAnimationBoundsTest() | 30 LayerUtilsGetAnimationBoundsTest() |
38 : host_impl_(LayerTreeSettingsForAnimationBoundsTest(), | 31 : host_impl_(&task_runner_provider_, |
39 &task_runner_provider_, | |
40 &shared_bitmap_manager_, | 32 &shared_bitmap_manager_, |
41 &task_graph_runner_), | 33 &task_graph_runner_), |
42 root_(CreateTwoForkTree(&host_impl_)), | 34 root_(CreateTwoForkTree(&host_impl_)), |
43 parent1_(root_->children()[0].get()), | 35 parent1_(root_->children()[0].get()), |
44 parent2_(root_->children()[1].get()), | 36 parent2_(root_->children()[1].get()), |
45 child1_(parent1_->children()[0].get()), | 37 child1_(parent1_->children()[0].get()), |
46 child2_(parent2_->children()[0].get()), | 38 child2_(parent2_->children()[0].get()), |
47 grand_child_(child2_->children()[0].get()), | 39 grand_child_(child2_->children()[0].get()), |
48 great_grand_child_(grand_child_->children()[0].get()) { | 40 great_grand_child_(grand_child_->children()[0].get()) { |
49 timeline_ = | 41 timeline_ = |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 // Same as RotateXWithPerspectiveUnderAncestorsWithPositionOr2DTransform test, | 561 // Same as RotateXWithPerspectiveUnderAncestorsWithPositionOr2DTransform test, |
570 // except for the perspective calculations. | 562 // except for the perspective calculations. |
571 | 563 |
572 gfx::BoxF expected(295.f, 180.f, -25.f, 50.f, 50.f, 50.f); | 564 gfx::BoxF expected(295.f, 180.f, -25.f, 50.f, 50.f, 50.f); |
573 EXPECT_BOXF_EQ(expected, box); | 565 EXPECT_BOXF_EQ(expected, box); |
574 } | 566 } |
575 | 567 |
576 } // namespace | 568 } // namespace |
577 | 569 |
578 } // namespace cc | 570 } // namespace cc |
OLD | NEW |