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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 controller_impl->RemoveAnimation(animation_impl->id()); | 662 controller_impl->RemoveAnimation(animation_impl->id()); |
663 EndTest(); | 663 EndTest(); |
664 } | 664 } |
665 | 665 |
666 virtual void AfterTest() override { | 666 virtual void AfterTest() override { |
667 // Update() should have been called once, proving that the layer was not | 667 // Update() should have been called once, proving that the layer was not |
668 // skipped. | 668 // skipped. |
669 EXPECT_EQ(1u, update_check_layer_->update_count()); | 669 EXPECT_EQ(1u, update_check_layer_->update_count()); |
670 | 670 |
671 // clear update_check_layer_ so LayerTreeHost dies. | 671 // clear update_check_layer_ so LayerTreeHost dies. |
672 update_check_layer_ = NULL; | 672 update_check_layer_ = nullptr; |
673 } | 673 } |
674 | 674 |
675 private: | 675 private: |
676 FakeContentLayerClient client_; | 676 FakeContentLayerClient client_; |
677 scoped_refptr<FakeContentLayer> update_check_layer_; | 677 scoped_refptr<FakeContentLayer> update_check_layer_; |
678 }; | 678 }; |
679 | 679 |
680 SINGLE_AND_MULTI_THREAD_TEST_F( | 680 SINGLE_AND_MULTI_THREAD_TEST_F( |
681 LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity); | 681 LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity); |
682 | 682 |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 private: | 1284 private: |
1285 scoped_refptr<Layer> content_; | 1285 scoped_refptr<Layer> content_; |
1286 int num_swap_buffers_; | 1286 int num_swap_buffers_; |
1287 }; | 1287 }; |
1288 | 1288 |
1289 SINGLE_AND_MULTI_THREAD_TEST_F( | 1289 SINGLE_AND_MULTI_THREAD_TEST_F( |
1290 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1290 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
1291 | 1291 |
1292 } // namespace | 1292 } // namespace |
1293 } // namespace cc | 1293 } // namespace cc |
OLD | NEW |