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