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

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

Issue 2193293004: cc: Make LayerTreeTests use a DelegatingRenderer and Display. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: display-layertreetest: withperftestsfix Created 4 years, 4 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/test/layer_tree_pixel_test.cc ('k') | cc/test/layer_tree_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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_LAYER_TREE_TEST_H_ 5 #ifndef CC_TEST_LAYER_TREE_TEST_H_
6 #define CC_TEST_LAYER_TREE_TEST_H_ 6 #define CC_TEST_LAYER_TREE_TEST_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "cc/animation/animation_delegate.h" 10 #include "cc/animation/animation_delegate.h"
11 #include "cc/test/remote_proto_channel_bridge.h" 11 #include "cc/test/remote_proto_channel_bridge.h"
12 #include "cc/test/test_gpu_memory_buffer_manager.h"
12 #include "cc/test/test_hooks.h" 13 #include "cc/test/test_hooks.h"
14 #include "cc/test/test_task_graph_runner.h"
13 #include "cc/trees/layer_tree_host.h" 15 #include "cc/trees/layer_tree_host.h"
14 #include "cc/trees/layer_tree_host_impl.h" 16 #include "cc/trees/layer_tree_host_impl.h"
15 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
16 18
17 namespace cc { 19 namespace cc {
18 class AnimationPlayer; 20 class AnimationPlayer;
19 class FakeExternalBeginFrameSource;
20 class FakeLayerTreeHostClient; 21 class FakeLayerTreeHostClient;
21 class FakeOutputSurface; 22 class FakeOutputSurface;
22 class LayerImpl; 23 class LayerImpl;
23 class LayerTreeHost; 24 class LayerTreeHost;
24 class LayerTreeHostForTesting; 25 class LayerTreeHostForTesting;
25 class LayerTreeHostClient; 26 class LayerTreeHostClient;
26 class LayerTreeHostImpl; 27 class LayerTreeHostImpl;
28 class LayerTreeTestDelegatingOutputSurfaceClient;
27 class ProxyImpl; 29 class ProxyImpl;
28 class ProxyMain; 30 class ProxyMain;
29 class RemoteChannelImplForTest; 31 class RemoteChannelImplForTest;
30 class TestContextProvider; 32 class TestContextProvider;
33 class TestDelegatingOutputSurface;
31 class TestGpuMemoryBufferManager; 34 class TestGpuMemoryBufferManager;
32 class TestTaskGraphRunner; 35 class TestTaskGraphRunner;
33 class TestWebGraphicsContext3D; 36 class TestWebGraphicsContext3D;
34 37
35 // Creates the virtual viewport layer hierarchy under the given root_layer. 38 // Creates the virtual viewport layer hierarchy under the given root_layer.
36 // Convenient overload of the method below that creates a scrolling layer as 39 // Convenient overload of the method below that creates a scrolling layer as
37 // the outer viewport scroll layer. 40 // the outer viewport scroll layer.
38 void CreateVirtualViewportLayers(Layer* root_layer, 41 void CreateVirtualViewportLayers(Layer* root_layer,
39 const gfx::Size& inner_bounds, 42 const gfx::Size& inner_bounds,
40 const gfx::Size& outer_bounds, 43 const gfx::Size& outer_bounds,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void DispatchSetNeedsCommit(); 109 void DispatchSetNeedsCommit();
107 void DispatchSetNeedsUpdateLayers(); 110 void DispatchSetNeedsUpdateLayers();
108 void DispatchSetNeedsRedraw(); 111 void DispatchSetNeedsRedraw();
109 void DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect); 112 void DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect);
110 void DispatchSetVisible(bool visible); 113 void DispatchSetVisible(bool visible);
111 void DispatchSetNextCommitForcesRedraw(); 114 void DispatchSetNextCommitForcesRedraw();
112 void DispatchDidAddAnimation(); 115 void DispatchDidAddAnimation();
113 void DispatchCompositeImmediately(); 116 void DispatchCompositeImmediately();
114 void DispatchNextCommitWaitsForActivation(); 117 void DispatchNextCommitWaitsForActivation();
115 118
116 void SetOutputSurfaceOnLayerTreeHost(
117 std::unique_ptr<OutputSurface> output_surface);
118 std::unique_ptr<OutputSurface> ReleaseOutputSurfaceOnLayerTreeHost(); 119 std::unique_ptr<OutputSurface> ReleaseOutputSurfaceOnLayerTreeHost();
119 void SetVisibleOnLayerTreeHost(bool visible); 120 void SetVisibleOnLayerTreeHost(bool visible);
120 121
121 virtual void AfterTest() = 0; 122 virtual void AfterTest() = 0;
122 virtual void WillBeginTest(); 123 virtual void WillBeginTest();
123 virtual void BeginTest() = 0; 124 virtual void BeginTest() = 0;
124 virtual void SetupTree(); 125 virtual void SetupTree();
125 126
126 virtual void RunTest(CompositorMode mode, bool delegating_renderer); 127 virtual void RunTest(CompositorMode mode, bool delegating_renderer);
127 128
128 bool HasImplThread() const { return !!impl_thread_; } 129 bool HasImplThread() const { return !!impl_thread_; }
129 base::SingleThreadTaskRunner* ImplThreadTaskRunner() { 130 base::SingleThreadTaskRunner* ImplThreadTaskRunner() {
130 return impl_task_runner_.get(); 131 return impl_task_runner_.get();
131 } 132 }
132 base::SingleThreadTaskRunner* MainThreadTaskRunner() { 133 base::SingleThreadTaskRunner* MainThreadTaskRunner() {
133 return main_task_runner_.get(); 134 return main_task_runner_.get();
134 } 135 }
135 Proxy* proxy() const { 136 Proxy* proxy() const {
136 return layer_tree_host_ ? layer_tree_host_->proxy() : NULL; 137 return layer_tree_host_ ? layer_tree_host_->proxy() : NULL;
137 } 138 }
138 Proxy* remote_client_proxy() const; 139 Proxy* remote_client_proxy() const;
139 TaskRunnerProvider* task_runner_provider() const; 140 TaskRunnerProvider* task_runner_provider() const;
140 TaskGraphRunner* task_graph_runner() const; 141 TaskGraphRunner* task_graph_runner() const {
142 return task_graph_runner_.get();
143 }
141 bool TestEnded() const { return ended_; } 144 bool TestEnded() const { return ended_; }
142 145
143 LayerTreeHost* layer_tree_host(); 146 LayerTreeHost* layer_tree_host();
144 LayerTreeHost* remote_client_layer_tree_host(); 147 LayerTreeHost* remote_client_layer_tree_host();
145 bool delegating_renderer() const { return delegating_renderer_; } 148 bool delegating_renderer() const { return delegating_renderer_; }
146 SharedBitmapManager* shared_bitmap_manager() const { 149 SharedBitmapManager* shared_bitmap_manager() const {
147 return shared_bitmap_manager_.get(); 150 return shared_bitmap_manager_.get();
148 } 151 }
149 TestGpuMemoryBufferManager* gpu_memory_buffer_manager() { 152 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() {
150 return gpu_memory_buffer_manager_.get(); 153 return gpu_memory_buffer_manager_.get();
151 } 154 }
152 155
153 void DestroyLayerTreeHost(); 156 void DestroyLayerTreeHost();
154 void DestroyRemoteClientHost() override; 157 void DestroyRemoteClientHost() override;
155 158
156 void CreateRemoteClientHost( 159 void CreateRemoteClientHost(
157 const proto::CompositorMessageToImpl& proto) override; 160 const proto::CompositorMessageToImpl& proto) override;
158 161
159 // By default, output surface recreation is synchronous. 162 // By default, output surface recreation is synchronous.
160 void RequestNewOutputSurface() override; 163 void RequestNewOutputSurface() override;
161 // Override this for pixel tests, where you need a real output surface, or 164 // Override this and call the base class to change what ContextProviders will
162 // if you want to control the output surface used for drawing. 165 // be used (such as for pixel tests). Or override it and create your own
163 virtual std::unique_ptr<OutputSurface> CreateOutputSurface(); 166 // TestDelegatingOutputSurface to control how it is created.
167 virtual std::unique_ptr<TestDelegatingOutputSurface>
168 CreateDelegatingOutputSurface(
169 scoped_refptr<ContextProvider> compositor_context_provider,
170 scoped_refptr<ContextProvider> worker_context_provider);
171 // Override this and call the base class to change what ContextProvider will
172 // be used, such as to prevent sharing the context with the delegating
173 // OutputSurface. Or override it and create your own OutputSurface to change
174 // what type of OutputSurface is used, such as a real OutputSurface for pixel
175 // tests or a software-compositing OutputSurface.
176 virtual std::unique_ptr<OutputSurface> CreateDisplayOutputSurface(
177 scoped_refptr<ContextProvider> compositor_context_provider);
164 178
165 bool IsRemoteTest() const; 179 bool IsRemoteTest() const;
166 180
167 gfx::Vector2dF ScrollDelta(LayerImpl* layer_impl); 181 gfx::Vector2dF ScrollDelta(LayerImpl* layer_impl);
168 182
169 private: 183 private:
170 LayerTreeSettings settings_; 184 LayerTreeSettings settings_;
171 185
172 CompositorMode mode_; 186 CompositorMode mode_;
173 187
174 std::unique_ptr<LayerTreeHostClientForTesting> client_; 188 std::unique_ptr<LayerTreeHostClientForTesting> client_;
175 std::unique_ptr<LayerTreeHost> layer_tree_host_; 189 std::unique_ptr<LayerTreeHost> layer_tree_host_;
176 190
177 // The LayerTreeHost created by the cc embedder on the client in remote mode. 191 // The LayerTreeHost created by the cc embedder on the client in remote mode.
178 std::unique_ptr<LayerTreeHostForTesting> remote_client_layer_tree_host_; 192 std::unique_ptr<LayerTreeHostForTesting> remote_client_layer_tree_host_;
179 193
180 FakeExternalBeginFrameSource* external_begin_frame_source_;
181 RemoteProtoChannelBridge remote_proto_channel_bridge_; 194 RemoteProtoChannelBridge remote_proto_channel_bridge_;
182 195
183 std::unique_ptr<ImageSerializationProcessor> image_serialization_processor_; 196 std::unique_ptr<ImageSerializationProcessor> image_serialization_processor_;
184 197
185 bool beginning_; 198 bool beginning_ = false;
186 bool end_when_begin_returns_; 199 bool end_when_begin_returns_ = false;
187 bool timed_out_; 200 bool timed_out_ = false;
188 bool scheduled_; 201 bool scheduled_ = false;
189 bool started_; 202 bool started_ = false;
190 bool ended_; 203 bool ended_ = false;
191 bool delegating_renderer_; 204 bool delegating_renderer_ = false;
192 205
193 int timeout_seconds_; 206 int timeout_seconds_ = false;
194 207
208 std::unique_ptr<LayerTreeTestDelegatingOutputSurfaceClient>
209 delegating_output_surface_client_;
195 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 210 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
196 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; 211 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_;
197 std::unique_ptr<base::Thread> impl_thread_; 212 std::unique_ptr<base::Thread> impl_thread_;
198 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; 213 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_;
199 std::unique_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; 214 std::unique_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_;
200 std::unique_ptr<TestTaskGraphRunner> task_graph_runner_; 215 std::unique_ptr<TestTaskGraphRunner> task_graph_runner_;
201 base::CancelableClosure timeout_; 216 base::CancelableClosure timeout_;
202 scoped_refptr<TestContextProvider> compositor_contexts_; 217 scoped_refptr<TestContextProvider> compositor_contexts_;
203 base::WeakPtr<LayerTreeTest> main_thread_weak_ptr_; 218 base::WeakPtr<LayerTreeTest> main_thread_weak_ptr_;
204 base::WeakPtrFactory<LayerTreeTest> weak_factory_; 219 base::WeakPtrFactory<LayerTreeTest> weak_factory_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ 252 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \
238 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME); \ 253 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME); \
239 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) 254 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME)
240 255
241 // Some tests want to control when notify ready for activation occurs, 256 // Some tests want to control when notify ready for activation occurs,
242 // but this is not supported in the single-threaded case. 257 // but this is not supported in the single-threaded case.
243 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ 258 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \
244 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) 259 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME)
245 260
246 #endif // CC_TEST_LAYER_TREE_TEST_H_ 261 #endif // CC_TEST_LAYER_TREE_TEST_H_
OLDNEW
« no previous file with comments | « cc/test/layer_tree_pixel_test.cc ('k') | cc/test/layer_tree_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698