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 12 matching lines...) Expand all Loading... |
23 class LayerTreeHost; | 23 class LayerTreeHost; |
24 class LayerTreeHostClient; | 24 class LayerTreeHostClient; |
25 class LayerTreeHostImpl; | 25 class LayerTreeHostImpl; |
26 class TestContextProvider; | 26 class TestContextProvider; |
27 class TestWebGraphicsContext3D; | 27 class TestWebGraphicsContext3D; |
28 | 28 |
29 // Used by test stubs to notify the test when something interesting happens. | 29 // Used by test stubs to notify the test when something interesting happens. |
30 class TestHooks : public AnimationDelegate { | 30 class TestHooks : public AnimationDelegate { |
31 public: | 31 public: |
32 TestHooks(); | 32 TestHooks(); |
33 virtual ~TestHooks(); | 33 ~TestHooks() override; |
34 | 34 |
35 void ReadSettings(const LayerTreeSettings& settings); | 35 void ReadSettings(const LayerTreeSettings& settings); |
36 | 36 |
37 virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, | 37 virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, |
38 const BeginFrameArgs& args) {} | 38 const BeginFrameArgs& args) {} |
39 virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl, | 39 virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl, |
40 bool did_handle) {} | 40 bool did_handle) {} |
41 virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) {} | 41 virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) {} |
42 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) {} | 42 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) {} |
43 virtual void WillActivateTreeOnThread(LayerTreeHostImpl* host_impl) {} | 43 virtual void WillActivateTreeOnThread(LayerTreeHostImpl* host_impl) {} |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 // Hooks for SchedulerClient. | 84 // Hooks for SchedulerClient. |
85 virtual void ScheduledActionWillSendBeginMainFrame() {} | 85 virtual void ScheduledActionWillSendBeginMainFrame() {} |
86 virtual void ScheduledActionSendBeginMainFrame() {} | 86 virtual void ScheduledActionSendBeginMainFrame() {} |
87 virtual void ScheduledActionDrawAndSwapIfPossible() {} | 87 virtual void ScheduledActionDrawAndSwapIfPossible() {} |
88 virtual void ScheduledActionAnimate() {} | 88 virtual void ScheduledActionAnimate() {} |
89 virtual void ScheduledActionCommit() {} | 89 virtual void ScheduledActionCommit() {} |
90 virtual void ScheduledActionBeginOutputSurfaceCreation() {} | 90 virtual void ScheduledActionBeginOutputSurfaceCreation() {} |
91 | 91 |
92 // Implementation of AnimationDelegate: | 92 // Implementation of AnimationDelegate: |
93 virtual void NotifyAnimationStarted(base::TimeTicks monotonic_time, | 93 void NotifyAnimationStarted(base::TimeTicks monotonic_time, |
94 Animation::TargetProperty target_property, | 94 Animation::TargetProperty target_property, |
95 int group) override {} | 95 int group) override {} |
96 virtual void NotifyAnimationFinished( | 96 void NotifyAnimationFinished(base::TimeTicks monotonic_time, |
97 base::TimeTicks monotonic_time, | 97 Animation::TargetProperty target_property, |
98 Animation::TargetProperty target_property, | 98 int group) override {} |
99 int group) override {} | |
100 | 99 |
101 virtual void RequestNewOutputSurface(bool fallback) = 0; | 100 virtual void RequestNewOutputSurface(bool fallback) = 0; |
102 }; | 101 }; |
103 | 102 |
104 class BeginTask; | 103 class BeginTask; |
105 class LayerTreeHostClientForTesting; | 104 class LayerTreeHostClientForTesting; |
106 class TimeoutTask; | 105 class TimeoutTask; |
107 | 106 |
108 // The LayerTreeTests runs with the main loop running. It instantiates a single | 107 // The LayerTreeTests runs with the main loop running. It instantiates a single |
109 // LayerTreeHostForTesting and associated LayerTreeHostImplForTesting and | 108 // LayerTreeHostForTesting and associated LayerTreeHostImplForTesting and |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 bool TestEnded() const { return ended_; } | 180 bool TestEnded() const { return ended_; } |
182 | 181 |
183 LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); } | 182 LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); } |
184 bool delegating_renderer() const { return delegating_renderer_; } | 183 bool delegating_renderer() const { return delegating_renderer_; } |
185 FakeOutputSurface* output_surface() { return output_surface_; } | 184 FakeOutputSurface* output_surface() { return output_surface_; } |
186 int LastCommittedSourceFrameNumber(LayerTreeHostImpl* impl) const; | 185 int LastCommittedSourceFrameNumber(LayerTreeHostImpl* impl) const; |
187 | 186 |
188 void DestroyLayerTreeHost(); | 187 void DestroyLayerTreeHost(); |
189 | 188 |
190 // By default, output surface recreation is synchronous. | 189 // By default, output surface recreation is synchronous. |
191 virtual void RequestNewOutputSurface(bool fallback) override; | 190 void RequestNewOutputSurface(bool fallback) override; |
192 // Override this for pixel tests, where you need a real output surface. | 191 // Override this for pixel tests, where you need a real output surface. |
193 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback); | 192 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback); |
194 // Override this for unit tests, which should not produce pixel output. | 193 // Override this for unit tests, which should not produce pixel output. |
195 virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(bool fallback); | 194 virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(bool fallback); |
196 | 195 |
197 TestWebGraphicsContext3D* TestContext(); | 196 TestWebGraphicsContext3D* TestContext(); |
198 | 197 |
199 | 198 |
200 private: | 199 private: |
201 LayerTreeSettings settings_; | 200 LayerTreeSettings settings_; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ | 319 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ |
321 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) | 320 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) |
322 | 321 |
323 // Some tests want to control when notify ready for activation occurs, | 322 // Some tests want to control when notify ready for activation occurs, |
324 // but this is not supported in the single-threaded case. | 323 // but this is not supported in the single-threaded case. |
325 #define SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ | 324 #define SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ |
326 SINGLE_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ | 325 SINGLE_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ |
327 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 326 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
328 | 327 |
329 #endif // CC_TEST_LAYER_TREE_TEST_H_ | 328 #endif // CC_TEST_LAYER_TREE_TEST_H_ |
OLD | NEW |