| 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 20 matching lines...) Expand all Loading... |
| 31 TestHooks::TestHooks() {} | 31 TestHooks::TestHooks() {} |
| 32 | 32 |
| 33 TestHooks::~TestHooks() {} | 33 TestHooks::~TestHooks() {} |
| 34 | 34 |
| 35 bool TestHooks::PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 35 bool TestHooks::PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 36 LayerTreeHostImpl::FrameData* frame_data, | 36 LayerTreeHostImpl::FrameData* frame_data, |
| 37 bool result) { | 37 bool result) { |
| 38 return true; | 38 return true; |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool TestHooks::CanActivatePendingTree() { | 41 bool TestHooks::CanActivatePendingTree(LayerTreeHostImpl* host_impl) { |
| 42 return true; | 42 return true; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. | 45 // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. |
| 46 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { | 46 class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| 47 public: | 47 public: |
| 48 static scoped_ptr<LayerTreeHostImplForTesting> Create( | 48 static scoped_ptr<LayerTreeHostImplForTesting> Create( |
| 49 TestHooks* test_hooks, | 49 TestHooks* test_hooks, |
| 50 const LayerTreeSettings& settings, | 50 const LayerTreeSettings& settings, |
| 51 LayerTreeHostImplClient* host_impl_client, | 51 LayerTreeHostImplClient* host_impl_client, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 virtual void OnSwapBuffersComplete() OVERRIDE { | 107 virtual void OnSwapBuffersComplete() OVERRIDE { |
| 108 LayerTreeHostImpl::OnSwapBuffersComplete(); | 108 LayerTreeHostImpl::OnSwapBuffersComplete(); |
| 109 test_hooks_->SwapBuffersCompleteOnThread(this); | 109 test_hooks_->SwapBuffersCompleteOnThread(this); |
| 110 } | 110 } |
| 111 | 111 |
| 112 virtual bool ActivatePendingTreeIfNeeded() OVERRIDE { | 112 virtual bool ActivatePendingTreeIfNeeded() OVERRIDE { |
| 113 if (!pending_tree()) | 113 if (!pending_tree()) |
| 114 return false; | 114 return false; |
| 115 | 115 |
| 116 if (!test_hooks_->CanActivatePendingTree()) | 116 if (!test_hooks_->CanActivatePendingTree(this)) |
| 117 return false; | 117 return false; |
| 118 | 118 |
| 119 bool activated = LayerTreeHostImpl::ActivatePendingTreeIfNeeded(); | 119 bool activated = LayerTreeHostImpl::ActivatePendingTreeIfNeeded(); |
| 120 if (activated) | 120 if (activated) |
| 121 test_hooks_->TreeActivatedOnThread(this); | 121 test_hooks_->TreeActivatedOnThread(this); |
| 122 return activated; | 122 return activated; |
| 123 } | 123 } |
| 124 | 124 |
| 125 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface) | 125 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface) |
| 126 OVERRIDE { | 126 OVERRIDE { |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 | 602 |
| 603 scoped_refptr<cc::ContextProvider> LayerTreeTest:: | 603 scoped_refptr<cc::ContextProvider> LayerTreeTest:: |
| 604 OffscreenContextProviderForCompositorThread() { | 604 OffscreenContextProviderForCompositorThread() { |
| 605 if (!compositor_thread_contexts_ || | 605 if (!compositor_thread_contexts_ || |
| 606 compositor_thread_contexts_->DestroyedOnMainThread()) | 606 compositor_thread_contexts_->DestroyedOnMainThread()) |
| 607 compositor_thread_contexts_ = FakeContextProvider::Create(); | 607 compositor_thread_contexts_ = FakeContextProvider::Create(); |
| 608 return compositor_thread_contexts_; | 608 return compositor_thread_contexts_; |
| 609 } | 609 } |
| 610 | 610 |
| 611 } // namespace cc | 611 } // namespace cc |
| OLD | NEW |