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/compositor_frame_sink.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" | |
15 #include "cc/test/test_shared_bitmap_manager.h" | |
16 #include "cc/test/test_task_graph_runner.h" | 14 #include "cc/test/test_task_graph_runner.h" |
17 #include "cc/tiles/tile_priority.h" | 15 #include "cc/tiles/tile_priority.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
20 | 18 |
21 namespace cc { | 19 namespace cc { |
22 | 20 |
23 class TestLayerTreeHostBase : public testing::Test { | 21 class TestLayerTreeHostBase : public testing::Test { |
24 protected: | 22 protected: |
25 TestLayerTreeHostBase(); | 23 TestLayerTreeHostBase(); |
26 ~TestLayerTreeHostBase() override; | 24 ~TestLayerTreeHostBase() override; |
27 | 25 |
28 void SetUp() override; | 26 void SetUp() override; |
29 | 27 |
30 virtual LayerTreeSettings CreateSettings(); | 28 virtual LayerTreeSettings CreateSettings(); |
31 virtual std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink(); | 29 virtual std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink(); |
32 virtual std::unique_ptr<FakeLayerTreeHostImpl> CreateHostImpl( | 30 virtual std::unique_ptr<FakeLayerTreeHostImpl> CreateHostImpl( |
33 const LayerTreeSettings& settings, | 31 const LayerTreeSettings& settings, |
34 TaskRunnerProvider* task_runner_provider, | 32 TaskRunnerProvider* task_runner_provider, |
35 SharedBitmapManager* shared_bitmap_manager, | 33 TaskGraphRunner* task_graph_runner); |
36 TaskGraphRunner* task_graph_runner, | |
37 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_); | |
38 virtual std::unique_ptr<TaskGraphRunner> CreateTaskGraphRunner(); | 34 virtual std::unique_ptr<TaskGraphRunner> CreateTaskGraphRunner(); |
39 virtual void InitializeRenderer(); | 35 virtual void InitializeRenderer(); |
40 | 36 |
41 void ResetCompositorFrameSink( | 37 void ResetCompositorFrameSink( |
42 std::unique_ptr<CompositorFrameSink> compositor_frame_sink); | 38 std::unique_ptr<CompositorFrameSink> compositor_frame_sink); |
43 std::unique_ptr<FakeLayerTreeHostImpl> TakeHostImpl(); | 39 std::unique_ptr<FakeLayerTreeHostImpl> TakeHostImpl(); |
44 | 40 |
45 void SetupDefaultTrees(const gfx::Size& layer_bounds); | 41 void SetupDefaultTrees(const gfx::Size& layer_bounds); |
46 void SetupTrees(scoped_refptr<RasterSource> pending_raster_source, | 42 void SetupTrees(scoped_refptr<RasterSource> pending_raster_source, |
47 scoped_refptr<RasterSource> active_raster_source); | 43 scoped_refptr<RasterSource> active_raster_source); |
(...skipping 13 matching lines...) Expand all Loading... |
61 } | 57 } |
62 FakePictureLayerImpl* pending_layer() const { return pending_layer_; } | 58 FakePictureLayerImpl* pending_layer() const { return pending_layer_; } |
63 FakePictureLayerImpl* active_layer() const { return active_layer_; } | 59 FakePictureLayerImpl* active_layer() const { return active_layer_; } |
64 FakePictureLayerImpl* old_pending_layer() const { return old_pending_layer_; } | 60 FakePictureLayerImpl* old_pending_layer() const { return old_pending_layer_; } |
65 int layer_id() const { return id_; } | 61 int layer_id() const { return id_; } |
66 | 62 |
67 private: | 63 private: |
68 void SetInitialTreePriority(); | 64 void SetInitialTreePriority(); |
69 | 65 |
70 FakeImplTaskRunnerProvider task_runner_provider_; | 66 FakeImplTaskRunnerProvider task_runner_provider_; |
71 TestSharedBitmapManager shared_bitmap_manager_; | |
72 std::unique_ptr<TaskGraphRunner> task_graph_runner_; | 67 std::unique_ptr<TaskGraphRunner> task_graph_runner_; |
73 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; | |
74 std::unique_ptr<CompositorFrameSink> compositor_frame_sink_; | 68 std::unique_ptr<CompositorFrameSink> compositor_frame_sink_; |
75 std::unique_ptr<FakeLayerTreeHostImpl> host_impl_; | 69 std::unique_ptr<FakeLayerTreeHostImpl> host_impl_; |
76 | 70 |
77 FakePictureLayerImpl* pending_layer_; | 71 FakePictureLayerImpl* pending_layer_; |
78 FakePictureLayerImpl* active_layer_; | 72 FakePictureLayerImpl* active_layer_; |
79 FakePictureLayerImpl* old_pending_layer_; | 73 FakePictureLayerImpl* old_pending_layer_; |
80 const int root_id_; | 74 const int root_id_; |
81 const int id_; | 75 const int id_; |
82 }; | 76 }; |
83 | 77 |
84 } // namespace cc | 78 } // namespace cc |
85 | 79 |
86 #endif // CC_TEST_TEST_LAYER_TREE_HOST_BASE_H_ | 80 #endif // CC_TEST_TEST_LAYER_TREE_HOST_BASE_H_ |
OLD | NEW |