| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // tree host is initialized. | 125 // tree host is initialized. |
| 126 // | 126 // |
| 127 // Key stages of the drawing loop, e.g. drawing or commiting, redirect to | 127 // Key stages of the drawing loop, e.g. drawing or commiting, redirect to |
| 128 // LayerTreeTest methods of similar names. To track the commit process, override | 128 // LayerTreeTest methods of similar names. To track the commit process, override |
| 129 // these functions. | 129 // these functions. |
| 130 // | 130 // |
| 131 // The test continues until someone calls EndTest. EndTest can be called on any | 131 // The test continues until someone calls EndTest. EndTest can be called on any |
| 132 // thread, but be aware that ending the test is an asynchronous process. | 132 // thread, but be aware that ending the test is an asynchronous process. |
| 133 class LayerTreeTest : public testing::Test, public TestHooks { | 133 class LayerTreeTest : public testing::Test, public TestHooks { |
| 134 public: | 134 public: |
| 135 virtual ~LayerTreeTest(); | 135 ~LayerTreeTest() override; |
| 136 | 136 |
| 137 virtual void EndTest(); | 137 virtual void EndTest(); |
| 138 void EndTestAfterDelayMs(int delay_milliseconds); | 138 void EndTestAfterDelayMs(int delay_milliseconds); |
| 139 | 139 |
| 140 void PostAddAnimationToMainThread(Layer* layer_to_receive_animation); | 140 void PostAddAnimationToMainThread(Layer* layer_to_receive_animation); |
| 141 void PostAddInstantAnimationToMainThread(Layer* layer_to_receive_animation); | 141 void PostAddInstantAnimationToMainThread(Layer* layer_to_receive_animation); |
| 142 void PostAddLongAnimationToMainThread(Layer* layer_to_receive_animation); | 142 void PostAddLongAnimationToMainThread(Layer* layer_to_receive_animation); |
| 143 void PostSetNeedsCommitToMainThread(); | 143 void PostSetNeedsCommitToMainThread(); |
| 144 void PostSetNeedsUpdateLayersToMainThread(); | 144 void PostSetNeedsUpdateLayersToMainThread(); |
| 145 void PostSetNeedsRedrawToMainThread(); | 145 void PostSetNeedsRedrawToMainThread(); |
| 146 void PostSetNeedsRedrawRectToMainThread(const gfx::Rect& damage_rect); | 146 void PostSetNeedsRedrawRectToMainThread(const gfx::Rect& damage_rect); |
| 147 void PostSetVisibleToMainThread(bool visible); | 147 void PostSetVisibleToMainThread(bool visible); |
| 148 void PostSetNextCommitForcesRedrawToMainThread(); | 148 void PostSetNextCommitForcesRedrawToMainThread(); |
| 149 void PostCompositeImmediatelyToMainThread(); | 149 void PostCompositeImmediatelyToMainThread(); |
| 150 | 150 |
| 151 void DoBeginTest(); | 151 void DoBeginTest(); |
| 152 void Timeout(); | 152 void Timeout(); |
| 153 | 153 |
| 154 bool verify_property_trees() const { return verify_property_trees_; } |
| 155 void set_verify_property_trees(bool verify_property_trees) { |
| 156 verify_property_trees_ = verify_property_trees; |
| 157 } |
| 158 |
| 154 protected: | 159 protected: |
| 155 LayerTreeTest(); | 160 LayerTreeTest(); |
| 156 | 161 |
| 157 virtual void InitializeSettings(LayerTreeSettings* settings) {} | 162 virtual void InitializeSettings(LayerTreeSettings* settings) {} |
| 158 | 163 |
| 159 void RealEndTest(); | 164 void RealEndTest(); |
| 160 | 165 |
| 161 virtual void DispatchAddAnimation(Layer* layer_to_receive_animation, | 166 virtual void DispatchAddAnimation(Layer* layer_to_receive_animation, |
| 162 double animation_duration); | 167 double animation_duration); |
| 163 void DispatchSetNeedsCommit(); | 168 void DispatchSetNeedsCommit(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 208 |
| 204 // By default, output surface recreation is synchronous. | 209 // By default, output surface recreation is synchronous. |
| 205 void RequestNewOutputSurface() override; | 210 void RequestNewOutputSurface() override; |
| 206 // Override this for pixel tests, where you need a real output surface. | 211 // Override this for pixel tests, where you need a real output surface. |
| 207 virtual scoped_ptr<OutputSurface> CreateOutputSurface(); | 212 virtual scoped_ptr<OutputSurface> CreateOutputSurface(); |
| 208 // Override this for unit tests, which should not produce pixel output. | 213 // Override this for unit tests, which should not produce pixel output. |
| 209 virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(); | 214 virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(); |
| 210 | 215 |
| 211 TestWebGraphicsContext3D* TestContext(); | 216 TestWebGraphicsContext3D* TestContext(); |
| 212 | 217 |
| 213 | |
| 214 private: | 218 private: |
| 215 LayerTreeSettings settings_; | 219 LayerTreeSettings settings_; |
| 216 scoped_ptr<LayerTreeHostClientForTesting> client_; | 220 scoped_ptr<LayerTreeHostClientForTesting> client_; |
| 217 scoped_ptr<LayerTreeHost> layer_tree_host_; | 221 scoped_ptr<LayerTreeHost> layer_tree_host_; |
| 218 FakeOutputSurface* output_surface_; | 222 FakeOutputSurface* output_surface_; |
| 219 FakeExternalBeginFrameSource* external_begin_frame_source_; | 223 FakeExternalBeginFrameSource* external_begin_frame_source_; |
| 220 | 224 |
| 221 bool beginning_; | 225 bool beginning_; |
| 222 bool end_when_begin_returns_; | 226 bool end_when_begin_returns_; |
| 223 bool timed_out_; | 227 bool timed_out_; |
| 224 bool scheduled_; | 228 bool scheduled_; |
| 225 bool started_; | 229 bool started_; |
| 226 bool ended_; | 230 bool ended_; |
| 227 bool delegating_renderer_; | 231 bool delegating_renderer_; |
| 232 bool verify_property_trees_; |
| 228 | 233 |
| 229 int timeout_seconds_; | 234 int timeout_seconds_; |
| 230 | 235 |
| 231 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 236 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 232 scoped_ptr<base::Thread> impl_thread_; | 237 scoped_ptr<base::Thread> impl_thread_; |
| 233 base::CancelableClosure timeout_; | 238 base::CancelableClosure timeout_; |
| 234 scoped_refptr<TestContextProvider> compositor_contexts_; | 239 scoped_refptr<TestContextProvider> compositor_contexts_; |
| 235 base::WeakPtr<LayerTreeTest> main_thread_weak_ptr_; | 240 base::WeakPtr<LayerTreeTest> main_thread_weak_ptr_; |
| 236 base::WeakPtrFactory<LayerTreeTest> weak_factory_; | 241 base::WeakPtrFactory<LayerTreeTest> weak_factory_; |
| 237 }; | 242 }; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ | 373 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ |
| 369 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) | 374 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) |
| 370 | 375 |
| 371 // Some tests want to control when notify ready for activation occurs, | 376 // Some tests want to control when notify ready for activation occurs, |
| 372 // but this is not supported in the single-threaded case. | 377 // but this is not supported in the single-threaded case. |
| 373 #define SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ | 378 #define SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ |
| 374 SINGLE_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ | 379 SINGLE_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ |
| 375 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 380 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
| 376 | 381 |
| 377 #endif // CC_TEST_LAYER_TREE_TEST_H_ | 382 #endif // CC_TEST_LAYER_TREE_TEST_H_ |
| OLD | NEW |