| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_position_constraint.h" | 5 #include "cc/layers/layer_position_constraint.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
| 10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
| 11 #include "cc/test/fake_layer_tree_host.h" | 11 #include "cc/test/fake_layer_tree_host.h" |
| 12 #include "cc/test/geometry_test_utils.h" | 12 #include "cc/test/geometry_test_utils.h" |
| 13 #include "cc/test/test_task_graph_runner.h" |
| 13 #include "cc/trees/layer_tree_host_common.h" | 14 #include "cc/trees/layer_tree_host_common.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 16 |
| 16 namespace cc { | 17 namespace cc { |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 class LayerWithForcedDrawsContent : public Layer { | 20 class LayerWithForcedDrawsContent : public Layer { |
| 20 public: | 21 public: |
| 21 explicit LayerWithForcedDrawsContent(const LayerSettings& settings) | 22 explicit LayerWithForcedDrawsContent(const LayerSettings& settings) |
| 22 : Layer(settings) {} | 23 : Layer(settings) {} |
| (...skipping 25 matching lines...) Expand all Loading... |
| 48 std::vector<LayerImpl*> dummy_render_surface_layer_list; | 49 std::vector<LayerImpl*> dummy_render_surface_layer_list; |
| 49 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 50 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 50 root_layer, root_layer->bounds(), &dummy_render_surface_layer_list); | 51 root_layer, root_layer->bounds(), &dummy_render_surface_layer_list); |
| 51 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 52 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 52 } | 53 } |
| 53 | 54 |
| 54 class LayerPositionConstraintTest : public testing::Test { | 55 class LayerPositionConstraintTest : public testing::Test { |
| 55 public: | 56 public: |
| 56 LayerPositionConstraintTest() | 57 LayerPositionConstraintTest() |
| 57 : fake_client_(FakeLayerTreeHostClient::DIRECT_3D), | 58 : fake_client_(FakeLayerTreeHostClient::DIRECT_3D), |
| 58 layer_tree_host_(FakeLayerTreeHost::Create(&fake_client_)), | 59 layer_tree_host_( |
| 60 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_)), |
| 59 root_impl_(nullptr), | 61 root_impl_(nullptr), |
| 60 scroll_layer_impl_(nullptr), | 62 scroll_layer_impl_(nullptr), |
| 61 child_transform_layer_impl_(nullptr), | 63 child_transform_layer_impl_(nullptr), |
| 62 child_impl_(nullptr), | 64 child_impl_(nullptr), |
| 63 grand_child_impl_(nullptr), | 65 grand_child_impl_(nullptr), |
| 64 great_grand_child_impl_(nullptr) { | 66 great_grand_child_impl_(nullptr) { |
| 65 layer_tree_host_->InitializeForTesting(scoped_ptr<Proxy>(new FakeProxy)); | 67 layer_tree_host_->InitializeForTesting(scoped_ptr<Proxy>(new FakeProxy)); |
| 66 CreateTreeForTest(); | 68 CreateTreeForTest(); |
| 67 fixed_to_top_left_.set_is_fixed_position(true); | 69 fixed_to_top_left_.set_is_fixed_position(true); |
| 68 fixed_to_bottom_right_.set_is_fixed_position(true); | 70 fixed_to_bottom_right_.set_is_fixed_position(true); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 root_impl_ = layer_tree_host_->CommitAndCreateLayerImplTree(); | 118 root_impl_ = layer_tree_host_->CommitAndCreateLayerImplTree(); |
| 117 scroll_layer_impl_ = root_impl_->children()[0]; | 119 scroll_layer_impl_ = root_impl_->children()[0]; |
| 118 child_transform_layer_impl_ = scroll_layer_impl_->children()[0]; | 120 child_transform_layer_impl_ = scroll_layer_impl_->children()[0]; |
| 119 child_impl_ = child_transform_layer_impl_->children()[0]; | 121 child_impl_ = child_transform_layer_impl_->children()[0]; |
| 120 grand_child_impl_ = child_impl_->children()[0]; | 122 grand_child_impl_ = child_impl_->children()[0]; |
| 121 great_grand_child_impl_ = grand_child_impl_->children()[0]; | 123 great_grand_child_impl_ = grand_child_impl_->children()[0]; |
| 122 } | 124 } |
| 123 | 125 |
| 124 protected: | 126 protected: |
| 125 FakeLayerTreeHostClient fake_client_; | 127 FakeLayerTreeHostClient fake_client_; |
| 128 TestTaskGraphRunner task_graph_runner_; |
| 126 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; | 129 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; |
| 127 LayerSettings layer_settings_; | 130 LayerSettings layer_settings_; |
| 128 scoped_refptr<Layer> root_; | 131 scoped_refptr<Layer> root_; |
| 129 scoped_refptr<Layer> scroll_layer_; | 132 scoped_refptr<Layer> scroll_layer_; |
| 130 scoped_refptr<Layer> child_transform_layer_; | 133 scoped_refptr<Layer> child_transform_layer_; |
| 131 scoped_refptr<Layer> child_; | 134 scoped_refptr<Layer> child_; |
| 132 scoped_refptr<Layer> grand_child_; | 135 scoped_refptr<Layer> grand_child_; |
| 133 scoped_refptr<Layer> great_grand_child_; | 136 scoped_refptr<Layer> great_grand_child_; |
| 134 LayerImpl* root_impl_; | 137 LayerImpl* root_impl_; |
| 135 LayerImpl* scroll_layer_impl_; | 138 LayerImpl* scroll_layer_impl_; |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 | 1013 |
| 1011 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_container2_transform, | 1014 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_container2_transform, |
| 1012 container2->draw_transform()); | 1015 container2->draw_transform()); |
| 1013 | 1016 |
| 1014 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_fixed_to_container2_transform, | 1017 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_fixed_to_container2_transform, |
| 1015 fixed_to_container2->draw_transform()); | 1018 fixed_to_container2->draw_transform()); |
| 1016 } | 1019 } |
| 1017 | 1020 |
| 1018 } // namespace | 1021 } // namespace |
| 1019 } // namespace cc | 1022 } // namespace cc |
| OLD | NEW |