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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // Key stages of the drawing loop, e.g. drawing or commiting, redirect to | 104 // Key stages of the drawing loop, e.g. drawing or commiting, redirect to |
105 // LayerTreeTest methods of similar names. To track the commit process, override | 105 // LayerTreeTest methods of similar names. To track the commit process, override |
106 // these functions. | 106 // these functions. |
107 // | 107 // |
108 // The test continues until someone calls EndTest. EndTest can be called on any | 108 // The test continues until someone calls EndTest. EndTest can be called on any |
109 // thread, but be aware that ending the test is an asynchronous process. | 109 // thread, but be aware that ending the test is an asynchronous process. |
110 class LayerTreeTest : public testing::Test, public TestHooks { | 110 class LayerTreeTest : public testing::Test, public TestHooks { |
111 public: | 111 public: |
112 virtual ~LayerTreeTest(); | 112 virtual ~LayerTreeTest(); |
113 | 113 |
114 virtual void AfterTest() = 0; | |
115 virtual void BeginTest() = 0; | |
116 virtual void SetupTree(); | |
117 | |
118 virtual void EndTest(); | 114 virtual void EndTest(); |
119 void EndTestAfterDelay(int delay_milliseconds); | 115 void EndTestAfterDelay(int delay_milliseconds); |
120 | 116 |
121 void PostAddAnimationToMainThread(Layer* layer_to_receive_animation); | 117 void PostAddAnimationToMainThread(Layer* layer_to_receive_animation); |
122 void PostAddInstantAnimationToMainThread(Layer* layer_to_receive_animation); | 118 void PostAddInstantAnimationToMainThread(Layer* layer_to_receive_animation); |
123 void PostAddLongAnimationToMainThread(Layer* layer_to_receive_animation); | 119 void PostAddLongAnimationToMainThread(Layer* layer_to_receive_animation); |
124 void PostSetNeedsCommitToMainThread(); | 120 void PostSetNeedsCommitToMainThread(); |
125 void PostSetNeedsUpdateLayersToMainThread(); | 121 void PostSetNeedsUpdateLayersToMainThread(); |
126 void PostReadbackToMainThread(); | 122 void PostReadbackToMainThread(); |
127 void PostAcquireLayerTextures(); | 123 void PostAcquireLayerTextures(); |
(...skipping 20 matching lines...) Expand all Loading... |
148 void DispatchSetNeedsUpdateLayers(); | 144 void DispatchSetNeedsUpdateLayers(); |
149 void DispatchReadback(); | 145 void DispatchReadback(); |
150 void DispatchAcquireLayerTextures(); | 146 void DispatchAcquireLayerTextures(); |
151 void DispatchSetNeedsRedraw(); | 147 void DispatchSetNeedsRedraw(); |
152 void DispatchSetNeedsRedrawRect(gfx::Rect damage_rect); | 148 void DispatchSetNeedsRedrawRect(gfx::Rect damage_rect); |
153 void DispatchSetVisible(bool visible); | 149 void DispatchSetVisible(bool visible); |
154 void DispatchSetNextCommitForcesRedraw(); | 150 void DispatchSetNextCommitForcesRedraw(); |
155 void DispatchComposite(); | 151 void DispatchComposite(); |
156 void DispatchDidAddAnimation(); | 152 void DispatchDidAddAnimation(); |
157 | 153 |
| 154 virtual void AfterTest() = 0; |
| 155 virtual void WillBeginTest(); |
| 156 virtual void BeginTest() = 0; |
| 157 virtual void SetupTree(); |
| 158 |
158 virtual void RunTest(bool threaded, | 159 virtual void RunTest(bool threaded, |
159 bool delegating_renderer, | 160 bool delegating_renderer, |
160 bool impl_side_painting); | 161 bool impl_side_painting); |
161 virtual void RunTestWithImplSidePainting(); | 162 virtual void RunTestWithImplSidePainting(); |
162 | 163 |
163 bool HasImplThread() { return proxy() ? proxy()->HasImplThread() : false; } | 164 bool HasImplThread() { return proxy() ? proxy()->HasImplThread() : false; } |
164 base::SingleThreadTaskRunner* ImplThreadTaskRunner() { | 165 base::SingleThreadTaskRunner* ImplThreadTaskRunner() { |
165 DCHECK(proxy()); | 166 DCHECK(proxy()); |
166 return proxy()->ImplThreadTaskRunner() ? proxy()->ImplThreadTaskRunner() | 167 return proxy()->ImplThreadTaskRunner() ? proxy()->ImplThreadTaskRunner() |
167 : main_task_runner_.get(); | 168 : main_task_runner_.get(); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 280 |
280 #define SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ | 281 #define SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ |
281 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ | 282 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ |
282 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) | 283 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) |
283 | 284 |
284 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 285 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
285 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ | 286 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ |
286 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) | 287 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) |
287 | 288 |
288 #endif // CC_TEST_LAYER_TREE_TEST_H_ | 289 #endif // CC_TEST_LAYER_TREE_TEST_H_ |
OLD | NEW |