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/timing_function.h" | 9 #include "cc/animation/timing_function.h" |
10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 virtual void AfterTest() OVERRIDE {} | 68 virtual void AfterTest() OVERRIDE {} |
69 | 69 |
70 private: | 70 private: |
71 int num_commits_; | 71 int num_commits_; |
72 }; | 72 }; |
73 | 73 |
74 MULTI_THREAD_TEST_F( | 74 MULTI_THREAD_TEST_F( |
75 LayerTreeHostAnimationTestSetNeedsAnimateShouldNotSetCommitRequested); | 75 LayerTreeHostAnimationTestSetNeedsAnimateShouldNotSetCommitRequested); |
76 | 76 |
77 // Trigger a frame with SetNeedsCommit. Then, inside the resulting animate | 77 // Trigger a frame with SetNeedsCommit. Then, inside the resulting animate |
78 // callback, requet another frame using SetNeedsAnimate. End the test when | 78 // callback, request another frame using SetNeedsAnimate. End the test when |
79 // animate gets called yet-again, indicating that the proxy is correctly | 79 // animate gets called yet-again, indicating that the proxy is correctly |
80 // handling the case where SetNeedsAnimate() is called inside the begin frame | 80 // handling the case where SetNeedsAnimate() is called inside the BeginFrame |
81 // flow. | 81 // flow. |
82 class LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback | 82 class LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback |
83 : public LayerTreeHostAnimationTest { | 83 : public LayerTreeHostAnimationTest { |
84 public: | 84 public: |
85 LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback() | 85 LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback() |
86 : num_animates_(0) {} | 86 : num_animates_(0) {} |
87 | 87 |
88 virtual void BeginTest() OVERRIDE { | 88 virtual void BeginTest() OVERRIDE { |
89 PostSetNeedsCommitToMainThread(); | 89 PostSetNeedsCommitToMainThread(); |
90 } | 90 } |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 if (TestEnded()) | 754 if (TestEnded()) |
755 return result; | 755 return result; |
756 // Act like there is checkerboard when the second animation wants to draw. | 756 // Act like there is checkerboard when the second animation wants to draw. |
757 ++prevented_draw_; | 757 ++prevented_draw_; |
758 return false; | 758 return false; |
759 } | 759 } |
760 | 760 |
761 virtual void DidCommitAndDrawFrame() OVERRIDE { | 761 virtual void DidCommitAndDrawFrame() OVERRIDE { |
762 switch (layer_tree_host()->commit_number()) { | 762 switch (layer_tree_host()->commit_number()) { |
763 case 1: | 763 case 1: |
764 // The animation is longer than 1 vsync. | 764 // The animation is longer than 1 BeginFrame interval. |
765 AddOpacityTransitionToLayer(content_, 0.1, 0.2f, 0.8f, false); | 765 AddOpacityTransitionToLayer(content_, 0.1, 0.2f, 0.8f, false); |
766 added_animations_++; | 766 added_animations_++; |
767 break; | 767 break; |
768 case 2: | 768 case 2: |
769 // This second animation will not be drawn so it should not start. | 769 // This second animation will not be drawn so it should not start. |
770 AddAnimatedTransformToLayer(content_, 0.1, 5, 5); | 770 AddAnimatedTransformToLayer(content_, 0.1, 5, 5); |
771 added_animations_++; | 771 added_animations_++; |
772 break; | 772 break; |
773 } | 773 } |
774 } | 774 } |
(...skipping 28 matching lines...) Expand all Loading... |
803 int finished_times_; | 803 int finished_times_; |
804 FakeContentLayerClient client_; | 804 FakeContentLayerClient client_; |
805 scoped_refptr<FakeContentLayer> content_; | 805 scoped_refptr<FakeContentLayer> content_; |
806 }; | 806 }; |
807 | 807 |
808 MULTI_THREAD_TEST_F( | 808 MULTI_THREAD_TEST_F( |
809 LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations); | 809 LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations); |
810 | 810 |
811 } // namespace | 811 } // namespace |
812 } // namespace cc | 812 } // namespace cc |
OLD | NEW |