| 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" |
| 11 #include "cc/layer_tree_host_impl.h" | 11 #include "cc/layer_tree_host_impl.h" |
| 12 #include "cc/thread.h" | 12 #include "cc/thread.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationDelegat
e.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationDelegat
e.h" |
| 15 | 15 |
| 16 namespace Webkit { |
| 17 class WebGraphicsContext3D; |
| 18 } |
| 19 |
| 16 namespace cc { | 20 namespace cc { |
| 21 class FakeLayerImplTreeHostClient; |
| 17 class LayerImpl; | 22 class LayerImpl; |
| 18 class LayerTreeHost; | 23 class LayerTreeHost; |
| 19 class LayerTreeHostClient; | 24 class LayerTreeHostClient; |
| 20 class LayerTreeHostImpl; | 25 class LayerTreeHostImpl; |
| 21 | 26 |
| 22 // 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. |
| 23 class TestHooks : public WebKit::WebAnimationDelegate { | 28 class TestHooks : public WebKit::WebAnimationDelegate { |
| 24 public: | 29 public: |
| 30 TestHooks(); |
| 31 virtual ~TestHooks(); |
| 32 |
| 25 virtual void beginCommitOnThread(LayerTreeHostImpl*) { } | 33 virtual void beginCommitOnThread(LayerTreeHostImpl*) { } |
| 26 virtual void commitCompleteOnThread(LayerTreeHostImpl*) { } | 34 virtual void commitCompleteOnThread(LayerTreeHostImpl*) { } |
| 27 virtual bool prepareToDrawOnThread( | 35 virtual bool prepareToDrawOnThread( |
| 28 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result); | 36 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result); |
| 29 virtual void drawLayersOnThread(LayerTreeHostImpl*) { } | 37 virtual void drawLayersOnThread(LayerTreeHostImpl*) { } |
| 30 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime
) { } | 38 virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime
) { } |
| 31 virtual void updateAnimationState(LayerTreeHostImpl*, bool hasUnfinishedAnim
ation) { } | 39 virtual void updateAnimationState(LayerTreeHostImpl*, bool hasUnfinishedAnim
ation) { } |
| 32 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic
Time) { } | 40 virtual void willAnimateLayers(LayerTreeHostImpl*, base::TimeTicks monotonic
Time) { } |
| 33 virtual void applyScrollAndScale(gfx::Vector2d, float) { } | 41 virtual void applyScrollAndScale(gfx::Vector2d, float) { } |
| 34 virtual void animate(base::TimeTicks monotonicTime) { } | 42 virtual void animate(base::TimeTicks monotonicTime) { } |
| 35 virtual void layout() { } | 43 virtual void layout() { } |
| 36 virtual void didRecreateOutputSurface(bool succeeded) { } | 44 virtual void didRecreateOutputSurface(bool succeeded) { } |
| 45 virtual void willRetryRecreateOutputSurface() { } |
| 37 virtual void didAddAnimation() { } | 46 virtual void didAddAnimation() { } |
| 38 virtual void didCommit() { } | 47 virtual void didCommit() { } |
| 39 virtual void didCommitAndDrawFrame() { } | 48 virtual void didCommitAndDrawFrame() { } |
| 40 virtual void scheduleComposite() { } | 49 virtual void scheduleComposite() { } |
| 41 virtual void didDeferCommit() { } | 50 virtual void didDeferCommit() { } |
| 42 virtual bool canActivatePendingTree(); | 51 virtual bool canActivatePendingTree(); |
| 43 | 52 |
| 44 // Implementation of WebAnimationDelegate | 53 // Implementation of WebAnimationDelegate |
| 45 virtual void notifyAnimationStarted(double time) OVERRIDE { } | 54 virtual void notifyAnimationStarted(double time) OVERRIDE { } |
| 46 virtual void notifyAnimationFinished(double time) OVERRIDE { } | 55 virtual void notifyAnimationFinished(double time) OVERRIDE { } |
| 47 | 56 |
| 48 virtual scoped_ptr<OutputSurface> createOutputSurface(); | 57 virtual scoped_ptr<OutputSurface> createOutputSurface(); |
| 58 |
| 59 virtual scoped_refptr<ui::ContextProvider> OffscreenContextProviderForMainTh
read(); |
| 60 virtual scoped_refptr<ui::ContextProvider> OffscreenContextProviderForCompos
itorThread(); |
| 61 |
| 62 private: |
| 63 scoped_ptr<FakeLayerImplTreeHostClient> m_fakeClient; |
| 49 }; | 64 }; |
| 50 | 65 |
| 51 class TimeoutTask; | 66 class TimeoutTask; |
| 52 class BeginTask; | 67 class BeginTask; |
| 53 | 68 |
| 54 class MockLayerImplTreeHostClient : public LayerTreeHostClient { | 69 class MockLayerImplTreeHostClient : public LayerTreeHostClient { |
| 55 }; | 70 }; |
| 56 | 71 |
| 57 // The ThreadedTests runs with the main loop running. It instantiates a single M
ockLayerTreeHost and associated | 72 // The ThreadedTests runs with the main loop running. It instantiates a single M
ockLayerTreeHost and associated |
| 58 // MockLayerTreeHostImpl/ThreadedMockLayerTreeHostClient. | 73 // MockLayerTreeHostImpl/ThreadedMockLayerTreeHostClient. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ | 188 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ |
| 174 { \ | 189 { \ |
| 175 runTest(true); \ | 190 runTest(true); \ |
| 176 } | 191 } |
| 177 | 192 |
| 178 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 193 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
| 179 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 194 SINGLE_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
| 180 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 195 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
| 181 | 196 |
| 182 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ | 197 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ |
| OLD | NEW |