OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "cc/animation/keyframed_animation_curve.h" | 8 #include "cc/animation/keyframed_animation_curve.h" |
9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
11 #include "cc/output/copy_output_request.h" | 11 #include "cc/output/copy_output_request.h" |
12 #include "cc/output/copy_output_result.h" | 12 #include "cc/output/copy_output_result.h" |
13 #include "cc/test/animation_test_common.h" | 13 #include "cc/test/animation_test_common.h" |
14 #include "cc/test/fake_impl_proxy.h" | 14 #include "cc/test/fake_impl_task_runner_provider.h" |
15 #include "cc/test/fake_layer_tree_host_client.h" | 15 #include "cc/test/fake_layer_tree_host_client.h" |
16 #include "cc/test/fake_layer_tree_host_impl.h" | 16 #include "cc/test/fake_layer_tree_host_impl.h" |
17 #include "cc/test/geometry_test_utils.h" | 17 #include "cc/test/geometry_test_utils.h" |
18 #include "cc/test/layer_test_common.h" | 18 #include "cc/test/layer_test_common.h" |
19 #include "cc/test/test_gpu_memory_buffer_manager.h" | 19 #include "cc/test/test_gpu_memory_buffer_manager.h" |
20 #include "cc/test/test_shared_bitmap_manager.h" | 20 #include "cc/test/test_shared_bitmap_manager.h" |
21 #include "cc/test/test_task_graph_runner.h" | 21 #include "cc/test/test_task_graph_runner.h" |
22 #include "cc/trees/layer_tree_host.h" | 22 #include "cc/trees/layer_tree_host.h" |
23 #include "cc/trees/single_thread_proxy.h" | 23 #include "cc/trees/single_thread_proxy.h" |
24 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 26 matching lines...) Expand all Loading... |
51 } | 51 } |
52 | 52 |
53 MOCK_METHOD0(SetNeedsCommit, void()); | 53 MOCK_METHOD0(SetNeedsCommit, void()); |
54 MOCK_METHOD0(SetNeedsUpdateLayers, void()); | 54 MOCK_METHOD0(SetNeedsUpdateLayers, void()); |
55 MOCK_METHOD0(SetNeedsFullTreeSync, void()); | 55 MOCK_METHOD0(SetNeedsFullTreeSync, void()); |
56 }; | 56 }; |
57 | 57 |
58 class LayerTest : public testing::Test { | 58 class LayerTest : public testing::Test { |
59 public: | 59 public: |
60 LayerTest() | 60 LayerTest() |
61 : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_), | 61 : host_impl_(&task_runner_provider_, |
| 62 &shared_bitmap_manager_, |
| 63 &task_graph_runner_), |
62 fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {} | 64 fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {} |
63 | 65 |
64 protected: | 66 protected: |
65 void SetUp() override { | 67 void SetUp() override { |
66 LayerTreeHost::InitParams params; | 68 LayerTreeHost::InitParams params; |
67 LayerTreeSettings settings; | 69 LayerTreeSettings settings; |
68 params.client = &fake_client_; | 70 params.client = &fake_client_; |
69 params.settings = &settings; | 71 params.settings = &settings; |
70 params.task_graph_runner = &task_graph_runner_; | 72 params.task_graph_runner = &task_graph_runner_; |
71 layer_tree_host_.reset( | 73 layer_tree_host_.reset( |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 parent_->AddChild(child3_); | 128 parent_->AddChild(child3_); |
127 child1_->AddChild(grand_child1_); | 129 child1_->AddChild(grand_child1_); |
128 child1_->AddChild(grand_child2_); | 130 child1_->AddChild(grand_child2_); |
129 child2_->AddChild(grand_child3_); | 131 child2_->AddChild(grand_child3_); |
130 | 132 |
131 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 133 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
132 | 134 |
133 VerifyTestTreeInitialState(); | 135 VerifyTestTreeInitialState(); |
134 } | 136 } |
135 | 137 |
136 FakeImplProxy proxy_; | 138 FakeImplTaskRunnerProvider task_runner_provider_; |
137 TestSharedBitmapManager shared_bitmap_manager_; | 139 TestSharedBitmapManager shared_bitmap_manager_; |
138 TestTaskGraphRunner task_graph_runner_; | 140 TestTaskGraphRunner task_graph_runner_; |
139 FakeLayerTreeHostImpl host_impl_; | 141 FakeLayerTreeHostImpl host_impl_; |
140 | 142 |
141 FakeLayerTreeHostClient fake_client_; | 143 FakeLayerTreeHostClient fake_client_; |
142 scoped_ptr<StrictMock<MockLayerTreeHost>> layer_tree_host_; | 144 scoped_ptr<StrictMock<MockLayerTreeHost>> layer_tree_host_; |
143 scoped_refptr<Layer> parent_; | 145 scoped_refptr<Layer> parent_; |
144 scoped_refptr<Layer> child1_; | 146 scoped_refptr<Layer> child1_; |
145 scoped_refptr<Layer> child2_; | 147 scoped_refptr<Layer> child2_; |
146 scoped_refptr<Layer> child3_; | 148 scoped_refptr<Layer> child3_; |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 | 1344 |
1343 // Scroll offset animation should not schedule a layer update since it is | 1345 // Scroll offset animation should not schedule a layer update since it is |
1344 // handled similarly to normal compositor scroll updates. | 1346 // handled similarly to normal compositor scroll updates. |
1345 EXPECT_CALL(*layer_tree_host_, SetNeedsUpdateLayers()).Times(0); | 1347 EXPECT_CALL(*layer_tree_host_, SetNeedsUpdateLayers()).Times(0); |
1346 layer->OnScrollOffsetAnimated(gfx::ScrollOffset(10, 10)); | 1348 layer->OnScrollOffsetAnimated(gfx::ScrollOffset(10, 10)); |
1347 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 1349 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
1348 } | 1350 } |
1349 | 1351 |
1350 } // namespace | 1352 } // namespace |
1351 } // namespace cc | 1353 } // namespace cc |
OLD | NEW |