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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 void DidSwapBuffersComplete() override { | 185 void DidSwapBuffersComplete() override { |
186 LayerTreeHostImpl::DidSwapBuffersComplete(); | 186 LayerTreeHostImpl::DidSwapBuffersComplete(); |
187 test_hooks_->SwapBuffersCompleteOnThread(this); | 187 test_hooks_->SwapBuffersCompleteOnThread(this); |
188 } | 188 } |
189 | 189 |
190 void ReclaimResources(const CompositorFrameAck* ack) override { | 190 void ReclaimResources(const CompositorFrameAck* ack) override { |
191 LayerTreeHostImpl::ReclaimResources(ack); | 191 LayerTreeHostImpl::ReclaimResources(ack); |
192 } | 192 } |
193 | 193 |
194 void UpdateVisibleTiles() override { | |
195 LayerTreeHostImpl::UpdateVisibleTiles(); | |
196 test_hooks_->UpdateVisibleTilesOnThread(this); | |
197 } | |
198 | |
199 void NotifyReadyToActivate() override { | 194 void NotifyReadyToActivate() override { |
200 if (block_notify_ready_to_activate_for_testing_) | 195 if (block_notify_ready_to_activate_for_testing_) |
201 notify_ready_to_activate_was_blocked_ = true; | 196 notify_ready_to_activate_was_blocked_ = true; |
202 else | 197 else |
203 client_->NotifyReadyToActivate(); | 198 client_->NotifyReadyToActivate(); |
204 } | 199 } |
205 | 200 |
206 void BlockNotifyReadyToActivateForTesting(bool block) override { | 201 void BlockNotifyReadyToActivateForTesting(bool block) override { |
207 CHECK(settings().impl_side_painting); | 202 CHECK(settings().impl_side_painting); |
208 CHECK(proxy()->ImplThreadTaskRunner()) | 203 CHECK(proxy()->ImplThreadTaskRunner()) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 break; | 244 break; |
250 } | 245 } |
251 } | 246 } |
252 test_hooks_->UpdateAnimationState(this, has_unfinished_animation); | 247 test_hooks_->UpdateAnimationState(this, has_unfinished_animation); |
253 } | 248 } |
254 | 249 |
255 base::TimeDelta LowFrequencyAnimationInterval() const override { | 250 base::TimeDelta LowFrequencyAnimationInterval() const override { |
256 return test_hooks_->LowFrequencyAnimationInterval(); | 251 return test_hooks_->LowFrequencyAnimationInterval(); |
257 } | 252 } |
258 | 253 |
| 254 void NotifyTileStateChanged(const Tile* tile) override { |
| 255 LayerTreeHostImpl::NotifyTileStateChanged(tile); |
| 256 test_hooks_->NotifyTileStateChangedOnThread(this, tile); |
| 257 } |
| 258 |
259 private: | 259 private: |
260 TestHooks* test_hooks_; | 260 TestHooks* test_hooks_; |
261 bool block_notify_ready_to_activate_for_testing_; | 261 bool block_notify_ready_to_activate_for_testing_; |
262 bool notify_ready_to_activate_was_blocked_; | 262 bool notify_ready_to_activate_was_blocked_; |
263 }; | 263 }; |
264 | 264 |
265 // Implementation of LayerTreeHost callback interface. | 265 // Implementation of LayerTreeHost callback interface. |
266 class LayerTreeHostClientForTesting : public LayerTreeHostClient, | 266 class LayerTreeHostClientForTesting : public LayerTreeHostClient, |
267 public LayerTreeHostSingleThreadClient { | 267 public LayerTreeHostSingleThreadClient { |
268 public: | 268 public: |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 // that the test should end the second BeginTest regains control. | 428 // that the test should end the second BeginTest regains control. |
429 if (beginning_) { | 429 if (beginning_) { |
430 end_when_begin_returns_ = true; | 430 end_when_begin_returns_ = true; |
431 } else { | 431 } else { |
432 main_task_runner_->PostTask( | 432 main_task_runner_->PostTask( |
433 FROM_HERE, | 433 FROM_HERE, |
434 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_)); | 434 base::Bind(&LayerTreeTest::RealEndTest, main_thread_weak_ptr_)); |
435 } | 435 } |
436 } | 436 } |
437 | 437 |
438 void LayerTreeTest::EndTestAfterDelay(int delay_milliseconds) { | 438 void LayerTreeTest::EndTestAfterDelayMs(int delay_milliseconds) { |
439 main_task_runner_->PostDelayedTask( | 439 main_task_runner_->PostDelayedTask( |
440 FROM_HERE, | 440 FROM_HERE, |
441 base::Bind(&LayerTreeTest::EndTest, main_thread_weak_ptr_), | 441 base::Bind(&LayerTreeTest::EndTest, main_thread_weak_ptr_), |
442 base::TimeDelta::FromMilliseconds(delay_milliseconds)); | 442 base::TimeDelta::FromMilliseconds(delay_milliseconds)); |
443 } | 443 } |
444 | 444 |
445 void LayerTreeTest::PostAddAnimationToMainThread( | 445 void LayerTreeTest::PostAddAnimationToMainThread( |
446 Layer* layer_to_receive_animation) { | 446 Layer* layer_to_receive_animation) { |
447 main_task_runner_->PostTask( | 447 main_task_runner_->PostTask( |
448 FROM_HERE, | 448 FROM_HERE, |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 return -1; | 715 return -1; |
716 } | 716 } |
717 | 717 |
718 void LayerTreeTest::DestroyLayerTreeHost() { | 718 void LayerTreeTest::DestroyLayerTreeHost() { |
719 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 719 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
720 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 720 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
721 layer_tree_host_ = nullptr; | 721 layer_tree_host_ = nullptr; |
722 } | 722 } |
723 | 723 |
724 } // namespace cc | 724 } // namespace cc |
OLD | NEW |