OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "cc/animation/animation_curve.h" | 7 #include "cc/animation/animation_curve.h" |
8 #include "cc/animation/layer_animation_controller.h" | 8 #include "cc/animation/layer_animation_controller.h" |
9 #include "cc/animation/scroll_offset_animation_curve.h" | 9 #include "cc/animation/scroll_offset_animation_curve.h" |
10 #include "cc/animation/timing_function.h" | 10 #include "cc/animation/timing_function.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 } | 363 } |
364 | 364 |
365 virtual void BeginTest() override { | 365 virtual void BeginTest() override { |
366 PostAddAnimationToMainThread(layer_tree_host()->root_layer()); | 366 PostAddAnimationToMainThread(layer_tree_host()->root_layer()); |
367 } | 367 } |
368 | 368 |
369 virtual void NotifyAnimationFinished( | 369 virtual void NotifyAnimationFinished( |
370 base::TimeTicks monotonic_time, | 370 base::TimeTicks monotonic_time, |
371 Animation::TargetProperty target_property) override { | 371 Animation::TargetProperty target_property) override { |
372 // Replace animated commits with an empty tree. | 372 // Replace animated commits with an empty tree. |
373 layer_tree_host()->SetRootLayer(make_scoped_refptr<Layer>(NULL)); | 373 layer_tree_host()->SetRootLayer(make_scoped_refptr<Layer>(nullptr)); |
374 } | 374 } |
375 | 375 |
376 virtual void DidCommit() override { | 376 virtual void DidCommit() override { |
377 // This alternates setting an empty tree and a non-empty tree with an | 377 // This alternates setting an empty tree and a non-empty tree with an |
378 // animation. | 378 // animation. |
379 switch (layer_tree_host()->source_frame_number()) { | 379 switch (layer_tree_host()->source_frame_number()) { |
380 case 1: | 380 case 1: |
381 // Wait for NotifyAnimationFinished to commit an empty tree. | 381 // Wait for NotifyAnimationFinished to commit an empty tree. |
382 break; | 382 break; |
383 case 2: | 383 case 2: |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 controller_impl->RemoveAnimation(animation_impl->id()); | 664 controller_impl->RemoveAnimation(animation_impl->id()); |
665 EndTest(); | 665 EndTest(); |
666 } | 666 } |
667 | 667 |
668 virtual void AfterTest() override { | 668 virtual void AfterTest() override { |
669 // Update() should have been called once, proving that the layer was not | 669 // Update() should have been called once, proving that the layer was not |
670 // skipped. | 670 // skipped. |
671 EXPECT_EQ(1u, update_check_layer_->update_count()); | 671 EXPECT_EQ(1u, update_check_layer_->update_count()); |
672 | 672 |
673 // clear update_check_layer_ so LayerTreeHost dies. | 673 // clear update_check_layer_ so LayerTreeHost dies. |
674 update_check_layer_ = NULL; | 674 update_check_layer_ = nullptr; |
675 } | 675 } |
676 | 676 |
677 private: | 677 private: |
678 FakeContentLayerClient client_; | 678 FakeContentLayerClient client_; |
679 scoped_refptr<FakeContentLayer> update_check_layer_; | 679 scoped_refptr<FakeContentLayer> update_check_layer_; |
680 }; | 680 }; |
681 | 681 |
682 SINGLE_AND_MULTI_THREAD_TEST_F( | 682 SINGLE_AND_MULTI_THREAD_TEST_F( |
683 LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity); | 683 LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity); |
684 | 684 |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 private: | 1290 private: |
1291 scoped_refptr<Layer> content_; | 1291 scoped_refptr<Layer> content_; |
1292 int num_swap_buffers_; | 1292 int num_swap_buffers_; |
1293 }; | 1293 }; |
1294 | 1294 |
1295 SINGLE_AND_MULTI_THREAD_TEST_F( | 1295 SINGLE_AND_MULTI_THREAD_TEST_F( |
1296 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1296 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
1297 | 1297 |
1298 } // namespace | 1298 } // namespace |
1299 } // namespace cc | 1299 } // namespace cc |
OLD | NEW |