Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: cc/test/test_layer_tree_host_base.h

Issue 1974033004: (reland) cc: Refactor layer/tile manager unittest to extract common code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix perftests Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/test/test_layer_tree_host_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/test/test_layer_tree_host_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698