OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/trees/occlusion_tracker.h" | 5 #include "cc/trees/occlusion_tracker.h" |
6 | 6 |
7 #include "cc/animation/layer_animation_controller.h" | 7 #include "cc/animation/layer_animation_controller.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
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/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/output/filter_operation.h" | 13 #include "cc/output/filter_operation.h" |
14 #include "cc/output/filter_operations.h" | 14 #include "cc/output/filter_operations.h" |
15 #include "cc/test/animation_test_common.h" | 15 #include "cc/test/animation_test_common.h" |
16 #include "cc/test/fake_impl_proxy.h" | 16 #include "cc/test/fake_impl_proxy.h" |
17 #include "cc/test/fake_layer_tree_host.h" | 17 #include "cc/test/fake_layer_tree_host.h" |
18 #include "cc/test/fake_layer_tree_host_impl.h" | 18 #include "cc/test/fake_layer_tree_host_impl.h" |
19 #include "cc/test/geometry_test_utils.h" | 19 #include "cc/test/geometry_test_utils.h" |
20 #include "cc/test/test_occlusion_tracker.h" | 20 #include "cc/test/test_occlusion_tracker.h" |
| 21 #include "cc/test/test_task_graph_runner.h" |
21 #include "cc/trees/layer_tree_host_common.h" | 22 #include "cc/trees/layer_tree_host_common.h" |
22 #include "cc/trees/single_thread_proxy.h" | 23 #include "cc/trees/single_thread_proxy.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "ui/gfx/transform.h" | 26 #include "ui/gfx/transform.h" |
26 | 27 |
27 namespace cc { | 28 namespace cc { |
28 namespace { | 29 namespace { |
29 | 30 |
30 class TestContentLayerImpl : public LayerImpl { | 31 class TestContentLayerImpl : public LayerImpl { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 surface->draw_transform()) | 80 surface->draw_transform()) |
80 .GetUnoccludedContentRect(content_rect); | 81 .GetUnoccludedContentRect(content_rect); |
81 } | 82 } |
82 }; | 83 }; |
83 | 84 |
84 class OcclusionTrackerTest : public testing::Test { | 85 class OcclusionTrackerTest : public testing::Test { |
85 protected: | 86 protected: |
86 explicit OcclusionTrackerTest(bool opaque_layers) | 87 explicit OcclusionTrackerTest(bool opaque_layers) |
87 : opaque_layers_(opaque_layers), | 88 : opaque_layers_(opaque_layers), |
88 client_(FakeLayerTreeHostClient::DIRECT_3D), | 89 client_(FakeLayerTreeHostClient::DIRECT_3D), |
89 host_(FakeLayerTreeHost::Create(&client_)), | 90 host_(FakeLayerTreeHost::Create(&client_, &task_graph_runner_)), |
90 next_layer_impl_id_(1) {} | 91 next_layer_impl_id_(1) {} |
91 | 92 |
92 virtual void RunMyTest() = 0; | 93 virtual void RunMyTest() = 0; |
93 | 94 |
94 void TearDown() override { DestroyLayers(); } | 95 void TearDown() override { DestroyLayers(); } |
95 | 96 |
96 TestContentLayerImpl* CreateRoot(const gfx::Transform& transform, | 97 TestContentLayerImpl* CreateRoot(const gfx::Transform& transform, |
97 const gfx::PointF& position, | 98 const gfx::PointF& position, |
98 const gfx::Size& bounds) { | 99 const gfx::Size& bounds) { |
99 LayerTreeImpl* tree = host_->host_impl()->active_tree(); | 100 LayerTreeImpl* tree = host_->host_impl()->active_tree(); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 void SetReplica(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { | 303 void SetReplica(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { |
303 owning_layer->SetReplicaLayer(layer.Pass()); | 304 owning_layer->SetReplicaLayer(layer.Pass()); |
304 } | 305 } |
305 | 306 |
306 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { | 307 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { |
307 owning_layer->SetMaskLayer(layer.Pass()); | 308 owning_layer->SetMaskLayer(layer.Pass()); |
308 } | 309 } |
309 | 310 |
310 bool opaque_layers_; | 311 bool opaque_layers_; |
311 FakeLayerTreeHostClient client_; | 312 FakeLayerTreeHostClient client_; |
| 313 TestTaskGraphRunner task_graph_runner_; |
312 scoped_ptr<FakeLayerTreeHost> host_; | 314 scoped_ptr<FakeLayerTreeHost> host_; |
313 // These hold ownership of the layers for the duration of the test. | 315 // These hold ownership of the layers for the duration of the test. |
314 scoped_ptr<LayerImpl> root_; | 316 scoped_ptr<LayerImpl> root_; |
315 scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_; | 317 scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_; |
316 LayerImplList render_surface_layer_list_impl_; | 318 LayerImplList render_surface_layer_list_impl_; |
317 LayerIterator<LayerImpl> layer_iterator_begin_; | 319 LayerIterator<LayerImpl> layer_iterator_begin_; |
318 LayerIterator<LayerImpl> layer_iterator_; | 320 LayerIterator<LayerImpl> layer_iterator_; |
319 LayerList replica_layers_; | 321 LayerList replica_layers_; |
320 LayerList mask_layers_; | 322 LayerList mask_layers_; |
321 int next_layer_impl_id_; | 323 int next_layer_impl_id_; |
(...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2512 EXPECT_EQ(gfx::Rect(), | 2514 EXPECT_EQ(gfx::Rect(), |
2513 occlusion.UnoccludedSurfaceContentRect( | 2515 occlusion.UnoccludedSurfaceContentRect( |
2514 surface, gfx::Rect(80, 70, 50, 50))); | 2516 surface, gfx::Rect(80, 70, 50, 50))); |
2515 } | 2517 } |
2516 }; | 2518 }; |
2517 | 2519 |
2518 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 2520 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
2519 | 2521 |
2520 } // namespace | 2522 } // namespace |
2521 } // namespace cc | 2523 } // namespace cc |
OLD | NEW |