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_COMMON_H_ | 5 #ifndef CC_TEST_LAYER_TREE_TEST_COMMON_H_ |
6 #define CC_TEST_LAYER_TREE_TEST_COMMON_H_ | 6 #define CC_TEST_LAYER_TREE_TEST_COMMON_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/layer_tree_host.h" | 10 #include "cc/layer_tree_host.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class Thread; | 21 class Thread; |
22 | 22 |
23 | 23 |
24 // Used by test stubs to notify the test when something interesting happens. | 24 // Used by test stubs to notify the test when something interesting happens. |
25 class TestHooks : public WebKit::WebAnimationDelegate { | 25 class TestHooks : public WebKit::WebAnimationDelegate { |
26 public: | 26 public: |
27 virtual void beginCommitOnThread(LayerTreeHostImpl*) { } | 27 virtual void beginCommitOnThread(LayerTreeHostImpl*) { } |
28 virtual void commitCompleteOnThread(LayerTreeHostImpl*) { } | 28 virtual void commitCompleteOnThread(LayerTreeHostImpl*) { } |
29 virtual bool prepareToDrawOnThread(LayerTreeHostImpl*); | 29 virtual bool prepareToDrawOnThread(LayerTreeHostImpl*); |
30 virtual void drawLayersOnThread(LayerTreeHostImpl*) { } | 30 virtual void drawLayersOnThread(LayerTreeHostImpl*) { } |
31 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime
) { } | 31 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime
, bool hasUnfinishedAnimation) { } |
32 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic
Time) { } | 32 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic
Time) { } |
33 virtual void applyScrollAndScale(gfx::Vector2d, float) { } | 33 virtual void applyScrollAndScale(gfx::Vector2d, float) { } |
34 virtual void animate(base::TimeTicks monotonicTime) { } | 34 virtual void animate(base::TimeTicks monotonicTime) { } |
35 virtual void layout() { } | 35 virtual void layout() { } |
36 virtual void didRecreateOutputSurface(bool succeeded) { } | 36 virtual void didRecreateOutputSurface(bool succeeded) { } |
37 virtual void didAddAnimation() { } | 37 virtual void didAddAnimation() { } |
38 virtual void didCommit() { } | 38 virtual void didCommit() { } |
39 virtual void didCommitAndDrawFrame() { } | 39 virtual void didCommitAndDrawFrame() { } |
40 virtual void scheduleComposite() { } | 40 virtual void scheduleComposite() { } |
41 virtual void didDeferCommit() { } | 41 virtual void didDeferCommit() { } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 void endTest(); | 74 void endTest(); |
75 void endTestAfterDelay(int delayMilliseconds); | 75 void endTestAfterDelay(int delayMilliseconds); |
76 | 76 |
77 void postSetNeedsAnimateToMainThread(); | 77 void postSetNeedsAnimateToMainThread(); |
78 void postAddAnimationToMainThread(Layer*); | 78 void postAddAnimationToMainThread(Layer*); |
79 void postAddInstantAnimationToMainThread(); | 79 void postAddInstantAnimationToMainThread(); |
80 void postSetNeedsCommitToMainThread(); | 80 void postSetNeedsCommitToMainThread(); |
81 void postAcquireLayerTextures(); | 81 void postAcquireLayerTextures(); |
82 void postSetNeedsRedrawToMainThread(); | 82 void postSetNeedsRedrawToMainThread(); |
83 void postSetVisibleToMainThread(bool visible); | 83 void postSetVisibleToMainThread(bool visible); |
84 void postDidAddAnimationToMainThread(); | |
85 | 84 |
86 void doBeginTest(); | 85 void doBeginTest(); |
87 void timeout(); | 86 void timeout(); |
88 | 87 |
89 LayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); } | 88 LayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); } |
90 | 89 |
91 protected: | 90 protected: |
92 ThreadedTest(); | 91 ThreadedTest(); |
93 | 92 |
94 virtual void initializeSettings(LayerTreeSettings&) { } | 93 virtual void initializeSettings(LayerTreeSettings&) { } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ | 173 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ |
175 { \ | 174 { \ |
176 runTest(true); \ | 175 runTest(true); \ |
177 } | 176 } |
178 | 177 |
179 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 178 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
180 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 179 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
181 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 180 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
182 | 181 |
183 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ | 182 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ |
OLD | NEW |