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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Key stages of the drawing loop, e.g. drawing or commiting, redirect to | 96 // Key stages of the drawing loop, e.g. drawing or commiting, redirect to |
97 // LayerTreeTest methods of similar names. To track the commit process, override | 97 // LayerTreeTest methods of similar names. To track the commit process, override |
98 // these functions. | 98 // these functions. |
99 // | 99 // |
100 // The test continues until someone calls EndTest. EndTest can be called on any | 100 // The test continues until someone calls EndTest. EndTest can be called on any |
101 // thread, but be aware that ending the test is an asynchronous process. | 101 // thread, but be aware that ending the test is an asynchronous process. |
102 class LayerTreeTest : public testing::Test, public TestHooks { | 102 class LayerTreeTest : public testing::Test, public TestHooks { |
103 public: | 103 public: |
104 virtual ~LayerTreeTest(); | 104 virtual ~LayerTreeTest(); |
105 | 105 |
106 virtual void AfterTest() = 0; | |
107 virtual void BeginTest() = 0; | |
108 virtual void SetupTree(); | |
109 | |
110 virtual void EndTest(); | 106 virtual void EndTest(); |
111 void EndTestAfterDelay(int delay_milliseconds); | 107 void EndTestAfterDelay(int delay_milliseconds); |
112 | 108 |
113 void PostAddAnimationToMainThread(Layer* layer_to_receive_animation); | 109 void PostAddAnimationToMainThread(Layer* layer_to_receive_animation); |
114 void PostAddInstantAnimationToMainThread(Layer* layer_to_receive_animation); | 110 void PostAddInstantAnimationToMainThread(Layer* layer_to_receive_animation); |
115 void PostAddLongAnimationToMainThread(Layer* layer_to_receive_animation); | 111 void PostAddLongAnimationToMainThread(Layer* layer_to_receive_animation); |
116 void PostSetNeedsCommitToMainThread(); | 112 void PostSetNeedsCommitToMainThread(); |
117 void PostReadbackToMainThread(); | 113 void PostReadbackToMainThread(); |
118 void PostAcquireLayerTextures(); | 114 void PostAcquireLayerTextures(); |
119 void PostSetNeedsRedrawToMainThread(); | 115 void PostSetNeedsRedrawToMainThread(); |
(...skipping 18 matching lines...) Expand all Loading... |
138 void DispatchSetNeedsCommit(); | 134 void DispatchSetNeedsCommit(); |
139 void DispatchReadback(); | 135 void DispatchReadback(); |
140 void DispatchAcquireLayerTextures(); | 136 void DispatchAcquireLayerTextures(); |
141 void DispatchSetNeedsRedraw(); | 137 void DispatchSetNeedsRedraw(); |
142 void DispatchSetNeedsRedrawRect(gfx::Rect damage_rect); | 138 void DispatchSetNeedsRedrawRect(gfx::Rect damage_rect); |
143 void DispatchSetVisible(bool visible); | 139 void DispatchSetVisible(bool visible); |
144 void DispatchSetNextCommitForcesRedraw(); | 140 void DispatchSetNextCommitForcesRedraw(); |
145 void DispatchComposite(); | 141 void DispatchComposite(); |
146 void DispatchDidAddAnimation(); | 142 void DispatchDidAddAnimation(); |
147 | 143 |
| 144 virtual void AfterTest() = 0; |
| 145 virtual void WillBeginTest(); |
| 146 virtual void BeginTest() = 0; |
| 147 virtual void SetupTree(); |
| 148 |
148 virtual void RunTest(bool threaded, | 149 virtual void RunTest(bool threaded, |
149 bool delegating_renderer, | 150 bool delegating_renderer, |
150 bool impl_side_painting); | 151 bool impl_side_painting); |
151 virtual void RunTestWithImplSidePainting(); | 152 virtual void RunTestWithImplSidePainting(); |
152 | 153 |
153 bool HasImplThread() { return proxy() ? proxy()->HasImplThread() : false; } | 154 bool HasImplThread() { return proxy() ? proxy()->HasImplThread() : false; } |
154 base::SingleThreadTaskRunner* ImplThreadTaskRunner() { | 155 base::SingleThreadTaskRunner* ImplThreadTaskRunner() { |
155 DCHECK(proxy()); | 156 DCHECK(proxy()); |
156 return proxy()->ImplThreadTaskRunner() ? proxy()->ImplThreadTaskRunner() | 157 return proxy()->ImplThreadTaskRunner() ? proxy()->ImplThreadTaskRunner() |
157 : main_task_runner_.get(); | 158 : main_task_runner_.get(); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 270 |
270 #define SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ | 271 #define SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ |
271 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ | 272 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ |
272 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) | 273 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) |
273 | 274 |
274 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 275 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
275 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ | 276 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ |
276 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) | 277 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) |
277 | 278 |
278 #endif // CC_TEST_LAYER_TREE_TEST_H_ | 279 #endif // CC_TEST_LAYER_TREE_TEST_H_ |
OLD | NEW |