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/trees/layer_tree_host.h" | 11 #include "cc/trees/layer_tree_host.h" |
12 #include "cc/trees/layer_tree_host_impl.h" | 12 #include "cc/trees/layer_tree_host_impl.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 class FakeExternalBeginFrameSource; | 16 class FakeExternalBeginFrameSource; |
17 class FakeLayerTreeHostClient; | 17 class FakeLayerTreeHostClient; |
18 class FakeOutputSurface; | 18 class FakeOutputSurface; |
19 class LayerImpl; | 19 class LayerImpl; |
20 class LayerTreeHost; | 20 class LayerTreeHost; |
21 class LayerTreeHostClient; | 21 class LayerTreeHostClient; |
22 class LayerTreeHostImpl; | 22 class LayerTreeHostImpl; |
23 class TestContextProvider; | 23 class TestContextProvider; |
| 24 class TestGpuMemoryBufferManager; |
24 class TestWebGraphicsContext3D; | 25 class TestWebGraphicsContext3D; |
25 | 26 |
26 // Used by test stubs to notify the test when something interesting happens. | 27 // Used by test stubs to notify the test when something interesting happens. |
27 class TestHooks : public AnimationDelegate { | 28 class TestHooks : public AnimationDelegate { |
28 public: | 29 public: |
29 TestHooks(); | 30 TestHooks(); |
30 ~TestHooks() override; | 31 ~TestHooks() override; |
31 | 32 |
32 void ReadSettings(const LayerTreeSettings& settings); | 33 void ReadSettings(const LayerTreeSettings& settings); |
33 | 34 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 DCHECK(proxy()); | 189 DCHECK(proxy()); |
189 return proxy()->ImplThreadTaskRunner() ? proxy()->ImplThreadTaskRunner() | 190 return proxy()->ImplThreadTaskRunner() ? proxy()->ImplThreadTaskRunner() |
190 : main_task_runner_.get(); | 191 : main_task_runner_.get(); |
191 } | 192 } |
192 base::SingleThreadTaskRunner* MainThreadTaskRunner() { | 193 base::SingleThreadTaskRunner* MainThreadTaskRunner() { |
193 return main_task_runner_.get(); | 194 return main_task_runner_.get(); |
194 } | 195 } |
195 Proxy* proxy() const { | 196 Proxy* proxy() const { |
196 return layer_tree_host_ ? layer_tree_host_->proxy() : NULL; | 197 return layer_tree_host_ ? layer_tree_host_->proxy() : NULL; |
197 } | 198 } |
| 199 TaskGraphRunner* task_graph_runner() const { |
| 200 return task_graph_runner_.get(); |
| 201 } |
198 | 202 |
199 bool TestEnded() const { return ended_; } | 203 bool TestEnded() const { return ended_; } |
200 | 204 |
201 LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); } | 205 LayerTreeHost* layer_tree_host(); |
202 bool delegating_renderer() const { return delegating_renderer_; } | 206 bool delegating_renderer() const { return delegating_renderer_; } |
203 FakeOutputSurface* output_surface() { return output_surface_; } | 207 FakeOutputSurface* output_surface() { return output_surface_; } |
204 int LastCommittedSourceFrameNumber(LayerTreeHostImpl* impl) const; | 208 int LastCommittedSourceFrameNumber(LayerTreeHostImpl* impl) const; |
205 | 209 |
206 void DestroyLayerTreeHost(); | 210 void DestroyLayerTreeHost(); |
207 | 211 |
208 // By default, output surface recreation is synchronous. | 212 // By default, output surface recreation is synchronous. |
209 void RequestNewOutputSurface() override; | 213 void RequestNewOutputSurface() override; |
210 // Override this for pixel tests, where you need a real output surface. | 214 // Override this for pixel tests, where you need a real output surface. |
211 virtual scoped_ptr<OutputSurface> CreateOutputSurface(); | 215 virtual scoped_ptr<OutputSurface> CreateOutputSurface(); |
(...skipping 15 matching lines...) Expand all Loading... |
227 bool scheduled_; | 231 bool scheduled_; |
228 bool started_; | 232 bool started_; |
229 bool ended_; | 233 bool ended_; |
230 bool delegating_renderer_; | 234 bool delegating_renderer_; |
231 bool verify_property_trees_; | 235 bool verify_property_trees_; |
232 | 236 |
233 int timeout_seconds_; | 237 int timeout_seconds_; |
234 | 238 |
235 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 239 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
236 scoped_ptr<base::Thread> impl_thread_; | 240 scoped_ptr<base::Thread> impl_thread_; |
| 241 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; |
| 242 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
| 243 scoped_ptr<TaskGraphRunner> task_graph_runner_; |
237 base::CancelableClosure timeout_; | 244 base::CancelableClosure timeout_; |
238 scoped_refptr<TestContextProvider> compositor_contexts_; | 245 scoped_refptr<TestContextProvider> compositor_contexts_; |
239 base::WeakPtr<LayerTreeTest> main_thread_weak_ptr_; | 246 base::WeakPtr<LayerTreeTest> main_thread_weak_ptr_; |
240 base::WeakPtrFactory<LayerTreeTest> weak_factory_; | 247 base::WeakPtrFactory<LayerTreeTest> weak_factory_; |
241 }; | 248 }; |
242 | 249 |
243 } // namespace cc | 250 } // namespace cc |
244 | 251 |
245 #define SINGLE_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ | 252 #define SINGLE_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ |
246 TEST_F(TEST_FIXTURE_NAME, RunSingleThread_DirectRenderer_MainThreadPaint) { \ | 253 TEST_F(TEST_FIXTURE_NAME, RunSingleThread_DirectRenderer_MainThreadPaint) { \ |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ | 379 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ |
373 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) | 380 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) |
374 | 381 |
375 // Some tests want to control when notify ready for activation occurs, | 382 // Some tests want to control when notify ready for activation occurs, |
376 // but this is not supported in the single-threaded case. | 383 // but this is not supported in the single-threaded case. |
377 #define SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ | 384 #define SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ |
378 SINGLE_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ | 385 SINGLE_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ |
379 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 386 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
380 | 387 |
381 #endif // CC_TEST_LAYER_TREE_TEST_H_ | 388 #endif // CC_TEST_LAYER_TREE_TEST_H_ |
OLD | NEW |