| 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 #include "cc/test/layer_tree_test.h" | 5 #include "cc/test/layer_tree_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "cc/animation/animation.h" | 8 #include "cc/animation/animation.h" |
| 9 #include "cc/animation/animation_registrar.h" | 9 #include "cc/animation/animation_registrar.h" |
| 10 #include "cc/animation/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 ThreadProxyForTest( | 100 ThreadProxyForTest( |
| 101 TestHooks* test_hooks, | 101 TestHooks* test_hooks, |
| 102 LayerTreeHost* host, | 102 LayerTreeHost* host, |
| 103 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 103 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 104 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) | 104 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) |
| 105 : ThreadProxy(host, main_task_runner, impl_task_runner), | 105 : ThreadProxy(host, main_task_runner, impl_task_runner), |
| 106 test_hooks_(test_hooks) {} | 106 test_hooks_(test_hooks) {} |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. | 109 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. |
| 110 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { | 110 class LayerTreeHostImplForTesting : public PseudoSyncingLayerTreeHostImpl { |
| 111 public: | 111 public: |
| 112 static scoped_ptr<LayerTreeHostImplForTesting> Create( | 112 static scoped_ptr<LayerTreeHostImplForTesting> Create( |
| 113 TestHooks* test_hooks, | 113 TestHooks* test_hooks, |
| 114 const LayerTreeSettings& settings, | 114 const LayerTreeSettings& settings, |
| 115 LayerTreeHostImplClient* host_impl_client, | 115 LayerTreeHostImplClient* host_impl_client, |
| 116 Proxy* proxy, | 116 Proxy* proxy, |
| 117 SharedBitmapManager* manager, | 117 SharedBitmapManager* manager, |
| 118 RenderingStatsInstrumentation* stats_instrumentation) { | 118 RenderingStatsInstrumentation* stats_instrumentation) { |
| 119 return make_scoped_ptr( | 119 return make_scoped_ptr( |
| 120 new LayerTreeHostImplForTesting(test_hooks, | 120 new LayerTreeHostImplForTesting(test_hooks, |
| 121 settings, | 121 settings, |
| 122 host_impl_client, | 122 host_impl_client, |
| 123 proxy, | 123 proxy, |
| 124 manager, | 124 manager, |
| 125 stats_instrumentation)); | 125 stats_instrumentation)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 protected: | 128 protected: |
| 129 LayerTreeHostImplForTesting( | 129 LayerTreeHostImplForTesting( |
| 130 TestHooks* test_hooks, | 130 TestHooks* test_hooks, |
| 131 const LayerTreeSettings& settings, | 131 const LayerTreeSettings& settings, |
| 132 LayerTreeHostImplClient* host_impl_client, | 132 LayerTreeHostImplClient* host_impl_client, |
| 133 Proxy* proxy, | 133 Proxy* proxy, |
| 134 SharedBitmapManager* manager, | 134 SharedBitmapManager* manager, |
| 135 RenderingStatsInstrumentation* stats_instrumentation) | 135 RenderingStatsInstrumentation* stats_instrumentation) |
| 136 : LayerTreeHostImpl(settings, | 136 : PseudoSyncingLayerTreeHostImpl(settings, |
| 137 host_impl_client, | 137 host_impl_client, |
| 138 proxy, | 138 proxy, |
| 139 stats_instrumentation, | 139 stats_instrumentation, |
| 140 manager, | 140 manager, |
| 141 0), | 141 0), |
| 142 test_hooks_(test_hooks), | 142 test_hooks_(test_hooks), |
| 143 block_notify_ready_to_activate_for_testing_(false), | 143 block_notify_ready_to_activate_for_testing_(false), |
| 144 notify_ready_to_activate_was_blocked_(false) {} | 144 notify_ready_to_activate_was_blocked_(false) {} |
| 145 | 145 |
| 146 virtual void WillBeginImplFrame(const BeginFrameArgs& args) OVERRIDE { | 146 virtual void WillBeginImplFrame(const BeginFrameArgs& args) OVERRIDE { |
| 147 LayerTreeHostImpl::WillBeginImplFrame(args); | 147 LayerTreeHostImpl::WillBeginImplFrame(args); |
| 148 test_hooks_->WillBeginImplFrameOnThread(this, args); | 148 test_hooks_->WillBeginImplFrameOnThread(this, args); |
| 149 } | 149 } |
| 150 | 150 |
| 151 virtual void BeginMainFrameAborted(bool did_handle) OVERRIDE { | 151 virtual void BeginMainFrameAborted(bool did_handle) OVERRIDE { |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 // Source frames start at 0, so this is invalid. | 741 // Source frames start at 0, so this is invalid. |
| 742 return -1; | 742 return -1; |
| 743 } | 743 } |
| 744 | 744 |
| 745 void LayerTreeTest::DestroyLayerTreeHost() { | 745 void LayerTreeTest::DestroyLayerTreeHost() { |
| 746 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 746 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
| 747 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 747 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
| 748 layer_tree_host_.reset(); | 748 layer_tree_host_.reset(); |
| 749 } | 749 } |
| 750 | 750 |
| 751 bool PseudoSyncingLayerTreeHostImpl::IsTesting() { |
| 752 return true; |
| 753 } |
| 754 |
| 751 } // namespace cc | 755 } // namespace cc |
| OLD | NEW |