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 19 matching lines...) Expand all Loading... |
30 TestHooks::TestHooks() {} | 30 TestHooks::TestHooks() {} |
31 | 31 |
32 TestHooks::~TestHooks() {} | 32 TestHooks::~TestHooks() {} |
33 | 33 |
34 bool TestHooks::PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 34 bool TestHooks::PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
35 LayerTreeHostImpl::FrameData* frame_data, | 35 LayerTreeHostImpl::FrameData* frame_data, |
36 bool result) { | 36 bool result) { |
37 return true; | 37 return true; |
38 } | 38 } |
39 | 39 |
| 40 base::TimeDelta TestHooks::LowFrequencyAnimationInterval() const { |
| 41 return base::TimeDelta::FromMilliseconds(16); |
| 42 } |
| 43 |
40 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. | 44 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. |
41 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { | 45 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
42 public: | 46 public: |
43 static scoped_ptr<LayerTreeHostImplForTesting> Create( | 47 static scoped_ptr<LayerTreeHostImplForTesting> Create( |
44 TestHooks* test_hooks, | 48 TestHooks* test_hooks, |
45 const LayerTreeSettings& settings, | 49 const LayerTreeSettings& settings, |
46 LayerTreeHostImplClient* host_impl_client, | 50 LayerTreeHostImplClient* host_impl_client, |
47 Proxy* proxy, | 51 Proxy* proxy, |
48 RenderingStatsInstrumentation* stats_instrumentation) { | 52 RenderingStatsInstrumentation* stats_instrumentation) { |
49 return make_scoped_ptr( | 53 return make_scoped_ptr( |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 for (; iter != active_animation_controllers().end(); ++iter) { | 166 for (; iter != active_animation_controllers().end(); ++iter) { |
163 if (iter->second->HasActiveAnimation()) { | 167 if (iter->second->HasActiveAnimation()) { |
164 has_unfinished_animation = true; | 168 has_unfinished_animation = true; |
165 break; | 169 break; |
166 } | 170 } |
167 } | 171 } |
168 test_hooks_->UpdateAnimationState(this, has_unfinished_animation); | 172 test_hooks_->UpdateAnimationState(this, has_unfinished_animation); |
169 } | 173 } |
170 | 174 |
171 virtual base::TimeDelta LowFrequencyAnimationInterval() const OVERRIDE { | 175 virtual base::TimeDelta LowFrequencyAnimationInterval() const OVERRIDE { |
172 return base::TimeDelta::FromMilliseconds(16); | 176 return test_hooks_->LowFrequencyAnimationInterval(); |
173 } | 177 } |
174 | 178 |
175 private: | 179 private: |
176 TestHooks* test_hooks_; | 180 TestHooks* test_hooks_; |
177 bool block_notify_ready_to_activate_for_testing_; | 181 bool block_notify_ready_to_activate_for_testing_; |
178 bool notify_ready_to_activate_was_blocked_; | 182 bool notify_ready_to_activate_was_blocked_; |
179 }; | 183 }; |
180 | 184 |
181 // Adapts LayerTreeHost for test. Injects LayerTreeHostImplForTesting. | 185 // Adapts LayerTreeHost for test. Injects LayerTreeHostImplForTesting. |
182 class LayerTreeHostForTesting : public cc::LayerTreeHost { | 186 class LayerTreeHostForTesting : public cc::LayerTreeHost { |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 631 |
628 scoped_refptr<cc::ContextProvider> LayerTreeTest:: | 632 scoped_refptr<cc::ContextProvider> LayerTreeTest:: |
629 OffscreenContextProviderForCompositorThread() { | 633 OffscreenContextProviderForCompositorThread() { |
630 if (!compositor_thread_contexts_.get() || | 634 if (!compositor_thread_contexts_.get() || |
631 compositor_thread_contexts_->DestroyedOnMainThread()) | 635 compositor_thread_contexts_->DestroyedOnMainThread()) |
632 compositor_thread_contexts_ = TestContextProvider::Create(); | 636 compositor_thread_contexts_ = TestContextProvider::Create(); |
633 return compositor_thread_contexts_; | 637 return compositor_thread_contexts_; |
634 } | 638 } |
635 | 639 |
636 } // namespace cc | 640 } // namespace cc |
OLD | NEW |