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" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 virtual void AfterTest() = 0; | 247 virtual void AfterTest() = 0; |
248 virtual void WillBeginTest(); | 248 virtual void WillBeginTest(); |
249 virtual void BeginTest() = 0; | 249 virtual void BeginTest() = 0; |
250 virtual void SetupTree(); | 250 virtual void SetupTree(); |
251 | 251 |
252 virtual void RunTest(bool threaded, bool delegating_renderer); | 252 virtual void RunTest(bool threaded, bool delegating_renderer); |
253 | 253 |
254 bool HasImplThread() { return !!impl_thread_; } | 254 bool HasImplThread() { return !!impl_thread_; } |
255 base::SingleThreadTaskRunner* ImplThreadTaskRunner() { | 255 base::SingleThreadTaskRunner* ImplThreadTaskRunner() { |
256 DCHECK(proxy()); | 256 DCHECK(task_runner_provider()); |
257 return proxy()->ImplThreadTaskRunner() ? proxy()->ImplThreadTaskRunner() | 257 base::SingleThreadTaskRunner* impl_thread_task_runner = |
258 : main_task_runner_.get(); | 258 task_runner_provider()->ImplThreadTaskRunner(); |
| 259 return impl_thread_task_runner ? impl_thread_task_runner |
| 260 : main_task_runner_.get(); |
259 } | 261 } |
260 base::SingleThreadTaskRunner* MainThreadTaskRunner() { | 262 base::SingleThreadTaskRunner* MainThreadTaskRunner() { |
261 return main_task_runner_.get(); | 263 return main_task_runner_.get(); |
262 } | 264 } |
263 Proxy* proxy() const { | 265 Proxy* proxy() const { |
264 return layer_tree_host_ ? layer_tree_host_->proxy() : NULL; | 266 return layer_tree_host_ ? layer_tree_host_->proxy() : NULL; |
265 } | 267 } |
| 268 TaskRunnerProvider* task_runner_provider() const { |
| 269 return layer_tree_host_ ? layer_tree_host_->task_runner_provider() |
| 270 : nullptr; |
| 271 } |
266 TaskGraphRunner* task_graph_runner() const { | 272 TaskGraphRunner* task_graph_runner() const { |
267 return task_graph_runner_.get(); | 273 return task_graph_runner_.get(); |
268 } | 274 } |
269 | 275 |
270 bool TestEnded() const { return ended_; } | 276 bool TestEnded() const { return ended_; } |
271 | 277 |
272 LayerTreeHost* layer_tree_host(); | 278 LayerTreeHost* layer_tree_host(); |
273 bool delegating_renderer() const { return delegating_renderer_; } | 279 bool delegating_renderer() const { return delegating_renderer_; } |
274 FakeOutputSurface* output_surface() { return output_surface_; } | 280 FakeOutputSurface* output_surface() { return output_surface_; } |
275 int LastCommittedSourceFrameNumber(LayerTreeHostImpl* impl) const; | 281 int LastCommittedSourceFrameNumber(LayerTreeHostImpl* impl) const; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 371 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
366 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ | 372 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ |
367 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) | 373 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) |
368 | 374 |
369 // Some tests want to control when notify ready for activation occurs, | 375 // Some tests want to control when notify ready for activation occurs, |
370 // but this is not supported in the single-threaded case. | 376 // but this is not supported in the single-threaded case. |
371 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ | 377 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ |
372 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 378 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
373 | 379 |
374 #endif // CC_TEST_LAYER_TREE_TEST_H_ | 380 #endif // CC_TEST_LAYER_TREE_TEST_H_ |
OLD | NEW |