| 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 "cc/animation/animation.h" | 7 #include "cc/animation/animation.h" |
| 8 #include "cc/animation/animation_registrar.h" | 8 #include "cc/animation/animation_registrar.h" |
| 9 #include "cc/animation/layer_animation_controller.h" | 9 #include "cc/animation/layer_animation_controller.h" |
| 10 #include "cc/animation/timing_function.h" | 10 #include "cc/animation/timing_function.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. | 63 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. |
| 64 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { | 64 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| 65 public: | 65 public: |
| 66 typedef std::vector<LayerImpl*> LayerList; | 66 typedef std::vector<LayerImpl*> LayerList; |
| 67 | 67 |
| 68 static scoped_ptr<LayerTreeHostImplForTesting> Create( | 68 static scoped_ptr<LayerTreeHostImplForTesting> Create( |
| 69 TestHooks* test_hooks, | 69 TestHooks* test_hooks, |
| 70 const LayerTreeSettings& settings, | 70 const LayerTreeSettings& settings, |
| 71 LayerTreeHostImplClient* host_impl_client, | 71 LayerTreeHostImplClient* host_impl_client, |
| 72 Proxy* proxy) { | 72 Proxy* proxy, |
| 73 return make_scoped_ptr(new LayerTreeHostImplForTesting(test_hooks, | 73 RenderingStatsInstrumentation* stats_instrumentation) { |
| 74 settings, | 74 return make_scoped_ptr( |
| 75 host_impl_client, | 75 new LayerTreeHostImplForTesting(test_hooks, |
| 76 proxy)); | 76 settings, |
| 77 host_impl_client, |
| 78 proxy, |
| 79 stats_instrumentation)); |
| 77 } | 80 } |
| 78 | 81 |
| 79 protected: | 82 protected: |
| 80 LayerTreeHostImplForTesting(TestHooks* test_hooks, | 83 LayerTreeHostImplForTesting( |
| 81 const LayerTreeSettings& settings, | 84 TestHooks* test_hooks, |
| 82 LayerTreeHostImplClient* host_impl_client, | 85 const LayerTreeSettings& settings, |
| 83 Proxy* proxy) | 86 LayerTreeHostImplClient* host_impl_client, |
| 84 : LayerTreeHostImpl(settings, host_impl_client, proxy), | 87 Proxy* proxy, |
| 88 RenderingStatsInstrumentation* stats_instrumentation) |
| 89 : LayerTreeHostImpl(settings, |
| 90 host_impl_client, |
| 91 proxy, |
| 92 stats_instrumentation), |
| 85 test_hooks_(test_hooks) {} | 93 test_hooks_(test_hooks) {} |
| 86 | 94 |
| 87 virtual void BeginCommit() OVERRIDE { | 95 virtual void BeginCommit() OVERRIDE { |
| 88 LayerTreeHostImpl::BeginCommit(); | 96 LayerTreeHostImpl::BeginCommit(); |
| 89 test_hooks_->BeginCommitOnThread(this); | 97 test_hooks_->BeginCommitOnThread(this); |
| 90 } | 98 } |
| 91 | 99 |
| 92 virtual void CommitComplete() OVERRIDE { | 100 virtual void CommitComplete() OVERRIDE { |
| 93 LayerTreeHostImpl::CommitComplete(); | 101 LayerTreeHostImpl::CommitComplete(); |
| 94 test_hooks_->CommitCompleteOnThread(this); | 102 test_hooks_->CommitCompleteOnThread(this); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 EXPECT_TRUE(success); | 192 EXPECT_TRUE(success); |
| 185 return layer_tree_host.Pass(); | 193 return layer_tree_host.Pass(); |
| 186 } | 194 } |
| 187 | 195 |
| 188 virtual scoped_ptr<cc::LayerTreeHostImpl> CreateLayerTreeHostImpl( | 196 virtual scoped_ptr<cc::LayerTreeHostImpl> CreateLayerTreeHostImpl( |
| 189 cc::LayerTreeHostImplClient* host_impl_client) OVERRIDE { | 197 cc::LayerTreeHostImplClient* host_impl_client) OVERRIDE { |
| 190 return LayerTreeHostImplForTesting::Create( | 198 return LayerTreeHostImplForTesting::Create( |
| 191 test_hooks_, | 199 test_hooks_, |
| 192 settings(), | 200 settings(), |
| 193 host_impl_client, | 201 host_impl_client, |
| 194 proxy()).PassAs<cc::LayerTreeHostImpl>(); | 202 proxy(), |
| 203 rendering_stats_instrumentation()).PassAs<cc::LayerTreeHostImpl>(); |
| 195 } | 204 } |
| 196 | 205 |
| 197 virtual void SetNeedsCommit() OVERRIDE { | 206 virtual void SetNeedsCommit() OVERRIDE { |
| 198 if (!test_started_) | 207 if (!test_started_) |
| 199 return; | 208 return; |
| 200 LayerTreeHost::SetNeedsCommit(); | 209 LayerTreeHost::SetNeedsCommit(); |
| 201 } | 210 } |
| 202 | 211 |
| 203 void set_test_started(bool started) { test_started_ = started; } | 212 void set_test_started(bool started) { test_started_ = started; } |
| 204 | 213 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 ASSERT_FALSE(layer_tree_host_.get()); | 537 ASSERT_FALSE(layer_tree_host_.get()); |
| 529 client_.reset(); | 538 client_.reset(); |
| 530 if (timed_out_) { | 539 if (timed_out_) { |
| 531 FAIL() << "Test timed out"; | 540 FAIL() << "Test timed out"; |
| 532 return; | 541 return; |
| 533 } | 542 } |
| 534 AfterTest(); | 543 AfterTest(); |
| 535 } | 544 } |
| 536 | 545 |
| 537 } // namespace cc | 546 } // namespace cc |
| OLD | NEW |