| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 update_animation_state_was_called_ = true; | 123 update_animation_state_was_called_ = true; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void NotifyAnimationStarted(base::TimeTicks monotonic_time, | 126 void NotifyAnimationStarted(base::TimeTicks monotonic_time, |
| 127 Animation::TargetProperty target_property, | 127 Animation::TargetProperty target_property, |
| 128 int group) override { | 128 int group) override { |
| 129 EXPECT_LT(base::TimeTicks(), monotonic_time); | 129 EXPECT_LT(base::TimeTicks(), monotonic_time); |
| 130 | 130 |
| 131 LayerAnimationController* controller = | 131 LayerAnimationController* controller = |
| 132 layer_tree_host()->root_layer()->layer_animation_controller(); | 132 layer_tree_host()->root_layer()->layer_animation_controller(); |
| 133 Animation* animation = controller->GetAnimation(Animation::OPACITY); | 133 Animation* animation = controller->GetAnimation(Animation::Opacity); |
| 134 if (animation) | 134 if (animation) |
| 135 controller->RemoveAnimation(animation->id()); | 135 controller->RemoveAnimation(animation->id()); |
| 136 | 136 |
| 137 EndTest(); | 137 EndTest(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void AfterTest() override { EXPECT_TRUE(update_animation_state_was_called_); } | 140 void AfterTest() override { EXPECT_TRUE(update_animation_state_was_called_); } |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 bool update_animation_state_was_called_; | 143 bool update_animation_state_was_called_; |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 layer_tree_host()->root_layer()->AddChild(content_); | 464 layer_tree_host()->root_layer()->AddChild(content_); |
| 465 } | 465 } |
| 466 | 466 |
| 467 void BeginTest() override { PostAddAnimationToMainThread(content_.get()); } | 467 void BeginTest() override { PostAddAnimationToMainThread(content_.get()); } |
| 468 | 468 |
| 469 void AnimateLayers(LayerTreeHostImpl* host_impl, | 469 void AnimateLayers(LayerTreeHostImpl* host_impl, |
| 470 base::TimeTicks monotonic_time) override { | 470 base::TimeTicks monotonic_time) override { |
| 471 LayerAnimationController* controller_impl = | 471 LayerAnimationController* controller_impl = |
| 472 host_impl->active_tree()->root_layer()->children()[0]-> | 472 host_impl->active_tree()->root_layer()->children()[0]-> |
| 473 layer_animation_controller(); | 473 layer_animation_controller(); |
| 474 Animation* animation = controller_impl->GetAnimation(Animation::OPACITY); | 474 Animation* animation = |
| 475 controller_impl->GetAnimation(Animation::Opacity); |
| 475 if (!animation) | 476 if (!animation) |
| 476 return; | 477 return; |
| 477 | 478 |
| 478 const FloatAnimationCurve* curve = | 479 const FloatAnimationCurve* curve = |
| 479 animation->curve()->ToFloatAnimationCurve(); | 480 animation->curve()->ToFloatAnimationCurve(); |
| 480 float start_opacity = curve->GetValue(base::TimeDelta()); | 481 float start_opacity = curve->GetValue(base::TimeDelta()); |
| 481 float end_opacity = curve->GetValue(curve->Duration()); | 482 float end_opacity = curve->GetValue(curve->Duration()); |
| 482 float linearly_interpolated_opacity = | 483 float linearly_interpolated_opacity = |
| 483 0.25f * end_opacity + 0.75f * start_opacity; | 484 0.25f * end_opacity + 0.75f * start_opacity; |
| 484 base::TimeDelta time = TimeUtil::Scale(curve->Duration(), 0.25f); | 485 base::TimeDelta time = TimeUtil::Scale(curve->Duration(), 0.25f); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 515 } | 516 } |
| 516 | 517 |
| 517 void BeginTest() override { PostAddAnimationToMainThread(content_.get()); } | 518 void BeginTest() override { PostAddAnimationToMainThread(content_.get()); } |
| 518 | 519 |
| 519 void NotifyAnimationStarted(base::TimeTicks monotonic_time, | 520 void NotifyAnimationStarted(base::TimeTicks monotonic_time, |
| 520 Animation::TargetProperty target_property, | 521 Animation::TargetProperty target_property, |
| 521 int group) override { | 522 int group) override { |
| 522 LayerAnimationController* controller = | 523 LayerAnimationController* controller = |
| 523 layer_tree_host()->root_layer()->children()[0]-> | 524 layer_tree_host()->root_layer()->children()[0]-> |
| 524 layer_animation_controller(); | 525 layer_animation_controller(); |
| 525 Animation* animation = controller->GetAnimation(Animation::OPACITY); | 526 Animation* animation = |
| 527 controller->GetAnimation(Animation::Opacity); |
| 526 main_start_time_ = animation->start_time(); | 528 main_start_time_ = animation->start_time(); |
| 527 controller->RemoveAnimation(animation->id()); | 529 controller->RemoveAnimation(animation->id()); |
| 528 EndTest(); | 530 EndTest(); |
| 529 } | 531 } |
| 530 | 532 |
| 531 void UpdateAnimationState(LayerTreeHostImpl* impl_host, | 533 void UpdateAnimationState(LayerTreeHostImpl* impl_host, |
| 532 bool has_unfinished_animation) override { | 534 bool has_unfinished_animation) override { |
| 533 LayerAnimationController* controller = | 535 LayerAnimationController* controller = |
| 534 impl_host->active_tree()->root_layer()->children()[0]-> | 536 impl_host->active_tree()->root_layer()->children()[0]-> |
| 535 layer_animation_controller(); | 537 layer_animation_controller(); |
| 536 Animation* animation = controller->GetAnimation(Animation::OPACITY); | 538 Animation* animation = |
| 539 controller->GetAnimation(Animation::Opacity); |
| 537 if (!animation) | 540 if (!animation) |
| 538 return; | 541 return; |
| 539 | 542 |
| 540 impl_start_time_ = animation->start_time(); | 543 impl_start_time_ = animation->start_time(); |
| 541 } | 544 } |
| 542 | 545 |
| 543 void AfterTest() override { | 546 void AfterTest() override { |
| 544 EXPECT_EQ(impl_start_time_, main_start_time_); | 547 EXPECT_EQ(impl_start_time_, main_start_time_); |
| 545 EXPECT_LT(base::TimeTicks(), impl_start_time_); | 548 EXPECT_LT(base::TimeTicks(), impl_start_time_); |
| 546 } | 549 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 563 | 566 |
| 564 void BeginTest() override { | 567 void BeginTest() override { |
| 565 PostAddInstantAnimationToMainThread(layer_tree_host()->root_layer()); | 568 PostAddInstantAnimationToMainThread(layer_tree_host()->root_layer()); |
| 566 } | 569 } |
| 567 | 570 |
| 568 void NotifyAnimationFinished(base::TimeTicks monotonic_time, | 571 void NotifyAnimationFinished(base::TimeTicks monotonic_time, |
| 569 Animation::TargetProperty target_property, | 572 Animation::TargetProperty target_property, |
| 570 int group) override { | 573 int group) override { |
| 571 LayerAnimationController* controller = | 574 LayerAnimationController* controller = |
| 572 layer_tree_host()->root_layer()->layer_animation_controller(); | 575 layer_tree_host()->root_layer()->layer_animation_controller(); |
| 573 Animation* animation = controller->GetAnimation(Animation::OPACITY); | 576 Animation* animation = |
| 577 controller->GetAnimation(Animation::Opacity); |
| 574 if (animation) | 578 if (animation) |
| 575 controller->RemoveAnimation(animation->id()); | 579 controller->RemoveAnimation(animation->id()); |
| 576 EndTest(); | 580 EndTest(); |
| 577 } | 581 } |
| 578 | 582 |
| 579 void AfterTest() override {} | 583 void AfterTest() override {} |
| 580 }; | 584 }; |
| 581 | 585 |
| 582 SINGLE_AND_MULTI_THREAD_TEST_F( | 586 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 583 LayerTreeHostAnimationTestAnimationFinishedEvents); | 587 LayerTreeHostAnimationTestAnimationFinishedEvents); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 598 } | 602 } |
| 599 | 603 |
| 600 void BeginTest() override { | 604 void BeginTest() override { |
| 601 PostAddAnimationToMainThread(update_check_layer_.get()); | 605 PostAddAnimationToMainThread(update_check_layer_.get()); |
| 602 } | 606 } |
| 603 | 607 |
| 604 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 608 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| 605 LayerAnimationController* controller_impl = | 609 LayerAnimationController* controller_impl = |
| 606 host_impl->active_tree()->root_layer()->layer_animation_controller(); | 610 host_impl->active_tree()->root_layer()->layer_animation_controller(); |
| 607 Animation* animation_impl = | 611 Animation* animation_impl = |
| 608 controller_impl->GetAnimation(Animation::OPACITY); | 612 controller_impl->GetAnimation(Animation::Opacity); |
| 609 controller_impl->RemoveAnimation(animation_impl->id()); | 613 controller_impl->RemoveAnimation(animation_impl->id()); |
| 610 EndTest(); | 614 EndTest(); |
| 611 } | 615 } |
| 612 | 616 |
| 613 void AfterTest() override { | 617 void AfterTest() override { |
| 614 // Update() should have been called once, proving that the layer was not | 618 // Update() should have been called once, proving that the layer was not |
| 615 // skipped. | 619 // skipped. |
| 616 EXPECT_EQ(1u, update_check_layer_->update_count()); | 620 EXPECT_EQ(1u, update_check_layer_->update_count()); |
| 617 | 621 |
| 618 // clear update_check_layer_ so LayerTreeHost dies. | 622 // clear update_check_layer_ so LayerTreeHost dies. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 637 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 641 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 638 | 642 |
| 639 void DidCommit() override { | 643 void DidCommit() override { |
| 640 if (layer_tree_host()->source_frame_number() == 1) { | 644 if (layer_tree_host()->source_frame_number() == 1) { |
| 641 scoped_refptr<Layer> layer = Layer::Create(); | 645 scoped_refptr<Layer> layer = Layer::Create(); |
| 642 layer->set_layer_animation_delegate(this); | 646 layer->set_layer_animation_delegate(this); |
| 643 | 647 |
| 644 // Any valid AnimationCurve will do here. | 648 // Any valid AnimationCurve will do here. |
| 645 scoped_ptr<AnimationCurve> curve(new FakeFloatAnimationCurve()); | 649 scoped_ptr<AnimationCurve> curve(new FakeFloatAnimationCurve()); |
| 646 scoped_ptr<Animation> animation( | 650 scoped_ptr<Animation> animation( |
| 647 Animation::Create(curve.Pass(), 1, 1, Animation::OPACITY)); | 651 Animation::Create(curve.Pass(), 1, 1, |
| 652 Animation::Opacity)); |
| 648 layer->layer_animation_controller()->AddAnimation(animation.Pass()); | 653 layer->layer_animation_controller()->AddAnimation(animation.Pass()); |
| 649 | 654 |
| 650 // We add the animation *before* attaching the layer to the tree. | 655 // We add the animation *before* attaching the layer to the tree. |
| 651 layer_tree_host()->root_layer()->AddChild(layer); | 656 layer_tree_host()->root_layer()->AddChild(layer); |
| 652 } | 657 } |
| 653 } | 658 } |
| 654 | 659 |
| 655 void AnimateLayers(LayerTreeHostImpl* impl_host, | 660 void AnimateLayers(LayerTreeHostImpl* impl_host, |
| 656 base::TimeTicks monotonic_time) override { | 661 base::TimeTicks monotonic_time) override { |
| 657 EndTest(); | 662 EndTest(); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 979 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 975 | 980 |
| 976 void DidCommit() override { | 981 void DidCommit() override { |
| 977 switch (layer_tree_host()->source_frame_number()) { | 982 switch (layer_tree_host()->source_frame_number()) { |
| 978 case 1: { | 983 case 1: { |
| 979 scoped_ptr<ScrollOffsetAnimationCurve> curve( | 984 scoped_ptr<ScrollOffsetAnimationCurve> curve( |
| 980 ScrollOffsetAnimationCurve::Create( | 985 ScrollOffsetAnimationCurve::Create( |
| 981 gfx::ScrollOffset(500.f, 550.f), | 986 gfx::ScrollOffset(500.f, 550.f), |
| 982 EaseInOutTimingFunction::Create())); | 987 EaseInOutTimingFunction::Create())); |
| 983 scoped_ptr<Animation> animation( | 988 scoped_ptr<Animation> animation( |
| 984 Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET)); | 989 Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset)); |
| 985 animation->set_needs_synchronized_start_time(true); | 990 animation->set_needs_synchronized_start_time(true); |
| 986 bool animation_added = scroll_layer_->AddAnimation(animation.Pass()); | 991 bool animation_added = scroll_layer_->AddAnimation(animation.Pass()); |
| 987 bool impl_scrolling_supported = | 992 bool impl_scrolling_supported = |
| 988 layer_tree_host()->proxy()->SupportsImplScrolling(); | 993 layer_tree_host()->proxy()->SupportsImplScrolling(); |
| 989 EXPECT_EQ(impl_scrolling_supported, animation_added); | 994 EXPECT_EQ(impl_scrolling_supported, animation_added); |
| 990 if (!impl_scrolling_supported) | 995 if (!impl_scrolling_supported) |
| 991 EndTest(); | 996 EndTest(); |
| 992 break; | 997 break; |
| 993 } | 998 } |
| 994 default: | 999 default: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1024 scroll_layer_ = FakeContentLayer::Create(&client_); | 1029 scroll_layer_ = FakeContentLayer::Create(&client_); |
| 1025 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); | 1030 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); |
| 1026 scroll_layer_->SetBounds(gfx::Size(10000, 10000)); | 1031 scroll_layer_->SetBounds(gfx::Size(10000, 10000)); |
| 1027 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); | 1032 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); |
| 1028 layer_tree_host()->root_layer()->AddChild(scroll_layer_); | 1033 layer_tree_host()->root_layer()->AddChild(scroll_layer_); |
| 1029 | 1034 |
| 1030 scoped_ptr<ScrollOffsetAnimationCurve> curve( | 1035 scoped_ptr<ScrollOffsetAnimationCurve> curve( |
| 1031 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f), | 1036 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f), |
| 1032 EaseInOutTimingFunction::Create())); | 1037 EaseInOutTimingFunction::Create())); |
| 1033 scoped_ptr<Animation> animation( | 1038 scoped_ptr<Animation> animation( |
| 1034 Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET)); | 1039 Animation::Create(curve.Pass(), 1, 0, Animation::ScrollOffset)); |
| 1035 animation->set_needs_synchronized_start_time(true); | 1040 animation->set_needs_synchronized_start_time(true); |
| 1036 scroll_layer_->AddAnimation(animation.Pass()); | 1041 scroll_layer_->AddAnimation(animation.Pass()); |
| 1037 } | 1042 } |
| 1038 | 1043 |
| 1039 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1044 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1040 | 1045 |
| 1041 void BeginMainFrame(const BeginFrameArgs& args) override { | 1046 void BeginMainFrame(const BeginFrameArgs& args) override { |
| 1042 switch (layer_tree_host()->source_frame_number()) { | 1047 switch (layer_tree_host()->source_frame_number()) { |
| 1043 case 0: | 1048 case 0: |
| 1044 break; | 1049 break; |
| 1045 case 1: { | 1050 case 1: { |
| 1046 Animation* animation = | 1051 Animation* animation = |
| 1047 scroll_layer_->layer_animation_controller()->GetAnimation( | 1052 scroll_layer_->layer_animation_controller()->GetAnimation( |
| 1048 Animation::SCROLL_OFFSET); | 1053 Animation::ScrollOffset); |
| 1049 scroll_layer_->layer_animation_controller()->RemoveAnimation( | 1054 scroll_layer_->layer_animation_controller()->RemoveAnimation( |
| 1050 animation->id()); | 1055 animation->id()); |
| 1051 scroll_layer_->SetScrollOffset(final_postion_); | 1056 scroll_layer_->SetScrollOffset(final_postion_); |
| 1052 break; | 1057 break; |
| 1053 } | 1058 } |
| 1054 default: | 1059 default: |
| 1055 EXPECT_EQ(final_postion_, scroll_layer_->scroll_offset()); | 1060 EXPECT_EQ(final_postion_, scroll_layer_->scroll_offset()); |
| 1056 } | 1061 } |
| 1057 } | 1062 } |
| 1058 | 1063 |
| 1059 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { | 1064 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { |
| 1060 if (host_impl->settings().impl_side_painting) | 1065 if (host_impl->settings().impl_side_painting) |
| 1061 host_impl->BlockNotifyReadyToActivateForTesting(true); | 1066 host_impl->BlockNotifyReadyToActivateForTesting(true); |
| 1062 } | 1067 } |
| 1063 | 1068 |
| 1064 void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, | 1069 void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, |
| 1065 const BeginFrameArgs& args) override { | 1070 const BeginFrameArgs& args) override { |
| 1066 if (!host_impl->pending_tree()) | 1071 if (!host_impl->pending_tree()) |
| 1067 return; | 1072 return; |
| 1068 | 1073 |
| 1069 if (!host_impl->active_tree()->root_layer()) { | 1074 if (!host_impl->active_tree()->root_layer()) { |
| 1070 host_impl->BlockNotifyReadyToActivateForTesting(false); | 1075 host_impl->BlockNotifyReadyToActivateForTesting(false); |
| 1071 return; | 1076 return; |
| 1072 } | 1077 } |
| 1073 | 1078 |
| 1074 LayerImpl* scroll_layer_impl = | 1079 LayerImpl* scroll_layer_impl = |
| 1075 host_impl->active_tree()->root_layer()->children()[0]; | 1080 host_impl->active_tree()->root_layer()->children()[0]; |
| 1076 Animation* animation = | 1081 Animation* animation = |
| 1077 scroll_layer_impl->layer_animation_controller()->GetAnimation( | 1082 scroll_layer_impl->layer_animation_controller()->GetAnimation( |
| 1078 Animation::SCROLL_OFFSET); | 1083 Animation::ScrollOffset); |
| 1079 | 1084 |
| 1080 if (!animation || animation->run_state() != Animation::RUNNING) { | 1085 if (!animation || animation->run_state() != Animation::Running) { |
| 1081 host_impl->BlockNotifyReadyToActivateForTesting(false); | 1086 host_impl->BlockNotifyReadyToActivateForTesting(false); |
| 1082 return; | 1087 return; |
| 1083 } | 1088 } |
| 1084 | 1089 |
| 1085 // Block activation until the running animation has a chance to produce a | 1090 // Block activation until the running animation has a chance to produce a |
| 1086 // scroll delta. | 1091 // scroll delta. |
| 1087 gfx::Vector2dF scroll_delta = scroll_layer_impl->ScrollDelta(); | 1092 gfx::Vector2dF scroll_delta = scroll_layer_impl->ScrollDelta(); |
| 1088 if (scroll_delta.x() < 1.f || scroll_delta.y() < 1.f) | 1093 if (scroll_delta.x() < 1.f || scroll_delta.y() < 1.f) |
| 1089 return; | 1094 return; |
| 1090 | 1095 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 host_impl->settings().impl_side_painting) { | 1180 host_impl->settings().impl_side_painting) { |
| 1176 host_impl->BlockNotifyReadyToActivateForTesting(false); | 1181 host_impl->BlockNotifyReadyToActivateForTesting(false); |
| 1177 } | 1182 } |
| 1178 } | 1183 } |
| 1179 | 1184 |
| 1180 void UpdateAnimationState(LayerTreeHostImpl* host_impl, | 1185 void UpdateAnimationState(LayerTreeHostImpl* host_impl, |
| 1181 bool has_unfinished_animation) override { | 1186 bool has_unfinished_animation) override { |
| 1182 LayerAnimationController* root_controller_impl = | 1187 LayerAnimationController* root_controller_impl = |
| 1183 host_impl->active_tree()->root_layer()->layer_animation_controller(); | 1188 host_impl->active_tree()->root_layer()->layer_animation_controller(); |
| 1184 Animation* root_animation = | 1189 Animation* root_animation = |
| 1185 root_controller_impl->GetAnimation(Animation::OPACITY); | 1190 root_controller_impl->GetAnimation(Animation::Opacity); |
| 1186 if (!root_animation || root_animation->run_state() != Animation::RUNNING) | 1191 if (!root_animation || root_animation->run_state() != Animation::Running) |
| 1187 return; | 1192 return; |
| 1188 | 1193 |
| 1189 LayerAnimationController* child_controller_impl = | 1194 LayerAnimationController* child_controller_impl = |
| 1190 host_impl->active_tree()->root_layer()->children() | 1195 host_impl->active_tree()->root_layer()->children() |
| 1191 [0]->layer_animation_controller(); | 1196 [0]->layer_animation_controller(); |
| 1192 Animation* child_animation = | 1197 Animation* child_animation = |
| 1193 child_controller_impl->GetAnimation(Animation::OPACITY); | 1198 child_controller_impl->GetAnimation(Animation::Opacity); |
| 1194 EXPECT_EQ(Animation::RUNNING, child_animation->run_state()); | 1199 EXPECT_EQ(Animation::Running, child_animation->run_state()); |
| 1195 EXPECT_EQ(root_animation->start_time(), child_animation->start_time()); | 1200 EXPECT_EQ(root_animation->start_time(), child_animation->start_time()); |
| 1196 root_controller_impl->AbortAnimations(Animation::OPACITY); | 1201 root_controller_impl->AbortAnimations(Animation::Opacity); |
| 1197 root_controller_impl->AbortAnimations(Animation::TRANSFORM); | 1202 root_controller_impl->AbortAnimations(Animation::Transform); |
| 1198 child_controller_impl->AbortAnimations(Animation::OPACITY); | 1203 child_controller_impl->AbortAnimations(Animation::Opacity); |
| 1199 EndTest(); | 1204 EndTest(); |
| 1200 } | 1205 } |
| 1201 | 1206 |
| 1202 void AfterTest() override {} | 1207 void AfterTest() override {} |
| 1203 | 1208 |
| 1204 private: | 1209 private: |
| 1205 int frame_count_with_pending_tree_; | 1210 int frame_count_with_pending_tree_; |
| 1206 }; | 1211 }; |
| 1207 | 1212 |
| 1208 SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F( | 1213 SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 host_impl->animation_registrar()->active_animation_controllers(); | 1250 host_impl->animation_registrar()->active_animation_controllers(); |
| 1246 if (copy.size() == 2u) { | 1251 if (copy.size() == 2u) { |
| 1247 EndTest(); | 1252 EndTest(); |
| 1248 EXPECT_GE(num_swap_buffers_, 3); | 1253 EXPECT_GE(num_swap_buffers_, 3); |
| 1249 for (AnimationRegistrar::AnimationControllerMap::iterator iter = | 1254 for (AnimationRegistrar::AnimationControllerMap::iterator iter = |
| 1250 copy.begin(); | 1255 copy.begin(); |
| 1251 iter != copy.end(); | 1256 iter != copy.end(); |
| 1252 ++iter) { | 1257 ++iter) { |
| 1253 int id = ((*iter).second->id()); | 1258 int id = ((*iter).second->id()); |
| 1254 if (id == host_impl->RootLayer()->id()) { | 1259 if (id == host_impl->RootLayer()->id()) { |
| 1255 Animation* anim = (*iter).second->GetAnimation(Animation::TRANSFORM); | 1260 Animation* anim = (*iter).second->GetAnimation(Animation::Transform); |
| 1256 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); | 1261 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); |
| 1257 } else if (id == host_impl->RootLayer()->children()[0]->id()) { | 1262 } else if (id == host_impl->RootLayer()->children()[0]->id()) { |
| 1258 Animation* anim = (*iter).second->GetAnimation(Animation::OPACITY); | 1263 Animation* anim = (*iter).second->GetAnimation(Animation::Opacity); |
| 1259 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); | 1264 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); |
| 1260 } | 1265 } |
| 1261 } | 1266 } |
| 1262 } | 1267 } |
| 1263 } | 1268 } |
| 1264 | 1269 |
| 1265 void AfterTest() override {} | 1270 void AfterTest() override {} |
| 1266 | 1271 |
| 1267 private: | 1272 private: |
| 1268 scoped_refptr<Layer> content_; | 1273 scoped_refptr<Layer> content_; |
| 1269 int num_swap_buffers_; | 1274 int num_swap_buffers_; |
| 1270 }; | 1275 }; |
| 1271 | 1276 |
| 1272 SINGLE_AND_MULTI_THREAD_TEST_F( | 1277 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1273 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1278 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
| 1274 | 1279 |
| 1275 } // namespace | 1280 } // namespace |
| 1276 } // namespace cc | 1281 } // namespace cc |
| OLD | NEW |