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