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 |
106 virtual void EndTest(); | 110 virtual void EndTest(); |
107 void EndTestAfterDelay(int delay_milliseconds); | 111 void EndTestAfterDelay(int delay_milliseconds); |
108 | 112 |
109 void PostAddAnimationToMainThread(Layer* layer_to_receive_animation); | 113 void PostAddAnimationToMainThread(Layer* layer_to_receive_animation); |
110 void PostAddInstantAnimationToMainThread(Layer* layer_to_receive_animation); | 114 void PostAddInstantAnimationToMainThread(Layer* layer_to_receive_animation); |
111 void PostAddLongAnimationToMainThread(Layer* layer_to_receive_animation); | 115 void PostAddLongAnimationToMainThread(Layer* layer_to_receive_animation); |
112 void PostSetNeedsCommitToMainThread(); | 116 void PostSetNeedsCommitToMainThread(); |
113 void PostSetNeedsUpdateLayersToMainThread(); | 117 void PostSetNeedsUpdateLayersToMainThread(); |
114 void PostReadbackToMainThread(); | 118 void PostReadbackToMainThread(); |
115 void PostAcquireLayerTextures(); | 119 void PostAcquireLayerTextures(); |
(...skipping 20 matching lines...) Expand all Loading... |
136 void DispatchSetNeedsUpdateLayers(); | 140 void DispatchSetNeedsUpdateLayers(); |
137 void DispatchReadback(); | 141 void DispatchReadback(); |
138 void DispatchAcquireLayerTextures(); | 142 void DispatchAcquireLayerTextures(); |
139 void DispatchSetNeedsRedraw(); | 143 void DispatchSetNeedsRedraw(); |
140 void DispatchSetNeedsRedrawRect(gfx::Rect damage_rect); | 144 void DispatchSetNeedsRedrawRect(gfx::Rect damage_rect); |
141 void DispatchSetVisible(bool visible); | 145 void DispatchSetVisible(bool visible); |
142 void DispatchSetNextCommitForcesRedraw(); | 146 void DispatchSetNextCommitForcesRedraw(); |
143 void DispatchComposite(); | 147 void DispatchComposite(); |
144 void DispatchDidAddAnimation(); | 148 void DispatchDidAddAnimation(); |
145 | 149 |
146 virtual void AfterTest() = 0; | |
147 virtual void WillBeginTest(); | |
148 virtual void BeginTest() = 0; | |
149 virtual void SetupTree(); | |
150 | |
151 virtual void RunTest(bool threaded, | 150 virtual void RunTest(bool threaded, |
152 bool delegating_renderer, | 151 bool delegating_renderer, |
153 bool impl_side_painting); | 152 bool impl_side_painting); |
154 virtual void RunTestWithImplSidePainting(); | 153 virtual void RunTestWithImplSidePainting(); |
155 | 154 |
156 bool HasImplThread() { return proxy() ? proxy()->HasImplThread() : false; } | 155 bool HasImplThread() { return proxy() ? proxy()->HasImplThread() : false; } |
157 base::SingleThreadTaskRunner* ImplThreadTaskRunner() { | 156 base::SingleThreadTaskRunner* ImplThreadTaskRunner() { |
158 DCHECK(proxy()); | 157 DCHECK(proxy()); |
159 return proxy()->ImplThreadTaskRunner() ? proxy()->ImplThreadTaskRunner() | 158 return proxy()->ImplThreadTaskRunner() ? proxy()->ImplThreadTaskRunner() |
160 : main_task_runner_.get(); | 159 : main_task_runner_.get(); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 271 |
273 #define SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ | 272 #define SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME) \ |
274 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ | 273 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ |
275 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) | 274 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_NOIMPL_TEST_F(TEST_FIXTURE_NAME) |
276 | 275 |
277 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 276 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
278 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ | 277 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ |
279 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) | 278 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) |
280 | 279 |
281 #endif // CC_TEST_LAYER_TREE_TEST_H_ | 280 #endif // CC_TEST_LAYER_TREE_TEST_H_ |
OLD | NEW |