| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 void DidSwapBuffersComplete() override { | 202 void DidSwapBuffersComplete() override { |
| 203 LayerTreeHostImpl::DidSwapBuffersComplete(); | 203 LayerTreeHostImpl::DidSwapBuffersComplete(); |
| 204 test_hooks_->SwapBuffersCompleteOnThread(this); | 204 test_hooks_->SwapBuffersCompleteOnThread(this); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void ReclaimResources(const CompositorFrameAck* ack) override { | 207 void ReclaimResources(const CompositorFrameAck* ack) override { |
| 208 LayerTreeHostImpl::ReclaimResources(ack); | 208 LayerTreeHostImpl::ReclaimResources(ack); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void UpdateVisibleTiles() override { | |
| 212 LayerTreeHostImpl::UpdateVisibleTiles(); | |
| 213 test_hooks_->UpdateVisibleTilesOnThread(this); | |
| 214 } | |
| 215 | |
| 216 void NotifyReadyToActivate() override { | 211 void NotifyReadyToActivate() override { |
| 217 if (block_notify_ready_to_activate_for_testing_) | 212 if (block_notify_ready_to_activate_for_testing_) |
| 218 notify_ready_to_activate_was_blocked_ = true; | 213 notify_ready_to_activate_was_blocked_ = true; |
| 219 else | 214 else |
| 220 client_->NotifyReadyToActivate(); | 215 client_->NotifyReadyToActivate(); |
| 221 } | 216 } |
| 222 | 217 |
| 223 void BlockNotifyReadyToActivateForTesting(bool block) override { | 218 void BlockNotifyReadyToActivateForTesting(bool block) override { |
| 224 CHECK(settings().impl_side_painting); | 219 CHECK(settings().impl_side_painting); |
| 225 CHECK(proxy()->ImplThreadTaskRunner()) | 220 CHECK(proxy()->ImplThreadTaskRunner()) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 break; | 261 break; |
| 267 } | 262 } |
| 268 } | 263 } |
| 269 test_hooks_->UpdateAnimationState(this, has_unfinished_animation); | 264 test_hooks_->UpdateAnimationState(this, has_unfinished_animation); |
| 270 } | 265 } |
| 271 | 266 |
| 272 base::TimeDelta LowFrequencyAnimationInterval() const override { | 267 base::TimeDelta LowFrequencyAnimationInterval() const override { |
| 273 return test_hooks_->LowFrequencyAnimationInterval(); | 268 return test_hooks_->LowFrequencyAnimationInterval(); |
| 274 } | 269 } |
| 275 | 270 |
| 271 void NotifyTileStateChanged(const Tile* tile) override { |
| 272 LayerTreeHostImpl::NotifyTileStateChanged(tile); |
| 273 test_hooks_->NotifyTileStateChangedOnThread(this, tile); |
| 274 } |
| 275 |
| 276 private: | 276 private: |
| 277 TestHooks* test_hooks_; | 277 TestHooks* test_hooks_; |
| 278 bool block_notify_ready_to_activate_for_testing_; | 278 bool block_notify_ready_to_activate_for_testing_; |
| 279 bool notify_ready_to_activate_was_blocked_; | 279 bool notify_ready_to_activate_was_blocked_; |
| 280 }; | 280 }; |
| 281 | 281 |
| 282 // Implementation of LayerTreeHost callback interface. | 282 // Implementation of LayerTreeHost callback interface. |
| 283 class LayerTreeHostClientForTesting : public LayerTreeHostClient, | 283 class LayerTreeHostClientForTesting : public LayerTreeHostClient, |
| 284 public LayerTreeHostSingleThreadClient { | 284 public LayerTreeHostSingleThreadClient { |
| 285 public: | 285 public: |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 // that the test should end the second BeginTest regains control. | 446 // that the test should end the second BeginTest regains control. |
| 447 if (beginning_) { | 447 if (beginning_) { |
| 448 end_when_begin_returns_ = true; | 448 end_when_begin_returns_ = true; |
| 449 } else { | 449 } else { |
| 450 main_task_runner_->PostTask( | 450 main_task_runner_->PostTask( |
| 451 FROM_HERE, | 451 FROM_HERE, |
| 452 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_)); | 452 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_)); |
| 453 } | 453 } |
| 454 } | 454 } |
| 455 | 455 |
| 456 void LayerTreeTest::EndTestAfterDelay(int delay_milliseconds) { | 456 void LayerTreeTest::EndTestAfterDelayMs(int delay_milliseconds) { |
| 457 main_task_runner_->PostDelayedTask( | 457 main_task_runner_->PostDelayedTask( |
| 458 FROM_HERE, | 458 FROM_HERE, |
| 459 base::Bind(&LayerTreeTest::EndTest, main_thread_weak_ptr_), | 459 base::Bind(&LayerTreeTest::EndTest, main_thread_weak_ptr_), |
| 460 base::TimeDelta::FromMilliseconds(delay_milliseconds)); | 460 base::TimeDelta::FromMilliseconds(delay_milliseconds)); |
| 461 } | 461 } |
| 462 | 462 |
| 463 void LayerTreeTest::PostAddAnimationToMainThread( | 463 void LayerTreeTest::PostAddAnimationToMainThread( |
| 464 Layer* layer_to_receive_animation) { | 464 Layer* layer_to_receive_animation) { |
| 465 main_task_runner_->PostTask( | 465 main_task_runner_->PostTask( |
| 466 FROM_HERE, | 466 FROM_HERE, |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 return -1; | 746 return -1; |
| 747 } | 747 } |
| 748 | 748 |
| 749 void LayerTreeTest::DestroyLayerTreeHost() { | 749 void LayerTreeTest::DestroyLayerTreeHost() { |
| 750 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 750 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
| 751 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 751 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
| 752 layer_tree_host_ = nullptr; | 752 layer_tree_host_ = nullptr; |
| 753 } | 753 } |
| 754 | 754 |
| 755 } // namespace cc | 755 } // namespace cc |
| OLD | NEW |