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/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include "cc/layers/heads_up_display_layer_impl.h" | 7 #include "cc/layers/heads_up_display_layer_impl.h" |
8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
11 #include "cc/test/fake_layer_tree_host_impl.h" | 11 #include "cc/test/fake_layer_tree_host_impl.h" |
12 #include "cc/test/fake_output_surface.h" | 12 #include "cc/test/fake_output_surface.h" |
13 #include "cc/test/geometry_test_utils.h" | 13 #include "cc/test/geometry_test_utils.h" |
14 #include "cc/test/layer_tree_host_common_test.h" | 14 #include "cc/test/layer_tree_host_common_test.h" |
15 #include "cc/test/test_shared_bitmap_manager.h" | 15 #include "cc/test/test_shared_bitmap_manager.h" |
| 16 #include "cc/test/test_task_graph_runner.h" |
16 #include "cc/trees/layer_tree_host_impl.h" | 17 #include "cc/trees/layer_tree_host_impl.h" |
17 #include "ui/gfx/geometry/size_conversions.h" | 18 #include "ui/gfx/geometry/size_conversions.h" |
18 | 19 |
19 namespace cc { | 20 namespace cc { |
20 namespace { | 21 namespace { |
21 | 22 |
22 class LayerTreeImplTest : public LayerTreeHostCommonTest { | 23 class LayerTreeImplTest : public LayerTreeHostCommonTest { |
23 public: | 24 public: |
24 LayerTreeImplTest() { | 25 LayerTreeImplTest() { |
25 LayerTreeSettings settings; | 26 LayerTreeSettings settings; |
26 settings.layer_transforms_should_scale_layer_contents = true; | 27 settings.layer_transforms_should_scale_layer_contents = true; |
27 settings.scrollbar_show_scale_threshold = 1.1f; | 28 settings.scrollbar_show_scale_threshold = 1.1f; |
28 host_impl_.reset( | 29 host_impl_.reset(new FakeLayerTreeHostImpl( |
29 new FakeLayerTreeHostImpl(settings, &proxy_, &shared_bitmap_manager_)); | 30 settings, &proxy_, &shared_bitmap_manager_, &task_graph_runner_)); |
30 EXPECT_TRUE(host_impl_->InitializeRenderer(FakeOutputSurface::Create3d())); | 31 EXPECT_TRUE(host_impl_->InitializeRenderer(FakeOutputSurface::Create3d())); |
31 } | 32 } |
32 | 33 |
33 FakeLayerTreeHostImpl& host_impl() { return *host_impl_; } | 34 FakeLayerTreeHostImpl& host_impl() { return *host_impl_; } |
34 | 35 |
35 LayerImpl* root_layer() { return host_impl_->active_tree()->root_layer(); } | 36 LayerImpl* root_layer() { return host_impl_->active_tree()->root_layer(); } |
36 | 37 |
37 const LayerImplList& RenderSurfaceLayerList() const { | 38 const LayerImplList& RenderSurfaceLayerList() const { |
38 return host_impl_->active_tree()->RenderSurfaceLayerList(); | 39 return host_impl_->active_tree()->RenderSurfaceLayerList(); |
39 } | 40 } |
40 | 41 |
41 private: | 42 private: |
42 TestSharedBitmapManager shared_bitmap_manager_; | 43 TestSharedBitmapManager shared_bitmap_manager_; |
| 44 TestTaskGraphRunner task_graph_runner_; |
43 FakeImplProxy proxy_; | 45 FakeImplProxy proxy_; |
44 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; | 46 scoped_ptr<FakeLayerTreeHostImpl> host_impl_; |
45 }; | 47 }; |
46 | 48 |
47 TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) { | 49 TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) { |
48 scoped_ptr<LayerImpl> root = | 50 scoped_ptr<LayerImpl> root = |
49 LayerImpl::Create(host_impl().active_tree(), 12345); | 51 LayerImpl::Create(host_impl().active_tree(), 12345); |
50 | 52 |
51 gfx::Transform identity_matrix; | 53 gfx::Transform identity_matrix; |
52 gfx::Point3F transform_origin; | 54 gfx::Point3F transform_origin; |
(...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2149 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); | 2151 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); |
2150 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 2152 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
2151 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); | 2153 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); |
2152 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); | 2154 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); |
2153 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); | 2155 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); |
2154 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); | 2156 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); |
2155 } | 2157 } |
2156 | 2158 |
2157 } // namespace | 2159 } // namespace |
2158 } // namespace cc | 2160 } // namespace cc |
OLD | NEW |