| 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" |
| 11 #include "cc/trees/layer_tree_host.h" | 11 #include "cc/trees/layer_tree_host.h" |
| 12 #include "cc/trees/layer_tree_host_impl.h" | 12 #include "cc/trees/layer_tree_host_impl.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace Webkit { | |
| 16 class WebGraphicsContext3D; | |
| 17 } | |
| 18 | |
| 19 namespace cc { | 15 namespace cc { |
| 20 class FakeExternalBeginFrameSource; | 16 class FakeExternalBeginFrameSource; |
| 21 class FakeLayerTreeHostClient; | 17 class FakeLayerTreeHostClient; |
| 22 class FakeOutputSurface; | 18 class FakeOutputSurface; |
| 23 class LayerImpl; | 19 class LayerImpl; |
| 24 class LayerTreeHost; | 20 class LayerTreeHost; |
| 25 class LayerTreeHostClient; | 21 class LayerTreeHostClient; |
| 26 class LayerTreeHostImpl; | 22 class LayerTreeHostImpl; |
| 27 class TestContextProvider; | 23 class TestContextProvider; |
| 28 class TestWebGraphicsContext3D; | 24 class TestWebGraphicsContext3D; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 virtual void WillBeginMainFrame() {} | 77 virtual void WillBeginMainFrame() {} |
| 82 virtual void DidBeginMainFrame() {} | 78 virtual void DidBeginMainFrame() {} |
| 83 virtual void Layout() {} | 79 virtual void Layout() {} |
| 84 virtual void DidInitializeOutputSurface() {} | 80 virtual void DidInitializeOutputSurface() {} |
| 85 virtual void DidFailToInitializeOutputSurface() {} | 81 virtual void DidFailToInitializeOutputSurface() {} |
| 86 virtual void DidAddAnimation() {} | 82 virtual void DidAddAnimation() {} |
| 87 virtual void WillCommit() {} | 83 virtual void WillCommit() {} |
| 88 virtual void DidCommit() {} | 84 virtual void DidCommit() {} |
| 89 virtual void DidCommitAndDrawFrame() {} | 85 virtual void DidCommitAndDrawFrame() {} |
| 90 virtual void DidCompleteSwapBuffers() {} | 86 virtual void DidCompleteSwapBuffers() {} |
| 91 virtual void DidDeferCommit() {} | |
| 92 virtual void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl, | 87 virtual void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl, |
| 93 bool visible) {} | 88 bool visible) {} |
| 94 virtual void ScheduleComposite() {} | 89 virtual void ScheduleComposite() {} |
| 95 virtual void SendBeginFramesToChildren(const BeginFrameArgs& args) {} | 90 virtual void SendBeginFramesToChildren(const BeginFrameArgs& args) {} |
| 96 | 91 |
| 97 // Hooks for SchedulerClient. | 92 // Hooks for SchedulerClient. |
| 93 virtual void WillBeginImplFrame(const BeginFrameArgs& args) {} |
| 98 virtual void ScheduledActionWillSendBeginMainFrame() {} | 94 virtual void ScheduledActionWillSendBeginMainFrame() {} |
| 99 virtual void ScheduledActionSendBeginMainFrame() {} | 95 virtual void ScheduledActionSendBeginMainFrame() {} |
| 100 virtual void ScheduledActionDrawAndSwapIfPossible() {} | 96 virtual void ScheduledActionDrawAndSwapIfPossible() {} |
| 101 virtual void ScheduledActionAnimate() {} | 97 virtual void ScheduledActionAnimate() {} |
| 102 virtual void ScheduledActionCommit() {} | 98 virtual void ScheduledActionCommit() {} |
| 103 virtual void ScheduledActionBeginOutputSurfaceCreation() {} | 99 virtual void ScheduledActionBeginOutputSurfaceCreation() {} |
| 104 virtual void ScheduledActionPrepareTiles() {} | 100 virtual void ScheduledActionPrepareTiles() {} |
| 105 | 101 |
| 106 // Implementation of AnimationDelegate: | 102 // Implementation of AnimationDelegate: |
| 107 void NotifyAnimationStarted(base::TimeTicks monotonic_time, | 103 void NotifyAnimationStarted(base::TimeTicks monotonic_time, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 134 class LayerTreeTest : public testing::Test, public TestHooks { | 130 class LayerTreeTest : public testing::Test, public TestHooks { |
| 135 public: | 131 public: |
| 136 ~LayerTreeTest() override; | 132 ~LayerTreeTest() override; |
| 137 | 133 |
| 138 virtual void EndTest(); | 134 virtual void EndTest(); |
| 139 void EndTestAfterDelayMs(int delay_milliseconds); | 135 void EndTestAfterDelayMs(int delay_milliseconds); |
| 140 | 136 |
| 141 void PostAddAnimationToMainThread(Layer* layer_to_receive_animation); | 137 void PostAddAnimationToMainThread(Layer* layer_to_receive_animation); |
| 142 void PostAddInstantAnimationToMainThread(Layer* layer_to_receive_animation); | 138 void PostAddInstantAnimationToMainThread(Layer* layer_to_receive_animation); |
| 143 void PostAddLongAnimationToMainThread(Layer* layer_to_receive_animation); | 139 void PostAddLongAnimationToMainThread(Layer* layer_to_receive_animation); |
| 140 void PostSetDeferCommitsToMainThread(bool defer_commits); |
| 144 void PostSetNeedsCommitToMainThread(); | 141 void PostSetNeedsCommitToMainThread(); |
| 145 void PostSetNeedsUpdateLayersToMainThread(); | 142 void PostSetNeedsUpdateLayersToMainThread(); |
| 146 void PostSetNeedsRedrawToMainThread(); | 143 void PostSetNeedsRedrawToMainThread(); |
| 147 void PostSetNeedsRedrawRectToMainThread(const gfx::Rect& damage_rect); | 144 void PostSetNeedsRedrawRectToMainThread(const gfx::Rect& damage_rect); |
| 148 void PostSetVisibleToMainThread(bool visible); | 145 void PostSetVisibleToMainThread(bool visible); |
| 149 void PostSetNextCommitForcesRedrawToMainThread(); | 146 void PostSetNextCommitForcesRedrawToMainThread(); |
| 150 void PostCompositeImmediatelyToMainThread(); | 147 void PostCompositeImmediatelyToMainThread(); |
| 151 | 148 |
| 152 void DoBeginTest(); | 149 void DoBeginTest(); |
| 153 void Timeout(); | 150 void Timeout(); |
| 154 | 151 |
| 155 bool verify_property_trees() const { return verify_property_trees_; } | 152 bool verify_property_trees() const { return verify_property_trees_; } |
| 156 void set_verify_property_trees(bool verify_property_trees) { | 153 void set_verify_property_trees(bool verify_property_trees) { |
| 157 verify_property_trees_ = verify_property_trees; | 154 verify_property_trees_ = verify_property_trees; |
| 158 } | 155 } |
| 159 | 156 |
| 160 protected: | 157 protected: |
| 161 LayerTreeTest(); | 158 LayerTreeTest(); |
| 162 | 159 |
| 163 virtual void InitializeSettings(LayerTreeSettings* settings) {} | 160 virtual void InitializeSettings(LayerTreeSettings* settings) {} |
| 164 | 161 |
| 165 void RealEndTest(); | 162 void RealEndTest(); |
| 166 | 163 |
| 167 virtual void DispatchAddAnimation(Layer* layer_to_receive_animation, | 164 virtual void DispatchAddAnimation(Layer* layer_to_receive_animation, |
| 168 double animation_duration); | 165 double animation_duration); |
| 166 void DispatchSetDeferCommits(bool defer_commits); |
| 169 void DispatchSetNeedsCommit(); | 167 void DispatchSetNeedsCommit(); |
| 170 void DispatchSetNeedsUpdateLayers(); | 168 void DispatchSetNeedsUpdateLayers(); |
| 171 void DispatchSetNeedsRedraw(); | 169 void DispatchSetNeedsRedraw(); |
| 172 void DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect); | 170 void DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect); |
| 173 void DispatchSetVisible(bool visible); | 171 void DispatchSetVisible(bool visible); |
| 174 void DispatchSetNextCommitForcesRedraw(); | 172 void DispatchSetNextCommitForcesRedraw(); |
| 175 void DispatchDidAddAnimation(); | 173 void DispatchDidAddAnimation(); |
| 176 void DispatchCompositeImmediately(); | 174 void DispatchCompositeImmediately(); |
| 177 | 175 |
| 178 virtual void AfterTest() = 0; | 176 virtual void AfterTest() = 0; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ | 372 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ |
| 375 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) | 373 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) |
| 376 | 374 |
| 377 // Some tests want to control when notify ready for activation occurs, | 375 // Some tests want to control when notify ready for activation occurs, |
| 378 // but this is not supported in the single-threaded case. | 376 // but this is not supported in the single-threaded case. |
| 379 #define SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ | 377 #define SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ |
| 380 SINGLE_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ | 378 SINGLE_THREAD_NOIMPL_TEST_F(TEST_FIXTURE_NAME); \ |
| 381 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 379 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
| 382 | 380 |
| 383 #endif // CC_TEST_LAYER_TREE_TEST_H_ | 381 #endif // CC_TEST_LAYER_TREE_TEST_H_ |
| OLD | NEW |