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 21 matching lines...) Expand all Loading... |
32 class LayerTreeHostAnimationTestSetNeedsAnimateShouldNotSetCommitRequested | 32 class LayerTreeHostAnimationTestSetNeedsAnimateShouldNotSetCommitRequested |
33 : public LayerTreeHostAnimationTest { | 33 : public LayerTreeHostAnimationTest { |
34 public: | 34 public: |
35 LayerTreeHostAnimationTestSetNeedsAnimateShouldNotSetCommitRequested() | 35 LayerTreeHostAnimationTestSetNeedsAnimateShouldNotSetCommitRequested() |
36 : num_commits_(0) {} | 36 : num_commits_(0) {} |
37 | 37 |
38 virtual void BeginTest() OVERRIDE { | 38 virtual void BeginTest() OVERRIDE { |
39 PostSetNeedsCommitToMainThread(); | 39 PostSetNeedsCommitToMainThread(); |
40 } | 40 } |
41 | 41 |
42 virtual void Animate(base::TimeTicks monotonic_time) OVERRIDE { | 42 virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE { |
43 // We skip the first commit becasue its the commit that populates the | 43 // We skip the first commit because its the commit that populates the |
44 // impl thread with a tree. After the second commit, the test is done. | 44 // impl thread with a tree. After the second commit, the test is done. |
45 if (num_commits_ != 1) | 45 if (num_commits_ != 1) |
46 return; | 46 return; |
47 | 47 |
48 layer_tree_host()->SetNeedsAnimate(); | 48 layer_tree_host()->SetNeedsAnimate(); |
49 // Right now, CommitRequested is going to be true, because during | 49 // Right now, CommitRequested is going to be true, because during |
50 // BeginFrame, we force CommitRequested to true to prevent requests from | 50 // BeginFrame, we force CommitRequested to true to prevent requests from |
51 // hitting the impl thread. But, when the next DidCommit happens, we should | 51 // hitting the impl thread. But, when the next DidCommit happens, we should |
52 // verify that CommitRequested has gone back to false. | 52 // verify that CommitRequested has gone back to false. |
53 } | 53 } |
(...skipping 23 matching lines...) Expand all Loading... |
77 | 77 |
78 // Trigger a frame with SetNeedsCommit. Then, inside the resulting animate | 78 // Trigger a frame with SetNeedsCommit. Then, inside the resulting animate |
79 // callback, request another frame using SetNeedsAnimate. End the test when | 79 // callback, request another frame using SetNeedsAnimate. End the test when |
80 // animate gets called yet-again, indicating that the proxy is correctly | 80 // animate gets called yet-again, indicating that the proxy is correctly |
81 // handling the case where SetNeedsAnimate() is called inside the BeginFrame | 81 // handling the case where SetNeedsAnimate() is called inside the BeginFrame |
82 // flow. | 82 // flow. |
83 class LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback | 83 class LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback |
84 : public LayerTreeHostAnimationTest { | 84 : public LayerTreeHostAnimationTest { |
85 public: | 85 public: |
86 LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback() | 86 LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback() |
87 : num_animates_(0) {} | 87 : num_begin_frames_(0) {} |
88 | 88 |
89 virtual void BeginTest() OVERRIDE { | 89 virtual void BeginTest() OVERRIDE { |
90 PostSetNeedsCommitToMainThread(); | 90 PostSetNeedsCommitToMainThread(); |
91 } | 91 } |
92 | 92 |
93 virtual void Animate(base::TimeTicks) OVERRIDE { | 93 virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE { |
94 if (!num_animates_) { | 94 if (!num_begin_frames_) { |
95 layer_tree_host()->SetNeedsAnimate(); | 95 layer_tree_host()->SetNeedsAnimate(); |
96 num_animates_++; | 96 num_begin_frames_++; |
97 return; | 97 return; |
98 } | 98 } |
99 EndTest(); | 99 EndTest(); |
100 } | 100 } |
101 | 101 |
102 virtual void AfterTest() OVERRIDE {} | 102 virtual void AfterTest() OVERRIDE {} |
103 | 103 |
104 private: | 104 private: |
105 int num_animates_; | 105 int num_begin_frames_; |
106 }; | 106 }; |
107 | 107 |
108 MULTI_THREAD_TEST_F( | 108 MULTI_THREAD_TEST_F( |
109 LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback); | 109 LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback); |
110 | 110 |
111 // Add a layer animation and confirm that | 111 // Add a layer animation and confirm that |
112 // LayerTreeHostImpl::updateAnimationState does get called and continues to | 112 // LayerTreeHostImpl::updateAnimationState does get called and continues to |
113 // get called. | 113 // get called. |
114 class LayerTreeHostAnimationTestAddAnimation | 114 class LayerTreeHostAnimationTestAddAnimation |
115 : public LayerTreeHostAnimationTest { | 115 : public LayerTreeHostAnimationTest { |
116 public: | 116 public: |
117 LayerTreeHostAnimationTestAddAnimation() | 117 LayerTreeHostAnimationTestAddAnimation() |
118 : num_animates_(0), | 118 : num_begin_frames_(0), received_animation_started_notification_(false) {} |
119 received_animation_started_notification_(false) { | |
120 } | |
121 | 119 |
122 virtual void BeginTest() OVERRIDE { | 120 virtual void BeginTest() OVERRIDE { |
123 PostAddInstantAnimationToMainThread(layer_tree_host()->root_layer()); | 121 PostAddInstantAnimationToMainThread(layer_tree_host()->root_layer()); |
124 } | 122 } |
125 | 123 |
126 virtual void UpdateAnimationState( | 124 virtual void UpdateAnimationState( |
127 LayerTreeHostImpl* host_impl, | 125 LayerTreeHostImpl* host_impl, |
128 bool has_unfinished_animation) OVERRIDE { | 126 bool has_unfinished_animation) OVERRIDE { |
129 if (!num_animates_) { | 127 if (!num_begin_frames_) { |
130 // The animation had zero duration so LayerTreeHostImpl should no | 128 // The animation had zero duration so LayerTreeHostImpl should no |
131 // longer need to animate its layers. | 129 // longer need to animate its layers. |
132 EXPECT_FALSE(has_unfinished_animation); | 130 EXPECT_FALSE(has_unfinished_animation); |
133 num_animates_++; | 131 num_begin_frames_++; |
134 return; | 132 return; |
135 } | 133 } |
136 | 134 |
137 if (received_animation_started_notification_) { | 135 if (received_animation_started_notification_) { |
138 EXPECT_LT(base::TimeTicks(), start_time_); | 136 EXPECT_LT(base::TimeTicks(), start_time_); |
139 | 137 |
140 LayerAnimationController* controller_impl = | 138 LayerAnimationController* controller_impl = |
141 host_impl->active_tree()->root_layer()->layer_animation_controller(); | 139 host_impl->active_tree()->root_layer()->layer_animation_controller(); |
142 Animation* animation_impl = | 140 Animation* animation_impl = |
143 controller_impl->GetAnimation(Animation::Opacity); | 141 controller_impl->GetAnimation(Animation::Opacity); |
144 if (animation_impl) | 142 if (animation_impl) |
145 controller_impl->RemoveAnimation(animation_impl->id()); | 143 controller_impl->RemoveAnimation(animation_impl->id()); |
146 | 144 |
147 EndTest(); | 145 EndTest(); |
148 } | 146 } |
149 } | 147 } |
150 | 148 |
151 virtual void NotifyAnimationStarted( | 149 virtual void NotifyAnimationStarted( |
152 base::TimeTicks monotonic_time, | 150 base::TimeTicks monotonic_time, |
153 Animation::TargetProperty target_property) OVERRIDE { | 151 Animation::TargetProperty target_property) OVERRIDE { |
154 received_animation_started_notification_ = true; | 152 received_animation_started_notification_ = true; |
155 start_time_ = monotonic_time; | 153 start_time_ = monotonic_time; |
156 if (num_animates_) { | 154 if (num_begin_frames_) { |
157 EXPECT_LT(base::TimeTicks(), start_time_); | 155 EXPECT_LT(base::TimeTicks(), start_time_); |
158 | 156 |
159 LayerAnimationController* controller = | 157 LayerAnimationController* controller = |
160 layer_tree_host()->root_layer()->layer_animation_controller(); | 158 layer_tree_host()->root_layer()->layer_animation_controller(); |
161 Animation* animation = | 159 Animation* animation = |
162 controller->GetAnimation(Animation::Opacity); | 160 controller->GetAnimation(Animation::Opacity); |
163 if (animation) | 161 if (animation) |
164 controller->RemoveAnimation(animation->id()); | 162 controller->RemoveAnimation(animation->id()); |
165 | 163 |
166 EndTest(); | 164 EndTest(); |
167 } | 165 } |
168 } | 166 } |
169 | 167 |
170 virtual void AfterTest() OVERRIDE {} | 168 virtual void AfterTest() OVERRIDE {} |
171 | 169 |
172 private: | 170 private: |
173 int num_animates_; | 171 int num_begin_frames_; |
174 bool received_animation_started_notification_; | 172 bool received_animation_started_notification_; |
175 base::TimeTicks start_time_; | 173 base::TimeTicks start_time_; |
176 }; | 174 }; |
177 | 175 |
178 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestAddAnimation); | 176 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestAddAnimation); |
179 | 177 |
180 // Add a layer animation to a layer, but continually fail to draw. Confirm that | 178 // Add a layer animation to a layer, but continually fail to draw. Confirm that |
181 // after a while, we do eventually force a draw. | 179 // after a while, we do eventually force a draw. |
182 class LayerTreeHostAnimationTestCheckerboardDoesNotStarveDraws | 180 class LayerTreeHostAnimationTestCheckerboardDoesNotStarveDraws |
183 : public LayerTreeHostAnimationTest { | 181 : public LayerTreeHostAnimationTest { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 bool started_animating_; | 253 bool started_animating_; |
256 }; | 254 }; |
257 | 255 |
258 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestAnimationsGetDeleted); | 256 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestAnimationsGetDeleted); |
259 | 257 |
260 // Ensures that animations continue to be ticked when we are backgrounded. | 258 // Ensures that animations continue to be ticked when we are backgrounded. |
261 class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded | 259 class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded |
262 : public LayerTreeHostAnimationTest { | 260 : public LayerTreeHostAnimationTest { |
263 public: | 261 public: |
264 LayerTreeHostAnimationTestTickAnimationWhileBackgrounded() | 262 LayerTreeHostAnimationTestTickAnimationWhileBackgrounded() |
265 : num_animates_(0) {} | 263 : num_begin_frames_(0) {} |
266 | 264 |
267 virtual void BeginTest() OVERRIDE { | 265 virtual void BeginTest() OVERRIDE { |
268 PostAddLongAnimationToMainThread(layer_tree_host()->root_layer()); | 266 PostAddLongAnimationToMainThread(layer_tree_host()->root_layer()); |
269 } | 267 } |
270 | 268 |
271 // Use WillAnimateLayers to set visible false before the animation runs and | 269 // Use WillAnimateLayers to set visible false before the animation runs and |
272 // causes a commit, so we block the second visible animate in single-thread | 270 // causes a commit, so we block the second visible animate in single-thread |
273 // mode. | 271 // mode. |
274 virtual void WillAnimateLayers( | 272 virtual void WillAnimateLayers( |
275 LayerTreeHostImpl* host_impl, | 273 LayerTreeHostImpl* host_impl, |
276 base::TimeTicks monotonic_time) OVERRIDE { | 274 base::TimeTicks monotonic_time) OVERRIDE { |
277 // Verify that the host can draw, it's just not visible. | 275 // Verify that the host can draw, it's just not visible. |
278 EXPECT_TRUE(host_impl->CanDraw()); | 276 EXPECT_TRUE(host_impl->CanDraw()); |
279 if (num_animates_ < 2) { | 277 if (num_begin_frames_ < 2) { |
280 if (!num_animates_) { | 278 if (!num_begin_frames_) { |
281 // We have a long animation running. It should continue to tick even | 279 // We have a long animation running. It should continue to tick even |
282 // if we are not visible. | 280 // if we are not visible. |
283 PostSetVisibleToMainThread(false); | 281 PostSetVisibleToMainThread(false); |
284 } | 282 } |
285 num_animates_++; | 283 num_begin_frames_++; |
286 return; | 284 return; |
287 } | 285 } |
288 EndTest(); | 286 EndTest(); |
289 } | 287 } |
290 | 288 |
291 virtual void AfterTest() OVERRIDE {} | 289 virtual void AfterTest() OVERRIDE {} |
292 | 290 |
293 private: | 291 private: |
294 int num_animates_; | 292 int num_begin_frames_; |
295 }; | 293 }; |
296 | 294 |
297 SINGLE_AND_MULTI_THREAD_TEST_F( | 295 SINGLE_AND_MULTI_THREAD_TEST_F( |
298 LayerTreeHostAnimationTestTickAnimationWhileBackgrounded); | 296 LayerTreeHostAnimationTestTickAnimationWhileBackgrounded); |
299 | 297 |
300 // Ensures that animation time remains monotonic when we switch from foreground | 298 // Ensures that animation time remains monotonic when we switch from foreground |
301 // to background ticking and back, even if we're skipping draws due to | 299 // to background ticking and back, even if we're skipping draws due to |
302 // checkerboarding when in the foreground. | 300 // checkerboarding when in the foreground. |
303 class LayerTreeHostAnimationTestAnimationTickTimeIsMonotonic | 301 class LayerTreeHostAnimationTestAnimationTickTimeIsMonotonic |
304 : public LayerTreeHostAnimationTest { | 302 : public LayerTreeHostAnimationTest { |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 // animation frame. | 734 // animation frame. |
737 content_ = FakeContentLayer::Create(&client_); | 735 content_ = FakeContentLayer::Create(&client_); |
738 content_->set_always_update_resources(true); | 736 content_->set_always_update_resources(true); |
739 layer_tree_host()->root_layer()->AddChild(content_); | 737 layer_tree_host()->root_layer()->AddChild(content_); |
740 } | 738 } |
741 | 739 |
742 virtual void BeginTest() OVERRIDE { | 740 virtual void BeginTest() OVERRIDE { |
743 PostSetNeedsCommitToMainThread(); | 741 PostSetNeedsCommitToMainThread(); |
744 } | 742 } |
745 | 743 |
746 virtual void Animate(base::TimeTicks) OVERRIDE { | 744 virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE { |
747 if (num_draw_layers_ == 2) | 745 if (num_draw_layers_ == 2) |
748 return; | 746 return; |
749 layer_tree_host()->SetNeedsAnimate(); | 747 layer_tree_host()->SetNeedsAnimate(); |
750 } | 748 } |
751 | 749 |
752 virtual void Layout() OVERRIDE { | 750 virtual void Layout() OVERRIDE { |
753 layer_tree_host()->root_layer()->SetNeedsDisplay(); | 751 layer_tree_host()->root_layer()->SetNeedsDisplay(); |
754 } | 752 } |
755 | 753 |
756 virtual void CommitCompleteOnThread(LayerTreeHostImpl* tree_impl) OVERRIDE { | 754 virtual void CommitCompleteOnThread(LayerTreeHostImpl* tree_impl) OVERRIDE { |
(...skipping 18 matching lines...) Expand all Loading... |
775 FakeContentLayerClient client_; | 773 FakeContentLayerClient client_; |
776 scoped_refptr<FakeContentLayer> content_; | 774 scoped_refptr<FakeContentLayer> content_; |
777 }; | 775 }; |
778 | 776 |
779 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestContinuousAnimate); | 777 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestContinuousAnimate); |
780 | 778 |
781 class LayerTreeHostAnimationTestCancelAnimateCommit | 779 class LayerTreeHostAnimationTestCancelAnimateCommit |
782 : public LayerTreeHostAnimationTest { | 780 : public LayerTreeHostAnimationTest { |
783 public: | 781 public: |
784 LayerTreeHostAnimationTestCancelAnimateCommit() | 782 LayerTreeHostAnimationTestCancelAnimateCommit() |
785 : num_animate_calls_(0), num_commit_calls_(0), num_draw_calls_(0) {} | 783 : num_begin_frames_(0), num_commit_calls_(0), num_draw_calls_(0) {} |
786 | 784 |
787 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 785 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
788 | 786 |
789 virtual void Animate(base::TimeTicks) OVERRIDE { | 787 virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE { |
790 num_animate_calls_++; | 788 num_begin_frames_++; |
791 // No-op animate will cancel the commit. | 789 // No-op animate will cancel the commit. |
792 if (layer_tree_host()->source_frame_number() == 1) { | 790 if (layer_tree_host()->source_frame_number() == 1) { |
793 EndTest(); | 791 EndTest(); |
794 return; | 792 return; |
795 } | 793 } |
796 layer_tree_host()->SetNeedsAnimate(); | 794 layer_tree_host()->SetNeedsAnimate(); |
797 } | 795 } |
798 | 796 |
799 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 797 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
800 num_commit_calls_++; | 798 num_commit_calls_++; |
801 if (impl->active_tree()->source_frame_number() > 1) | 799 if (impl->active_tree()->source_frame_number() > 1) |
802 FAIL() << "Commit should have been canceled."; | 800 FAIL() << "Commit should have been canceled."; |
803 } | 801 } |
804 | 802 |
805 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 803 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
806 num_draw_calls_++; | 804 num_draw_calls_++; |
807 if (impl->active_tree()->source_frame_number() > 1) | 805 if (impl->active_tree()->source_frame_number() > 1) |
808 FAIL() << "Draw should have been canceled."; | 806 FAIL() << "Draw should have been canceled."; |
809 } | 807 } |
810 | 808 |
811 virtual void AfterTest() OVERRIDE { | 809 virtual void AfterTest() OVERRIDE { |
812 EXPECT_EQ(2, num_animate_calls_); | 810 EXPECT_EQ(2, num_begin_frames_); |
813 EXPECT_EQ(1, num_commit_calls_); | 811 EXPECT_EQ(1, num_commit_calls_); |
814 EXPECT_EQ(1, num_draw_calls_); | 812 EXPECT_EQ(1, num_draw_calls_); |
815 } | 813 } |
816 | 814 |
817 private: | 815 private: |
818 int num_animate_calls_; | 816 int num_begin_frames_; |
819 int num_commit_calls_; | 817 int num_commit_calls_; |
820 int num_draw_calls_; | 818 int num_draw_calls_; |
821 FakeContentLayerClient client_; | 819 FakeContentLayerClient client_; |
822 scoped_refptr<FakeContentLayer> content_; | 820 scoped_refptr<FakeContentLayer> content_; |
823 }; | 821 }; |
824 | 822 |
825 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestCancelAnimateCommit); | 823 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestCancelAnimateCommit); |
826 | 824 |
827 class LayerTreeHostAnimationTestForceRedraw | 825 class LayerTreeHostAnimationTestForceRedraw |
828 : public LayerTreeHostAnimationTest { | 826 : public LayerTreeHostAnimationTest { |
829 public: | 827 public: |
830 LayerTreeHostAnimationTestForceRedraw() | 828 LayerTreeHostAnimationTestForceRedraw() |
831 : num_animate_(0), num_draw_layers_(0) {} | 829 : num_animate_(0), num_draw_layers_(0) {} |
832 | 830 |
833 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 831 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
834 | 832 |
835 virtual void Animate(base::TimeTicks) OVERRIDE { | 833 virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE { |
836 if (++num_animate_ < 2) | 834 if (++num_animate_ < 2) |
837 layer_tree_host()->SetNeedsAnimate(); | 835 layer_tree_host()->SetNeedsAnimate(); |
838 } | 836 } |
839 | 837 |
840 virtual void Layout() OVERRIDE { | 838 virtual void Layout() OVERRIDE { |
841 layer_tree_host()->SetNextCommitForcesRedraw(); | 839 layer_tree_host()->SetNextCommitForcesRedraw(); |
842 } | 840 } |
843 | 841 |
844 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 842 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
845 if (++num_draw_layers_ == 2) | 843 if (++num_draw_layers_ == 2) |
(...skipping 15 matching lines...) Expand all Loading... |
861 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestForceRedraw); | 859 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestForceRedraw); |
862 | 860 |
863 class LayerTreeHostAnimationTestAnimateAfterSetNeedsCommit | 861 class LayerTreeHostAnimationTestAnimateAfterSetNeedsCommit |
864 : public LayerTreeHostAnimationTest { | 862 : public LayerTreeHostAnimationTest { |
865 public: | 863 public: |
866 LayerTreeHostAnimationTestAnimateAfterSetNeedsCommit() | 864 LayerTreeHostAnimationTestAnimateAfterSetNeedsCommit() |
867 : num_animate_(0), num_draw_layers_(0) {} | 865 : num_animate_(0), num_draw_layers_(0) {} |
868 | 866 |
869 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 867 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
870 | 868 |
871 virtual void Animate(base::TimeTicks) OVERRIDE { | 869 virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE { |
872 if (++num_animate_ <= 2) { | 870 if (++num_animate_ <= 2) { |
873 layer_tree_host()->SetNeedsCommit(); | 871 layer_tree_host()->SetNeedsCommit(); |
874 layer_tree_host()->SetNeedsAnimate(); | 872 layer_tree_host()->SetNeedsAnimate(); |
875 } | 873 } |
876 } | 874 } |
877 | 875 |
878 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 876 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
879 if (++num_draw_layers_ == 2) | 877 if (++num_draw_layers_ == 2) |
880 EndTest(); | 878 EndTest(); |
881 } | 879 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 1139 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
1142 // Make sure that drawing many times doesn't cause a checkerboarded | 1140 // Make sure that drawing many times doesn't cause a checkerboarded |
1143 // animation to start so we avoid flake in this test. | 1141 // animation to start so we avoid flake in this test. |
1144 settings->timeout_and_draw_when_animation_checkerboards = false; | 1142 settings->timeout_and_draw_when_animation_checkerboards = false; |
1145 } | 1143 } |
1146 | 1144 |
1147 virtual void BeginTest() OVERRIDE { | 1145 virtual void BeginTest() OVERRIDE { |
1148 PostAddAnimationToMainThread(layer_tree_host()->root_layer()); | 1146 PostAddAnimationToMainThread(layer_tree_host()->root_layer()); |
1149 } | 1147 } |
1150 | 1148 |
1151 virtual void Animate(base::TimeTicks monotonic_time) OVERRIDE { | 1149 virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE { |
1152 last_main_thread_tick_time_ = monotonic_time; | 1150 last_main_thread_tick_time_ = args.frame_time; |
1153 } | 1151 } |
1154 | 1152 |
1155 virtual void AnimateLayers(LayerTreeHostImpl* host_impl, | 1153 virtual void AnimateLayers(LayerTreeHostImpl* host_impl, |
1156 base::TimeTicks monotonic_time) OVERRIDE { | 1154 base::TimeTicks monotonic_time) OVERRIDE { |
1157 if (TestEnded()) | 1155 if (TestEnded()) |
1158 return; | 1156 return; |
1159 if (!started_animating_) { | 1157 if (!started_animating_) { |
1160 started_animating_ = true; | 1158 started_animating_ = true; |
1161 expected_impl_tick_time_ = monotonic_time; | 1159 expected_impl_tick_time_ = monotonic_time; |
1162 } else { | 1160 } else { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 private: | 1340 private: |
1343 scoped_refptr<Layer> content_; | 1341 scoped_refptr<Layer> content_; |
1344 int num_swap_buffers_; | 1342 int num_swap_buffers_; |
1345 }; | 1343 }; |
1346 | 1344 |
1347 SINGLE_AND_MULTI_THREAD_TEST_F( | 1345 SINGLE_AND_MULTI_THREAD_TEST_F( |
1348 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1346 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
1349 | 1347 |
1350 } // namespace | 1348 } // namespace |
1351 } // namespace cc | 1349 } // namespace cc |
OLD | NEW |