| 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/hash_tables.h" | 8 #include "base/hash_tables.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| 11 #include "cc/layer_tree_host.h" | 11 #include "cc/layer_tree_host.h" |
| 12 #include "cc/layer_tree_host_impl.h" | 12 #include "cc/layer_tree_host_impl.h" |
| 13 #include "cc/scoped_thread_proxy.h" | 13 #include "cc/scoped_thread_proxy.h" |
| 14 #include "cc/test/compositor_fake_web_graphics_context_3d.h" | 14 #include "cc/test/compositor_fake_web_graphics_context_3d.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include <public/WebAnimationDelegate.h> | 16 #include <public/WebAnimationDelegate.h> |
| 17 | 17 |
| 18 namespace cc { | 18 namespace cc { |
| 19 class LayerImpl; | 19 class LayerImpl; |
| 20 class LayerTreeHost; | 20 class LayerTreeHost; |
| 21 class LayerTreeHostClient; | 21 class LayerTreeHostClient; |
| 22 class LayerTreeHostImpl; | 22 class LayerTreeHostImpl; |
| 23 class Thread; | 23 class Thread; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace WebKitTests { | 26 namespace cc { |
| 27 | 27 |
| 28 // Used by test stubs to notify the test when something interesting happens. | 28 // Used by test stubs to notify the test when something interesting happens. |
| 29 class TestHooks : public WebKit::WebAnimationDelegate { | 29 class TestHooks : public WebKit::WebAnimationDelegate { |
| 30 public: | 30 public: |
| 31 virtual void beginCommitOnThread(cc::LayerTreeHostImpl*) { } | 31 virtual void beginCommitOnThread(cc::LayerTreeHostImpl*) { } |
| 32 virtual void commitCompleteOnThread(cc::LayerTreeHostImpl*) { } | 32 virtual void commitCompleteOnThread(cc::LayerTreeHostImpl*) { } |
| 33 virtual bool prepareToDrawOnThread(cc::LayerTreeHostImpl*); | 33 virtual bool prepareToDrawOnThread(cc::LayerTreeHostImpl*); |
| 34 virtual void drawLayersOnThread(cc::LayerTreeHostImpl*) { } | 34 virtual void drawLayersOnThread(cc::LayerTreeHostImpl*) { } |
| 35 virtual void animateLayers(cc::LayerTreeHostImpl*, base::TimeTicks monotonic
Time) { } | 35 virtual void animateLayers(cc::LayerTreeHostImpl*, base::TimeTicks monotonic
Time) { } |
| 36 virtual void willAnimateLayers(cc::LayerTreeHostImpl*, base::TimeTicks monot
onicTime) { } | 36 virtual void willAnimateLayers(cc::LayerTreeHostImpl*, base::TimeTicks monot
onicTime) { } |
| 37 virtual void applyScrollAndScale(gfx::Vector2d, float) { } | 37 virtual void applyScrollAndScale(gfx::Vector2d, float) { } |
| 38 virtual void animate(base::TimeTicks monotonicTime) { } | 38 virtual void animate(base::TimeTicks monotonicTime) { } |
| 39 virtual void layout() { } | 39 virtual void layout() { } |
| 40 virtual void didRecreateOutputSurface(bool succeeded) { } | 40 virtual void didRecreateOutputSurface(bool succeeded) { } |
| 41 virtual void didAddAnimation() { } | 41 virtual void didAddAnimation() { } |
| 42 virtual void didCommit() { } | 42 virtual void didCommit() { } |
| 43 virtual void didCommitAndDrawFrame() { } | 43 virtual void didCommitAndDrawFrame() { } |
| 44 virtual void scheduleComposite() { } | 44 virtual void scheduleComposite() { } |
| 45 virtual void didDeferCommit() { } | 45 virtual void didDeferCommit() { } |
| 46 | 46 |
| 47 // Implementation of WebAnimationDelegate | 47 // Implementation of WebAnimationDelegate |
| 48 virtual void notifyAnimationStarted(double time) OVERRIDE { } | 48 virtual void notifyAnimationStarted(double time) OVERRIDE { } |
| 49 virtual void notifyAnimationFinished(double time) OVERRIDE { } | 49 virtual void notifyAnimationFinished(double time) OVERRIDE { } |
| 50 | 50 |
| 51 virtual scoped_ptr<WebKit::WebCompositorOutputSurface> createOutputSurface()
; | 51 virtual scoped_ptr<OutputSurface> createOutputSurface(); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class TimeoutTask; | 54 class TimeoutTask; |
| 55 class BeginTask; | 55 class BeginTask; |
| 56 | 56 |
| 57 class MockLayerImplTreeHostClient : public cc::LayerTreeHostClient { | 57 class MockLayerImplTreeHostClient : public cc::LayerTreeHostClient { |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 // The ThreadedTests runs with the main loop running. It instantiates a single M
ockLayerTreeHost and associated | 60 // The ThreadedTests runs with the main loop running. It instantiates a single M
ockLayerTreeHost and associated |
| 61 // MockLayerTreeHostImpl/ThreadedMockLayerTreeHostClient. | 61 // MockLayerTreeHostImpl/ThreadedMockLayerTreeHostClient. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 TEST_F(TEST_FIXTURE_NAME, runSingleThread) \ | 198 TEST_F(TEST_FIXTURE_NAME, runSingleThread) \ |
| 199 { \ | 199 { \ |
| 200 runTest(false); \ | 200 runTest(false); \ |
| 201 } \ | 201 } \ |
| 202 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ | 202 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ |
| 203 { \ | 203 { \ |
| 204 runTest(true); \ | 204 runTest(true); \ |
| 205 } | 205 } |
| 206 | 206 |
| 207 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ | 207 #endif // CC_TEST_LAYER_TREE_TEST_COMMON_H_ |
| OLD | NEW |