OLD | NEW |
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_gpu_memory_buffer_manager.h" |
13 #include "cc/test/test_hooks.h" | 13 #include "cc/test/test_hooks.h" |
14 #include "cc/test/test_task_graph_runner.h" | 14 #include "cc/test/test_task_graph_runner.h" |
15 #include "cc/trees/layer_tree_host.h" | 15 #include "cc/trees/layer_tree_host.h" |
16 #include "cc/trees/layer_tree_host_impl.h" | 16 #include "cc/trees/layer_tree_host_impl.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 class AnimationPlayer; | 20 class AnimationPlayer; |
21 class FakeLayerTreeHostClient; | 21 class FakeLayerTreeHostClient; |
22 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; | 27 class LayerTreeTestCompositorFrameSinkClient; |
29 class ProxyImpl; | 28 class ProxyImpl; |
30 class ProxyMain; | 29 class ProxyMain; |
31 class RemoteChannelImplForTest; | 30 class RemoteChannelImplForTest; |
32 class TestContextProvider; | 31 class TestContextProvider; |
33 class TestDelegatingOutputSurface; | 32 class TestCompositorFrameSink; |
34 class TestGpuMemoryBufferManager; | 33 class TestGpuMemoryBufferManager; |
35 class TestTaskGraphRunner; | 34 class TestTaskGraphRunner; |
36 class TestWebGraphicsContext3D; | 35 class TestWebGraphicsContext3D; |
37 | 36 |
38 // Creates the virtual viewport layer hierarchy under the given root_layer. | 37 // Creates the virtual viewport layer hierarchy under the given root_layer. |
39 // Convenient overload of the method below that creates a scrolling layer as | 38 // Convenient overload of the method below that creates a scrolling layer as |
40 // the outer viewport scroll layer. | 39 // the outer viewport scroll layer. |
41 void CreateVirtualViewportLayers(Layer* root_layer, | 40 void CreateVirtualViewportLayers(Layer* root_layer, |
42 const gfx::Size& inner_bounds, | 41 const gfx::Size& inner_bounds, |
43 const gfx::Size& outer_bounds, | 42 const gfx::Size& outer_bounds, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 void DispatchSetNeedsCommit(); | 108 void DispatchSetNeedsCommit(); |
110 void DispatchSetNeedsUpdateLayers(); | 109 void DispatchSetNeedsUpdateLayers(); |
111 void DispatchSetNeedsRedraw(); | 110 void DispatchSetNeedsRedraw(); |
112 void DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect); | 111 void DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect); |
113 void DispatchSetVisible(bool visible); | 112 void DispatchSetVisible(bool visible); |
114 void DispatchSetNextCommitForcesRedraw(); | 113 void DispatchSetNextCommitForcesRedraw(); |
115 void DispatchDidAddAnimation(); | 114 void DispatchDidAddAnimation(); |
116 void DispatchCompositeImmediately(); | 115 void DispatchCompositeImmediately(); |
117 void DispatchNextCommitWaitsForActivation(); | 116 void DispatchNextCommitWaitsForActivation(); |
118 | 117 |
119 std::unique_ptr<OutputSurface> ReleaseOutputSurfaceOnLayerTreeHost(); | 118 std::unique_ptr<CompositorFrameSink> |
| 119 ReleaseCompositorFrameSinkOnLayerTreeHost(); |
120 void SetVisibleOnLayerTreeHost(bool visible); | 120 void SetVisibleOnLayerTreeHost(bool visible); |
121 | 121 |
122 virtual void AfterTest() = 0; | 122 virtual void AfterTest() = 0; |
123 virtual void WillBeginTest(); | 123 virtual void WillBeginTest(); |
124 virtual void BeginTest() = 0; | 124 virtual void BeginTest() = 0; |
125 virtual void SetupTree(); | 125 virtual void SetupTree(); |
126 | 126 |
127 virtual void RunTest(CompositorMode mode); | 127 virtual void RunTest(CompositorMode mode); |
128 | 128 |
129 bool HasImplThread() const { return !!impl_thread_; } | 129 bool HasImplThread() const { return !!impl_thread_; } |
(...skipping 19 matching lines...) Expand all Loading... |
149 SharedBitmapManager* shared_bitmap_manager() const { | 149 SharedBitmapManager* shared_bitmap_manager() const { |
150 return shared_bitmap_manager_.get(); | 150 return shared_bitmap_manager_.get(); |
151 } | 151 } |
152 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() { | 152 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() { |
153 return gpu_memory_buffer_manager_.get(); | 153 return gpu_memory_buffer_manager_.get(); |
154 } | 154 } |
155 | 155 |
156 void DestroyLayerTreeHost(); | 156 void DestroyLayerTreeHost(); |
157 | 157 |
158 // By default, output surface recreation is synchronous. | 158 // By default, output surface recreation is synchronous. |
159 void RequestNewOutputSurface() override; | 159 void RequestNewCompositorFrameSink() override; |
160 // Override this and call the base class to change what ContextProviders will | 160 // Override this and call the base class to change what ContextProviders will |
161 // be used (such as for pixel tests). Or override it and create your own | 161 // be used (such as for pixel tests). Or override it and create your own |
162 // TestDelegatingOutputSurface to control how it is created. | 162 // TestCompositorFrameSink to control how it is created. |
163 virtual std::unique_ptr<TestDelegatingOutputSurface> | 163 virtual std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( |
164 CreateDelegatingOutputSurface( | |
165 scoped_refptr<ContextProvider> compositor_context_provider, | 164 scoped_refptr<ContextProvider> compositor_context_provider, |
166 scoped_refptr<ContextProvider> worker_context_provider); | 165 scoped_refptr<ContextProvider> worker_context_provider); |
167 // Override this and call the base class to change what ContextProvider will | 166 // Override this and call the base class to change what ContextProvider will |
168 // be used, such as to prevent sharing the context with the delegating | 167 // be used, such as to prevent sharing the context with the |
169 // OutputSurface. Or override it and create your own OutputSurface to change | 168 // CompositorFrameSink. Or override it and create your own OutputSurface to |
170 // what type of OutputSurface is used, such as a real OutputSurface for pixel | 169 // change what type of OutputSurface is used, such as a real OutputSurface for |
171 // tests or a software-compositing OutputSurface. | 170 // pixel tests or a software-compositing OutputSurface. |
172 virtual std::unique_ptr<OutputSurface> CreateDisplayOutputSurface( | 171 virtual std::unique_ptr<OutputSurface> CreateDisplayOutputSurface( |
173 scoped_refptr<ContextProvider> compositor_context_provider); | 172 scoped_refptr<ContextProvider> compositor_context_provider); |
174 | 173 |
175 bool IsRemoteTest() const; | 174 bool IsRemoteTest() const; |
176 | 175 |
177 gfx::Vector2dF ScrollDelta(LayerImpl* layer_impl); | 176 gfx::Vector2dF ScrollDelta(LayerImpl* layer_impl); |
178 | 177 |
179 private: | 178 private: |
180 LayerTreeSettings settings_; | 179 LayerTreeSettings settings_; |
181 | 180 |
(...skipping 11 matching lines...) Expand all Loading... |
193 | 192 |
194 bool beginning_ = false; | 193 bool beginning_ = false; |
195 bool end_when_begin_returns_ = false; | 194 bool end_when_begin_returns_ = false; |
196 bool timed_out_ = false; | 195 bool timed_out_ = false; |
197 bool scheduled_ = false; | 196 bool scheduled_ = false; |
198 bool started_ = false; | 197 bool started_ = false; |
199 bool ended_ = false; | 198 bool ended_ = false; |
200 | 199 |
201 int timeout_seconds_ = false; | 200 int timeout_seconds_ = false; |
202 | 201 |
203 std::unique_ptr<LayerTreeTestDelegatingOutputSurfaceClient> | 202 std::unique_ptr<LayerTreeTestCompositorFrameSinkClient> |
204 delegating_output_surface_client_; | 203 compositor_frame_sink_client_; |
205 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 204 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
206 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; | 205 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; |
207 std::unique_ptr<base::Thread> impl_thread_; | 206 std::unique_ptr<base::Thread> impl_thread_; |
208 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; | 207 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager_; |
209 std::unique_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 208 std::unique_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
210 std::unique_ptr<TestTaskGraphRunner> task_graph_runner_; | 209 std::unique_ptr<TestTaskGraphRunner> task_graph_runner_; |
211 base::CancelableClosure timeout_; | 210 base::CancelableClosure timeout_; |
212 scoped_refptr<TestContextProvider> compositor_contexts_; | 211 scoped_refptr<TestContextProvider> compositor_contexts_; |
213 base::WeakPtr<LayerTreeTest> main_thread_weak_ptr_; | 212 base::WeakPtr<LayerTreeTest> main_thread_weak_ptr_; |
214 base::WeakPtrFactory<LayerTreeTest> weak_factory_; | 213 base::WeakPtrFactory<LayerTreeTest> weak_factory_; |
(...skipping 16 matching lines...) Expand all Loading... |
231 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 230 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
232 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME); \ | 231 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME); \ |
233 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 232 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
234 | 233 |
235 // Some tests want to control when notify ready for activation occurs, | 234 // Some tests want to control when notify ready for activation occurs, |
236 // but this is not supported in the single-threaded case. | 235 // but this is not supported in the single-threaded case. |
237 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ | 236 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ |
238 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 237 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
239 | 238 |
240 #endif // CC_TEST_LAYER_TREE_TEST_H_ | 239 #endif // CC_TEST_LAYER_TREE_TEST_H_ |
OLD | NEW |