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 Webkit { | 15 namespace Webkit { |
16 class WebGraphicsContext3D; | 16 class WebGraphicsContext3D; |
17 } | 17 } |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 class ExternalBeginFrameSourceForTest; | 20 class FakeExternalBeginFrameSource; |
21 class FakeLayerTreeHostClient; | 21 class FakeLayerTreeHostClient; |
22 class FakeOutputSurface; | 22 class FakeOutputSurface; |
23 class LayerImpl; | 23 class LayerImpl; |
24 class LayerTreeHost; | 24 class LayerTreeHost; |
25 class LayerTreeHostClient; | 25 class LayerTreeHostClient; |
26 class LayerTreeHostImpl; | 26 class LayerTreeHostImpl; |
27 class TestContextProvider; | 27 class TestContextProvider; |
28 class TestWebGraphicsContext3D; | 28 class TestWebGraphicsContext3D; |
29 | 29 |
30 // Used by test stubs to notify the test when something interesting happens. | 30 // Used by test stubs to notify the test when something interesting happens. |
31 class TestHooks : public AnimationDelegate { | 31 class TestHooks : public AnimationDelegate { |
32 public: | 32 public: |
33 TestHooks(); | 33 TestHooks(); |
34 ~TestHooks() override; | 34 ~TestHooks() override; |
35 | 35 |
36 void ReadSettings(const LayerTreeSettings& settings); | 36 void ReadSettings(const LayerTreeSettings& settings); |
37 | 37 |
38 virtual void CreateResourceAndTileTaskWorkerPool( | 38 virtual void CreateResourceAndTileTaskWorkerPool( |
39 LayerTreeHostImpl* host_impl, | 39 LayerTreeHostImpl* host_impl, |
40 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 40 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
41 scoped_ptr<ResourcePool>* resource_pool, | 41 scoped_ptr<ResourcePool>* resource_pool, |
42 scoped_ptr<ResourcePool>* staging_resource_pool); | 42 scoped_ptr<ResourcePool>* staging_resource_pool); |
43 virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, | 43 virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, |
44 const BeginFrameArgs& args) {} | 44 const BeginFrameArgs& args) {} |
45 virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl, | 45 virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl, |
46 bool did_handle) {} | 46 CommitEarlyOutReason reason) {} |
47 virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) {} | 47 virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) {} |
48 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) {} | 48 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) {} |
49 virtual void WillActivateTreeOnThread(LayerTreeHostImpl* host_impl) {} | 49 virtual void WillActivateTreeOnThread(LayerTreeHostImpl* host_impl) {} |
50 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) {} | 50 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) {} |
51 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, | 51 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, |
52 bool success) {} | 52 bool success) {} |
53 virtual DrawResult PrepareToDrawOnThread( | 53 virtual DrawResult PrepareToDrawOnThread( |
54 LayerTreeHostImpl* host_impl, | 54 LayerTreeHostImpl* host_impl, |
55 LayerTreeHostImpl::FrameData* frame_data, | 55 LayerTreeHostImpl::FrameData* frame_data, |
56 DrawResult draw_result); | 56 DrawResult draw_result); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(); | 209 virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(); |
210 | 210 |
211 TestWebGraphicsContext3D* TestContext(); | 211 TestWebGraphicsContext3D* TestContext(); |
212 | 212 |
213 | 213 |
214 private: | 214 private: |
215 LayerTreeSettings settings_; | 215 LayerTreeSettings settings_; |
216 scoped_ptr<LayerTreeHostClientForTesting> client_; | 216 scoped_ptr<LayerTreeHostClientForTesting> client_; |
217 scoped_ptr<LayerTreeHost> layer_tree_host_; | 217 scoped_ptr<LayerTreeHost> layer_tree_host_; |
218 FakeOutputSurface* output_surface_; | 218 FakeOutputSurface* output_surface_; |
219 ExternalBeginFrameSourceForTest* external_begin_frame_source_; | 219 FakeExternalBeginFrameSource* external_begin_frame_source_; |
220 | 220 |
221 bool beginning_; | 221 bool beginning_; |
222 bool end_when_begin_returns_; | 222 bool end_when_begin_returns_; |
223 bool timed_out_; | 223 bool timed_out_; |
224 bool scheduled_; | 224 bool scheduled_; |
225 bool started_; | 225 bool started_; |
226 bool ended_; | 226 bool ended_; |
227 bool delegating_renderer_; | 227 bool delegating_renderer_; |
228 | 228 |
229 int timeout_seconds_; | 229 int timeout_seconds_; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ | 368 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ |
369 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) | 369 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) |
370 | 370 |
371 // Some tests want to control when notify ready for activation occurs, | 371 // Some tests want to control when notify ready for activation occurs, |
372 // but this is not supported in the single-threaded case. | 372 // but this is not supported in the single-threaded case. |
373 #define SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ | 373 #define SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ |
374 SINGLE_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ | 374 SINGLE_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ |
375 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 375 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
376 | 376 |
377 #endif // CC_TEST_LAYER_TREE_TEST_H_ | 377 #endif // CC_TEST_LAYER_TREE_TEST_H_ |
OLD | NEW |