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

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

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