| 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 14 matching lines...) Expand all Loading... |
| 25 class LayerTreeHostImpl; | 25 class LayerTreeHostImpl; |
| 26 | 26 |
| 27 // Used by test stubs to notify the test when something interesting happens. | 27 // Used by test stubs to notify the test when something interesting happens. |
| 28 class TestHooks : public WebKit::WebAnimationDelegate { | 28 class TestHooks : public WebKit::WebAnimationDelegate { |
| 29 public: | 29 public: |
| 30 TestHooks(); | 30 TestHooks(); |
| 31 virtual ~TestHooks(); | 31 virtual ~TestHooks(); |
| 32 | 32 |
| 33 virtual void beginCommitOnThread(LayerTreeHostImpl*) { } | 33 virtual void beginCommitOnThread(LayerTreeHostImpl*) { } |
| 34 virtual void commitCompleteOnThread(LayerTreeHostImpl*) { } | 34 virtual void commitCompleteOnThread(LayerTreeHostImpl*) { } |
| 35 virtual void treeActivatedOnThread(LayerTreeHostImpl*) { } |
| 36 virtual void initializedRendererOnThread(LayerTreeHostImpl*, bool success) {
} |
| 35 virtual bool prepareToDrawOnThread( | 37 virtual bool prepareToDrawOnThread( |
| 36 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result); | 38 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result); |
| 37 virtual void drawLayersOnThread(LayerTreeHostImpl*) { } | 39 virtual void drawLayersOnThread(LayerTreeHostImpl*) { } |
| 38 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime
) { } | 40 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime
) { } |
| 39 virtual void updateAnimationState(LayerTreeHostImpl*, bool hasUnfinishedAnim
ation) { } | 41 virtual void updateAnimationState(LayerTreeHostImpl*, bool hasUnfinishedAnim
ation) { } |
| 40 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic
Time) { } | 42 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic
Time) { } |
| 41 virtual void applyScrollAndScale(gfx::Vector2d, float) { } | 43 virtual void applyScrollAndScale(gfx::Vector2d, float) { } |
| 42 virtual void animate(base::TimeTicks monotonicTime) { } | 44 virtual void animate(base::TimeTicks monotonicTime) { } |
| 43 virtual void layout() { } | 45 virtual void layout() { } |
| 44 virtual void didRecreateOutputSurface(bool succeeded) { } | 46 virtual void didRecreateOutputSurface(bool succeeded) { } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 155 |
| 154 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. | 156 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. |
| 155 class MockLayerTreeHostImpl : public LayerTreeHostImpl { | 157 class MockLayerTreeHostImpl : public LayerTreeHostImpl { |
| 156 public: | 158 public: |
| 157 static scoped_ptr<MockLayerTreeHostImpl> create(TestHooks*, const LayerTreeS
ettings&, LayerTreeHostImplClient*, Proxy*); | 159 static scoped_ptr<MockLayerTreeHostImpl> create(TestHooks*, const LayerTreeS
ettings&, LayerTreeHostImplClient*, Proxy*); |
| 158 | 160 |
| 159 virtual void beginCommit() OVERRIDE; | 161 virtual void beginCommit() OVERRIDE; |
| 160 virtual void commitComplete() OVERRIDE; | 162 virtual void commitComplete() OVERRIDE; |
| 161 virtual bool prepareToDraw(FrameData&) OVERRIDE; | 163 virtual bool prepareToDraw(FrameData&) OVERRIDE; |
| 162 virtual void drawLayers(FrameData&) OVERRIDE; | 164 virtual void drawLayers(FrameData&) OVERRIDE; |
| 163 virtual void activatePendingTreeIfNeeded() OVERRIDE; | 165 virtual bool activatePendingTreeIfNeeded() OVERRIDE; |
| 166 virtual bool initializeRenderer(scoped_ptr<OutputSurface> outputSurface) OVE
RRIDE; |
| 164 | 167 |
| 165 // Make these public. | 168 // Make these public. |
| 166 typedef std::vector<LayerImpl*> LayerList; | 169 typedef std::vector<LayerImpl*> LayerList; |
| 167 | 170 |
| 168 protected: | 171 protected: |
| 169 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime) OVERRIDE; | 172 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime) OVERRIDE; |
| 170 virtual void updateAnimationState() OVERRIDE; | 173 virtual void updateAnimationState() OVERRIDE; |
| 171 virtual base::TimeDelta lowFrequencyAnimationInterval() const OVERRIDE; | 174 virtual base::TimeDelta lowFrequencyAnimationInterval() const OVERRIDE; |
| 172 | 175 |
| 173 private: | 176 private: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 188 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ | 191 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ |
| 189 { \ | 192 { \ |
| 190 runTest(true); \ | 193 runTest(true); \ |
| 191 } | 194 } |
| 192 | 195 |
| 193 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 196 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
| 194 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 197 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
| 195 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 198 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
| 196 | 199 |
| 197 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ | 200 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ |
| OLD | NEW |