| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 virtual void AfterTest() OVERRIDE {} | 717 virtual void AfterTest() OVERRIDE {} |
| 720 }; | 718 }; |
| 721 | 719 |
| 722 SINGLE_AND_MULTI_THREAD_TEST_F( | 720 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 723 LayerTreeHostAnimationTestLayerAddedWithAnimation); | 721 LayerTreeHostAnimationTestLayerAddedWithAnimation); |
| 724 | 722 |
| 725 class LayerTreeHostAnimationTestCancelAnimateCommit | 723 class LayerTreeHostAnimationTestCancelAnimateCommit |
| 726 : public LayerTreeHostAnimationTest { | 724 : public LayerTreeHostAnimationTest { |
| 727 public: | 725 public: |
| 728 LayerTreeHostAnimationTestCancelAnimateCommit() | 726 LayerTreeHostAnimationTestCancelAnimateCommit() |
| 729 : num_animate_calls_(0), num_commit_calls_(0), num_draw_calls_(0) {} | 727 : num_begin_frames_(0), num_commit_calls_(0), num_draw_calls_(0) {} |
| 730 | 728 |
| 731 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 729 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 732 | 730 |
| 733 virtual void Animate(base::TimeTicks) OVERRIDE { | 731 virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE { |
| 734 num_animate_calls_++; | 732 num_begin_frames_++; |
| 735 // No-op animate will cancel the commit. | 733 // No-op animate will cancel the commit. |
| 736 if (layer_tree_host()->source_frame_number() == 1) { | 734 if (layer_tree_host()->source_frame_number() == 1) { |
| 737 EndTest(); | 735 EndTest(); |
| 738 return; | 736 return; |
| 739 } | 737 } |
| 740 layer_tree_host()->SetNeedsAnimate(); | 738 layer_tree_host()->SetNeedsAnimate(); |
| 741 } | 739 } |
| 742 | 740 |
| 743 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 741 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 744 num_commit_calls_++; | 742 num_commit_calls_++; |
| 745 if (impl->active_tree()->source_frame_number() > 1) | 743 if (impl->active_tree()->source_frame_number() > 1) |
| 746 FAIL() << "Commit should have been canceled."; | 744 FAIL() << "Commit should have been canceled."; |
| 747 } | 745 } |
| 748 | 746 |
| 749 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 747 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 750 num_draw_calls_++; | 748 num_draw_calls_++; |
| 751 if (impl->active_tree()->source_frame_number() > 1) | 749 if (impl->active_tree()->source_frame_number() > 1) |
| 752 FAIL() << "Draw should have been canceled."; | 750 FAIL() << "Draw should have been canceled."; |
| 753 } | 751 } |
| 754 | 752 |
| 755 virtual void AfterTest() OVERRIDE { | 753 virtual void AfterTest() OVERRIDE { |
| 756 EXPECT_EQ(2, num_animate_calls_); | 754 EXPECT_EQ(2, num_begin_frames_); |
| 757 EXPECT_EQ(1, num_commit_calls_); | 755 EXPECT_EQ(1, num_commit_calls_); |
| 758 EXPECT_EQ(1, num_draw_calls_); | 756 EXPECT_EQ(1, num_draw_calls_); |
| 759 } | 757 } |
| 760 | 758 |
| 761 private: | 759 private: |
| 762 int num_animate_calls_; | 760 int num_begin_frames_; |
| 763 int num_commit_calls_; | 761 int num_commit_calls_; |
| 764 int num_draw_calls_; | 762 int num_draw_calls_; |
| 765 FakeContentLayerClient client_; | 763 FakeContentLayerClient client_; |
| 766 scoped_refptr<FakeContentLayer> content_; | 764 scoped_refptr<FakeContentLayer> content_; |
| 767 }; | 765 }; |
| 768 | 766 |
| 769 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestCancelAnimateCommit); | 767 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestCancelAnimateCommit); |
| 770 | 768 |
| 771 class LayerTreeHostAnimationTestForceRedraw | 769 class LayerTreeHostAnimationTestForceRedraw |
| 772 : public LayerTreeHostAnimationTest { | 770 : public LayerTreeHostAnimationTest { |
| 773 public: | 771 public: |
| 774 LayerTreeHostAnimationTestForceRedraw() | 772 LayerTreeHostAnimationTestForceRedraw() |
| 775 : num_animate_(0), num_draw_layers_(0) {} | 773 : num_animate_(0), num_draw_layers_(0) {} |
| 776 | 774 |
| 777 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 775 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 778 | 776 |
| 779 virtual void Animate(base::TimeTicks) OVERRIDE { | 777 virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE { |
| 780 if (++num_animate_ < 2) | 778 if (++num_animate_ < 2) |
| 781 layer_tree_host()->SetNeedsAnimate(); | 779 layer_tree_host()->SetNeedsAnimate(); |
| 782 } | 780 } |
| 783 | 781 |
| 784 virtual void Layout() OVERRIDE { | 782 virtual void Layout() OVERRIDE { |
| 785 layer_tree_host()->SetNextCommitForcesRedraw(); | 783 layer_tree_host()->SetNextCommitForcesRedraw(); |
| 786 } | 784 } |
| 787 | 785 |
| 788 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 786 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 789 if (++num_draw_layers_ == 2) | 787 if (++num_draw_layers_ == 2) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 805 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestForceRedraw); | 803 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestForceRedraw); |
| 806 | 804 |
| 807 class LayerTreeHostAnimationTestAnimateAfterSetNeedsCommit | 805 class LayerTreeHostAnimationTestAnimateAfterSetNeedsCommit |
| 808 : public LayerTreeHostAnimationTest { | 806 : public LayerTreeHostAnimationTest { |
| 809 public: | 807 public: |
| 810 LayerTreeHostAnimationTestAnimateAfterSetNeedsCommit() | 808 LayerTreeHostAnimationTestAnimateAfterSetNeedsCommit() |
| 811 : num_animate_(0), num_draw_layers_(0) {} | 809 : num_animate_(0), num_draw_layers_(0) {} |
| 812 | 810 |
| 813 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 811 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 814 | 812 |
| 815 virtual void Animate(base::TimeTicks) OVERRIDE { | 813 virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE { |
| 816 if (++num_animate_ <= 2) { | 814 if (++num_animate_ <= 2) { |
| 817 layer_tree_host()->SetNeedsCommit(); | 815 layer_tree_host()->SetNeedsCommit(); |
| 818 layer_tree_host()->SetNeedsAnimate(); | 816 layer_tree_host()->SetNeedsAnimate(); |
| 819 } | 817 } |
| 820 } | 818 } |
| 821 | 819 |
| 822 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 820 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 823 if (++num_draw_layers_ == 2) | 821 if (++num_draw_layers_ == 2) |
| 824 EndTest(); | 822 EndTest(); |
| 825 } | 823 } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 1083 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| 1086 // Make sure that drawing many times doesn't cause a checkerboarded | 1084 // Make sure that drawing many times doesn't cause a checkerboarded |
| 1087 // animation to start so we avoid flake in this test. | 1085 // animation to start so we avoid flake in this test. |
| 1088 settings->timeout_and_draw_when_animation_checkerboards = false; | 1086 settings->timeout_and_draw_when_animation_checkerboards = false; |
| 1089 } | 1087 } |
| 1090 | 1088 |
| 1091 virtual void BeginTest() OVERRIDE { | 1089 virtual void BeginTest() OVERRIDE { |
| 1092 PostAddAnimationToMainThread(layer_tree_host()->root_layer()); | 1090 PostAddAnimationToMainThread(layer_tree_host()->root_layer()); |
| 1093 } | 1091 } |
| 1094 | 1092 |
| 1095 virtual void Animate(base::TimeTicks monotonic_time) OVERRIDE { | 1093 virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE { |
| 1096 last_main_thread_tick_time_ = monotonic_time; | 1094 last_main_thread_tick_time_ = args.frame_time; |
| 1097 } | 1095 } |
| 1098 | 1096 |
| 1099 virtual void AnimateLayers(LayerTreeHostImpl* host_impl, | 1097 virtual void AnimateLayers(LayerTreeHostImpl* host_impl, |
| 1100 base::TimeTicks monotonic_time) OVERRIDE { | 1098 base::TimeTicks monotonic_time) OVERRIDE { |
| 1101 if (TestEnded()) | 1099 if (TestEnded()) |
| 1102 return; | 1100 return; |
| 1103 if (!started_animating_) { | 1101 if (!started_animating_) { |
| 1104 started_animating_ = true; | 1102 started_animating_ = true; |
| 1105 expected_impl_tick_time_ = monotonic_time; | 1103 expected_impl_tick_time_ = monotonic_time; |
| 1106 } else { | 1104 } else { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 private: | 1284 private: |
| 1287 scoped_refptr<Layer> content_; | 1285 scoped_refptr<Layer> content_; |
| 1288 int num_swap_buffers_; | 1286 int num_swap_buffers_; |
| 1289 }; | 1287 }; |
| 1290 | 1288 |
| 1291 SINGLE_AND_MULTI_THREAD_TEST_F( | 1289 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1292 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1290 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
| 1293 | 1291 |
| 1294 } // namespace | 1292 } // namespace |
| 1295 } // namespace cc | 1293 } // namespace cc |
| OLD | NEW |