| 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 19 matching lines...) Expand all Loading... |
| 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*) { } | 35 virtual void treeActivatedOnThread(LayerTreeHostImpl*) { } |
| 36 virtual void initializedRendererOnThread(LayerTreeHostImpl*, bool success) {
} | 36 virtual void initializedRendererOnThread(LayerTreeHostImpl*, bool success) {
} |
| 37 virtual bool prepareToDrawOnThread( | 37 virtual bool prepareToDrawOnThread( |
| 38 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData*, bool result); | 38 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData*, bool result); |
| 39 virtual void drawLayersOnThread(LayerTreeHostImpl*) { } | 39 virtual void drawLayersOnThread(LayerTreeHostImpl*) { } |
| 40 virtual void swapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result)
{ } |
| 40 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime
) { } | 41 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime
) { } |
| 41 virtual void updateAnimationState(LayerTreeHostImpl*, bool hasUnfinishedAnim
ation) { } | 42 virtual void updateAnimationState(LayerTreeHostImpl*, bool hasUnfinishedAnim
ation) { } |
| 42 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic
Time) { } | 43 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic
Time) { } |
| 43 virtual void applyScrollAndScale(gfx::Vector2d, float) { } | 44 virtual void applyScrollAndScale(gfx::Vector2d, float) { } |
| 44 virtual void animate(base::TimeTicks monotonicTime) { } | 45 virtual void animate(base::TimeTicks monotonicTime) { } |
| 45 virtual void layout() { } | 46 virtual void layout() { } |
| 46 virtual void didRecreateOutputSurface(bool succeeded) { } | 47 virtual void didRecreateOutputSurface(bool succeeded) { } |
| 47 virtual void willRetryRecreateOutputSurface() { } | 48 virtual void willRetryRecreateOutputSurface() { } |
| 48 virtual void didAddAnimation() { } | 49 virtual void didAddAnimation() { } |
| 49 virtual void didCommit() { } | 50 virtual void didCommit() { } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 161 |
| 161 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. | 162 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. |
| 162 class MockLayerTreeHostImpl : public LayerTreeHostImpl { | 163 class MockLayerTreeHostImpl : public LayerTreeHostImpl { |
| 163 public: | 164 public: |
| 164 static scoped_ptr<MockLayerTreeHostImpl> create(TestHooks*, const LayerTreeS
ettings&, LayerTreeHostImplClient*, Proxy*); | 165 static scoped_ptr<MockLayerTreeHostImpl> create(TestHooks*, const LayerTreeS
ettings&, LayerTreeHostImplClient*, Proxy*); |
| 165 | 166 |
| 166 virtual void BeginCommit() OVERRIDE; | 167 virtual void BeginCommit() OVERRIDE; |
| 167 virtual void CommitComplete() OVERRIDE; | 168 virtual void CommitComplete() OVERRIDE; |
| 168 virtual bool PrepareToDraw(FrameData* frame) OVERRIDE; | 169 virtual bool PrepareToDraw(FrameData* frame) OVERRIDE; |
| 169 virtual void DrawLayers(FrameData* frame) OVERRIDE; | 170 virtual void DrawLayers(FrameData* frame) OVERRIDE; |
| 171 virtual bool SwapBuffers() OVERRIDE; |
| 170 virtual bool ActivatePendingTreeIfNeeded() OVERRIDE; | 172 virtual bool ActivatePendingTreeIfNeeded() OVERRIDE; |
| 171 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> outputSurface) OVE
RRIDE; | 173 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> outputSurface) OVE
RRIDE; |
| 172 virtual void SetVisible(bool visible) OVERRIDE; | 174 virtual void SetVisible(bool visible) OVERRIDE; |
| 173 | 175 |
| 174 // Make these public. | 176 // Make these public. |
| 175 typedef std::vector<LayerImpl*> LayerList; | 177 typedef std::vector<LayerImpl*> LayerList; |
| 176 | 178 |
| 177 protected: | 179 protected: |
| 178 virtual void AnimateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime) OVERRIDE; | 180 virtual void AnimateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime) OVERRIDE; |
| 179 virtual void UpdateAnimationState() OVERRIDE; | 181 virtual void UpdateAnimationState() OVERRIDE; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 197 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ | 199 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ |
| 198 { \ | 200 { \ |
| 199 runTest(true); \ | 201 runTest(true); \ |
| 200 } | 202 } |
| 201 | 203 |
| 202 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 204 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
| 203 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 205 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
| 204 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 206 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
| 205 | 207 |
| 206 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ | 208 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ |
| OLD | NEW |