OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CC_TEST_TEST_LAYER_TREE_HOST_BASE_H_ | 5 #ifndef CC_TEST_TEST_LAYER_TREE_HOST_BASE_H_ |
6 #define CC_TEST_TEST_LAYER_TREE_HOST_BASE_H_ | 6 #define CC_TEST_TEST_LAYER_TREE_HOST_BASE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "cc/output/output_surface.h" | 10 #include "cc/output/compositor_frame_sink.h" |
11 #include "cc/test/fake_impl_task_runner_provider.h" | 11 #include "cc/test/fake_impl_task_runner_provider.h" |
12 #include "cc/test/fake_layer_tree_host_impl.h" | 12 #include "cc/test/fake_layer_tree_host_impl.h" |
13 #include "cc/test/fake_picture_layer_impl.h" | 13 #include "cc/test/fake_picture_layer_impl.h" |
14 #include "cc/test/test_gpu_memory_buffer_manager.h" | 14 #include "cc/test/test_gpu_memory_buffer_manager.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/test/test_task_graph_runner.h" |
17 #include "cc/tiles/tile_priority.h" | 17 #include "cc/tiles/tile_priority.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
20 | 20 |
21 namespace cc { | 21 namespace cc { |
22 | 22 |
23 class TestLayerTreeHostBase : public testing::Test { | 23 class TestLayerTreeHostBase : public testing::Test { |
24 protected: | 24 protected: |
25 TestLayerTreeHostBase(); | 25 TestLayerTreeHostBase(); |
26 ~TestLayerTreeHostBase() override; | 26 ~TestLayerTreeHostBase() override; |
27 | 27 |
28 void SetUp() override; | 28 void SetUp() override; |
29 | 29 |
30 virtual LayerTreeSettings CreateSettings(); | 30 virtual LayerTreeSettings CreateSettings(); |
31 virtual std::unique_ptr<OutputSurface> CreateOutputSurface(); | 31 virtual std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink(); |
32 virtual std::unique_ptr<FakeLayerTreeHostImpl> CreateHostImpl( | 32 virtual std::unique_ptr<FakeLayerTreeHostImpl> CreateHostImpl( |
33 const LayerTreeSettings& settings, | 33 const LayerTreeSettings& settings, |
34 TaskRunnerProvider* task_runner_provider, | 34 TaskRunnerProvider* task_runner_provider, |
35 SharedBitmapManager* shared_bitmap_manager, | 35 SharedBitmapManager* shared_bitmap_manager, |
36 TaskGraphRunner* task_graph_runner, | 36 TaskGraphRunner* task_graph_runner, |
37 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_); | 37 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_); |
38 virtual std::unique_ptr<TaskGraphRunner> CreateTaskGraphRunner(); | 38 virtual std::unique_ptr<TaskGraphRunner> CreateTaskGraphRunner(); |
39 virtual void InitializeRenderer(); | 39 virtual void InitializeRenderer(); |
40 | 40 |
41 void ResetOutputSurface(std::unique_ptr<OutputSurface> output_surface); | 41 void ResetCompositorFrameSink( |
| 42 std::unique_ptr<CompositorFrameSink> compositor_frame_sink); |
42 std::unique_ptr<FakeLayerTreeHostImpl> TakeHostImpl(); | 43 std::unique_ptr<FakeLayerTreeHostImpl> TakeHostImpl(); |
43 | 44 |
44 void SetupDefaultTrees(const gfx::Size& layer_bounds); | 45 void SetupDefaultTrees(const gfx::Size& layer_bounds); |
45 void SetupTrees(scoped_refptr<RasterSource> pending_raster_source, | 46 void SetupTrees(scoped_refptr<RasterSource> pending_raster_source, |
46 scoped_refptr<RasterSource> active_raster_source); | 47 scoped_refptr<RasterSource> active_raster_source); |
47 void SetupPendingTree(scoped_refptr<RasterSource> raster_source); | 48 void SetupPendingTree(scoped_refptr<RasterSource> raster_source); |
48 void SetupPendingTree(scoped_refptr<RasterSource> raster_source, | 49 void SetupPendingTree(scoped_refptr<RasterSource> raster_source, |
49 const gfx::Size& tile_size, | 50 const gfx::Size& tile_size, |
50 const Region& invalidation); | 51 const Region& invalidation); |
51 void ActivateTree(); | 52 void ActivateTree(); |
52 void RebuildPropertyTreesOnPendingTree(); | 53 void RebuildPropertyTreesOnPendingTree(); |
53 | 54 |
54 FakeLayerTreeHostImpl* host_impl() const { return host_impl_.get(); } | 55 FakeLayerTreeHostImpl* host_impl() const { return host_impl_.get(); } |
55 TaskGraphRunner* task_graph_runner() const { | 56 TaskGraphRunner* task_graph_runner() const { |
56 return task_graph_runner_.get(); | 57 return task_graph_runner_.get(); |
57 } | 58 } |
58 OutputSurface* output_surface() const { return output_surface_.get(); } | 59 CompositorFrameSink* compositor_frame_sink() const { |
| 60 return compositor_frame_sink_.get(); |
| 61 } |
59 FakePictureLayerImpl* pending_layer() const { return pending_layer_; } | 62 FakePictureLayerImpl* pending_layer() const { return pending_layer_; } |
60 FakePictureLayerImpl* active_layer() const { return active_layer_; } | 63 FakePictureLayerImpl* active_layer() const { return active_layer_; } |
61 FakePictureLayerImpl* old_pending_layer() const { return old_pending_layer_; } | 64 FakePictureLayerImpl* old_pending_layer() const { return old_pending_layer_; } |
62 int layer_id() const { return id_; } | 65 int layer_id() const { return id_; } |
63 | 66 |
64 private: | 67 private: |
65 void SetInitialTreePriority(); | 68 void SetInitialTreePriority(); |
66 | 69 |
67 FakeImplTaskRunnerProvider task_runner_provider_; | 70 FakeImplTaskRunnerProvider task_runner_provider_; |
68 TestSharedBitmapManager shared_bitmap_manager_; | 71 TestSharedBitmapManager shared_bitmap_manager_; |
69 std::unique_ptr<TaskGraphRunner> task_graph_runner_; | 72 std::unique_ptr<TaskGraphRunner> task_graph_runner_; |
70 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; | 73 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; |
71 std::unique_ptr<OutputSurface> output_surface_; | 74 std::unique_ptr<CompositorFrameSink> compositor_frame_sink_; |
72 std::unique_ptr<FakeLayerTreeHostImpl> host_impl_; | 75 std::unique_ptr<FakeLayerTreeHostImpl> host_impl_; |
73 | 76 |
74 FakePictureLayerImpl* pending_layer_; | 77 FakePictureLayerImpl* pending_layer_; |
75 FakePictureLayerImpl* active_layer_; | 78 FakePictureLayerImpl* active_layer_; |
76 FakePictureLayerImpl* old_pending_layer_; | 79 FakePictureLayerImpl* old_pending_layer_; |
77 const int root_id_; | 80 const int root_id_; |
78 const int id_; | 81 const int id_; |
79 }; | 82 }; |
80 | 83 |
81 } // namespace cc | 84 } // namespace cc |
82 | 85 |
83 #endif // CC_TEST_TEST_LAYER_TREE_HOST_BASE_H_ | 86 #endif // CC_TEST_TEST_LAYER_TREE_HOST_BASE_H_ |
OLD | NEW |