| 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 TestContentLayer : public Layer { | 31 class TestContentLayer : public Layer { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 174 } |
| 174 }; | 175 }; |
| 175 | 176 |
| 176 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1; | 177 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1; |
| 177 | 178 |
| 178 template <typename Types> class OcclusionTrackerTest : public testing::Test { | 179 template <typename Types> class OcclusionTrackerTest : public testing::Test { |
| 179 protected: | 180 protected: |
| 180 explicit OcclusionTrackerTest(bool opaque_layers) | 181 explicit OcclusionTrackerTest(bool opaque_layers) |
| 181 : opaque_layers_(opaque_layers), | 182 : opaque_layers_(opaque_layers), |
| 182 client_(FakeLayerTreeHostClient::DIRECT_3D), | 183 client_(FakeLayerTreeHostClient::DIRECT_3D), |
| 183 host_(FakeLayerTreeHost::Create(&client_)) {} | 184 host_(FakeLayerTreeHost::Create(&client_, &task_graph_runner_)) {} |
| 184 | 185 |
| 185 virtual void RunMyTest() = 0; | 186 virtual void RunMyTest() = 0; |
| 186 | 187 |
| 187 void TearDown() override { DestroyLayers(); } | 188 void TearDown() override { DestroyLayers(); } |
| 188 | 189 |
| 189 typename Types::HostType* GetHost(); | 190 typename Types::HostType* GetHost(); |
| 190 | 191 |
| 191 typename Types::ContentLayerType* CreateRoot(const gfx::Transform& transform, | 192 typename Types::ContentLayerType* CreateRoot(const gfx::Transform& transform, |
| 192 const gfx::PointF& position, | 193 const gfx::PointF& position, |
| 193 const gfx::Size& bounds) { | 194 const gfx::Size& bounds) { |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 owning_layer->SetMaskLayer(layer.get()); | 441 owning_layer->SetMaskLayer(layer.get()); |
| 441 mask_layers_.push_back(layer); | 442 mask_layers_.push_back(layer); |
| 442 } | 443 } |
| 443 | 444 |
| 444 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { | 445 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { |
| 445 owning_layer->SetMaskLayer(layer.Pass()); | 446 owning_layer->SetMaskLayer(layer.Pass()); |
| 446 } | 447 } |
| 447 | 448 |
| 448 bool opaque_layers_; | 449 bool opaque_layers_; |
| 449 FakeLayerTreeHostClient client_; | 450 FakeLayerTreeHostClient client_; |
| 451 TestTaskGraphRunner task_graph_runner_; |
| 450 scoped_ptr<FakeLayerTreeHost> host_; | 452 scoped_ptr<FakeLayerTreeHost> host_; |
| 451 // These hold ownership of the layers for the duration of the test. | 453 // These hold ownership of the layers for the duration of the test. |
| 452 typename Types::LayerPtrType root_; | 454 typename Types::LayerPtrType root_; |
| 453 scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_; | 455 scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_; |
| 454 LayerImplList render_surface_layer_list_impl_; | 456 LayerImplList render_surface_layer_list_impl_; |
| 455 typename Types::TestLayerIterator layer_iterator_begin_; | 457 typename Types::TestLayerIterator layer_iterator_begin_; |
| 456 typename Types::TestLayerIterator layer_iterator_; | 458 typename Types::TestLayerIterator layer_iterator_; |
| 457 typename Types::LayerType* last_layer_visited_; | 459 typename Types::LayerType* last_layer_visited_; |
| 458 LayerList replica_layers_; | 460 LayerList replica_layers_; |
| 459 LayerList mask_layers_; | 461 LayerList mask_layers_; |
| (...skipping 2866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3326 EXPECT_EQ(gfx::Rect(), | 3328 EXPECT_EQ(gfx::Rect(), |
| 3327 occlusion.UnoccludedSurfaceContentRect( | 3329 occlusion.UnoccludedSurfaceContentRect( |
| 3328 surface, gfx::Rect(80, 70, 50, 50))); | 3330 surface, gfx::Rect(80, 70, 50, 50))); |
| 3329 } | 3331 } |
| 3330 }; | 3332 }; |
| 3331 | 3333 |
| 3332 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 3334 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
| 3333 | 3335 |
| 3334 } // namespace | 3336 } // namespace |
| 3335 } // namespace cc | 3337 } // namespace cc |
| OLD | NEW |