| 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 private: | 1332 private: |
| 1383 scoped_refptr<Layer> content_; | 1333 scoped_refptr<Layer> content_; |
| 1384 int num_swap_buffers_; | 1334 int num_swap_buffers_; |
| 1385 }; | 1335 }; |
| 1386 | 1336 |
| 1387 SINGLE_AND_MULTI_THREAD_TEST_F( | 1337 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1388 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1338 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
| 1389 | 1339 |
| 1390 } // namespace | 1340 } // namespace |
| 1391 } // namespace cc | 1341 } // namespace cc |
| OLD | NEW |