| 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 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 TestHooks::~TestHooks() {} | 38 TestHooks::~TestHooks() {} |
| 39 | 39 |
| 40 DrawResult TestHooks::PrepareToDrawOnThread( | 40 DrawResult TestHooks::PrepareToDrawOnThread( |
| 41 LayerTreeHostImpl* host_impl, | 41 LayerTreeHostImpl* host_impl, |
| 42 LayerTreeHostImpl::FrameData* frame_data, | 42 LayerTreeHostImpl::FrameData* frame_data, |
| 43 DrawResult draw_result) { | 43 DrawResult draw_result) { |
| 44 return draw_result; | 44 return draw_result; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void TestHooks::CreateResourceAndRasterWorkerPool( |
| 48 LayerTreeHostImpl* host_impl, |
| 49 scoped_ptr<RasterWorkerPool>* raster_worker_pool, |
| 50 scoped_ptr<ResourcePool>* resource_pool, |
| 51 scoped_ptr<ResourcePool>* staging_resource_pool) { |
| 52 host_impl->LayerTreeHostImpl::CreateResourceAndRasterWorkerPool( |
| 53 raster_worker_pool, resource_pool, staging_resource_pool); |
| 54 } |
| 55 |
| 47 base::TimeDelta TestHooks::LowFrequencyAnimationInterval() const { | 56 base::TimeDelta TestHooks::LowFrequencyAnimationInterval() const { |
| 48 return base::TimeDelta::FromMilliseconds(16); | 57 return base::TimeDelta::FromMilliseconds(16); |
| 49 } | 58 } |
| 50 | 59 |
| 51 // Adapts ThreadProxy for test. Injects test hooks for testing. | 60 // Adapts ThreadProxy for test. Injects test hooks for testing. |
| 52 class ThreadProxyForTest : public ThreadProxy { | 61 class ThreadProxyForTest : public ThreadProxy { |
| 53 public: | 62 public: |
| 54 static scoped_ptr<Proxy> Create( | 63 static scoped_ptr<Proxy> Create( |
| 55 TestHooks* test_hooks, | 64 TestHooks* test_hooks, |
| 56 LayerTreeHost* host, | 65 LayerTreeHost* host, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 host_impl_client, | 148 host_impl_client, |
| 140 proxy, | 149 proxy, |
| 141 stats_instrumentation, | 150 stats_instrumentation, |
| 142 shared_bitmap_manager, | 151 shared_bitmap_manager, |
| 143 gpu_memory_buffer_manager, | 152 gpu_memory_buffer_manager, |
| 144 0), | 153 0), |
| 145 test_hooks_(test_hooks), | 154 test_hooks_(test_hooks), |
| 146 block_notify_ready_to_activate_for_testing_(false), | 155 block_notify_ready_to_activate_for_testing_(false), |
| 147 notify_ready_to_activate_was_blocked_(false) {} | 156 notify_ready_to_activate_was_blocked_(false) {} |
| 148 | 157 |
| 158 void CreateResourceAndRasterWorkerPool( |
| 159 scoped_ptr<RasterWorkerPool>* raster_worker_pool, |
| 160 scoped_ptr<ResourcePool>* resource_pool, |
| 161 scoped_ptr<ResourcePool>* staging_resource_pool) override { |
| 162 test_hooks_->CreateResourceAndRasterWorkerPool( |
| 163 this, raster_worker_pool, resource_pool, staging_resource_pool); |
| 164 } |
| 165 |
| 149 void WillBeginImplFrame(const BeginFrameArgs& args) override { | 166 void WillBeginImplFrame(const BeginFrameArgs& args) override { |
| 150 LayerTreeHostImpl::WillBeginImplFrame(args); | 167 LayerTreeHostImpl::WillBeginImplFrame(args); |
| 151 test_hooks_->WillBeginImplFrameOnThread(this, args); | 168 test_hooks_->WillBeginImplFrameOnThread(this, args); |
| 152 } | 169 } |
| 153 | 170 |
| 154 void BeginMainFrameAborted(bool did_handle) override { | 171 void BeginMainFrameAborted(bool did_handle) override { |
| 155 LayerTreeHostImpl::BeginMainFrameAborted(did_handle); | 172 LayerTreeHostImpl::BeginMainFrameAborted(did_handle); |
| 156 test_hooks_->BeginMainFrameAbortedOnThread(this, did_handle); | 173 test_hooks_->BeginMainFrameAbortedOnThread(this, did_handle); |
| 157 } | 174 } |
| 158 | 175 |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 test_hooks_(test_hooks), | 409 test_hooks_(test_hooks), |
| 393 test_started_(false) {} | 410 test_started_(false) {} |
| 394 | 411 |
| 395 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; | 412 scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; |
| 396 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; | 413 scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
| 397 TestHooks* test_hooks_; | 414 TestHooks* test_hooks_; |
| 398 bool test_started_; | 415 bool test_started_; |
| 399 }; | 416 }; |
| 400 | 417 |
| 401 LayerTreeTest::LayerTreeTest() | 418 LayerTreeTest::LayerTreeTest() |
| 402 : beginning_(false), | 419 : output_surface_(nullptr), |
| 420 beginning_(false), |
| 403 end_when_begin_returns_(false), | 421 end_when_begin_returns_(false), |
| 404 timed_out_(false), | 422 timed_out_(false), |
| 405 scheduled_(false), | 423 scheduled_(false), |
| 406 started_(false), | 424 started_(false), |
| 407 ended_(false), | 425 ended_(false), |
| 408 delegating_renderer_(false), | 426 delegating_renderer_(false), |
| 409 timeout_seconds_(0), | 427 timeout_seconds_(0), |
| 410 weak_factory_(this) { | 428 weak_factory_(this) { |
| 411 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); | 429 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); |
| 412 | 430 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 return -1; | 746 return -1; |
| 729 } | 747 } |
| 730 | 748 |
| 731 void LayerTreeTest::DestroyLayerTreeHost() { | 749 void LayerTreeTest::DestroyLayerTreeHost() { |
| 732 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 750 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
| 733 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 751 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
| 734 layer_tree_host_ = nullptr; | 752 layer_tree_host_ = nullptr; |
| 735 } | 753 } |
| 736 | 754 |
| 737 } // namespace cc | 755 } // namespace cc |
| OLD | NEW |