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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 base::TimeTicks monotonic_time) OVERRIDE { | 713 base::TimeTicks monotonic_time) OVERRIDE { |
714 EndTest(); | 714 EndTest(); |
715 } | 715 } |
716 | 716 |
717 virtual void AfterTest() OVERRIDE {} | 717 virtual void AfterTest() OVERRIDE {} |
718 }; | 718 }; |
719 | 719 |
720 SINGLE_AND_MULTI_THREAD_TEST_F( | 720 SINGLE_AND_MULTI_THREAD_TEST_F( |
721 LayerTreeHostAnimationTestLayerAddedWithAnimation); | 721 LayerTreeHostAnimationTestLayerAddedWithAnimation); |
722 | 722 |
723 class LayerTreeHostAnimationTestCompositeAndReadbackAnimateCount | |
724 : public LayerTreeHostAnimationTest { | |
725 public: | |
726 LayerTreeHostAnimationTestCompositeAndReadbackAnimateCount() | |
727 : animated_commit_(-1) { | |
728 } | |
729 | |
730 virtual void Animate(base::TimeTicks) OVERRIDE { | |
731 // We shouldn't animate on the CompositeAndReadback-forced commit, but we | |
732 // should for the SetNeedsCommit-triggered commit. | |
733 animated_commit_ = layer_tree_host()->source_frame_number(); | |
734 EXPECT_NE(2, animated_commit_); | |
735 } | |
736 | |
737 virtual void BeginTest() OVERRIDE { | |
738 PostSetNeedsCommitToMainThread(); | |
739 } | |
740 | |
741 virtual void DidCommit() OVERRIDE { | |
742 switch (layer_tree_host()->source_frame_number()) { | |
743 case 1: | |
744 layer_tree_host()->SetNeedsCommit(); | |
745 break; | |
746 case 2: { | |
747 char pixels[4]; | |
748 layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); | |
749 break; | |
750 } | |
751 case 3: | |
752 // This is finishing the readback's commit. | |
753 break; | |
754 case 4: | |
755 // This is finishing the followup commit. | |
756 EndTest(); | |
757 break; | |
758 default: | |
759 NOTREACHED(); | |
760 } | |
761 } | |
762 | |
763 virtual void AfterTest() OVERRIDE { | |
764 EXPECT_EQ(3, animated_commit_); | |
765 } | |
766 | |
767 private: | |
768 int animated_commit_; | |
769 }; | |
770 | |
771 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestCompositeAndReadbackAnimateCount); | |
772 | |
773 class LayerTreeHostAnimationTestContinuousAnimate | 723 class LayerTreeHostAnimationTestContinuousAnimate |
774 : public LayerTreeHostAnimationTest { | 724 : public LayerTreeHostAnimationTest { |
775 public: | 725 public: |
776 LayerTreeHostAnimationTestContinuousAnimate() | 726 LayerTreeHostAnimationTestContinuousAnimate() |
777 : num_commit_complete_(0), | 727 : num_commit_complete_(0), |
778 num_draw_layers_(0) { | 728 num_draw_layers_(0) { |
779 } | 729 } |
780 | 730 |
781 virtual void SetupTree() OVERRIDE { | 731 virtual void SetupTree() OVERRIDE { |
782 LayerTreeHostAnimationTest::SetupTree(); | 732 LayerTreeHostAnimationTest::SetupTree(); |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 private: | 1331 private: |
1382 scoped_refptr<Layer> content_; | 1332 scoped_refptr<Layer> content_; |
1383 int num_swap_buffers_; | 1333 int num_swap_buffers_; |
1384 }; | 1334 }; |
1385 | 1335 |
1386 SINGLE_AND_MULTI_THREAD_TEST_F( | 1336 SINGLE_AND_MULTI_THREAD_TEST_F( |
1387 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1337 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
1388 | 1338 |
1389 } // namespace | 1339 } // namespace |
1390 } // namespace cc | 1340 } // namespace cc |
OLD | NEW |