| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/compositor/layer_animator.h" | 5 #include "ui/compositor/layer_animator.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "cc/animation/animation_events.h" | |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/compositor/layer.h" | 14 #include "ui/compositor/layer.h" |
| 16 #include "ui/compositor/layer_animation_delegate.h" | 15 #include "ui/compositor/layer_animation_delegate.h" |
| 17 #include "ui/compositor/layer_animation_element.h" | 16 #include "ui/compositor/layer_animation_element.h" |
| 18 #include "ui/compositor/layer_animation_sequence.h" | 17 #include "ui/compositor/layer_animation_sequence.h" |
| 19 #include "ui/compositor/layer_animator_collection.h" | 18 #include "ui/compositor/layer_animator_collection.h" |
| 20 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 19 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 21 #include "ui/compositor/scoped_layer_animation_settings.h" | 20 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 22 #include "ui/compositor/test/context_factories_for_test.h" | 21 #include "ui/compositor/test/context_factories_for_test.h" |
| 23 #include "ui/compositor/test/layer_animator_test_controller.h" | 22 #include "ui/compositor/test/layer_animator_test_controller.h" |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 test_controller.animator()->ScheduleAnimation( | 364 test_controller.animator()->ScheduleAnimation( |
| 366 new LayerAnimationSequence( | 365 new LayerAnimationSequence( |
| 367 LayerAnimationElement::CreateOpacityElement(target_opacity, delta))); | 366 LayerAnimationElement::CreateOpacityElement(target_opacity, delta))); |
| 368 | 367 |
| 369 EXPECT_TRUE(test_controller.animator()->is_animating()); | 368 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 370 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); | 369 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); |
| 371 | 370 |
| 372 base::TimeTicks start_time = test_controller.animator()->last_step_time(); | 371 base::TimeTicks start_time = test_controller.animator()->last_step_time(); |
| 373 base::TimeTicks effective_start = start_time + delta; | 372 base::TimeTicks effective_start = start_time + delta; |
| 374 | 373 |
| 375 test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent( | 374 test_controller.animator()->OnThreadedAnimationStarted( |
| 376 cc::AnimationEvent::STARTED, 0, | 375 effective_start, cc::TargetProperty::OPACITY, |
| 377 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) | 376 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) |
| 378 ->animation_group_id(), | 377 ->animation_group_id()); |
| 379 cc::TargetProperty::OPACITY, effective_start)); | |
| 380 | 378 |
| 381 animator->Step(effective_start + delta / 2); | 379 animator->Step(effective_start + delta / 2); |
| 382 | 380 |
| 383 EXPECT_TRUE(test_controller.animator()->is_animating()); | 381 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 384 EXPECT_NEAR( | 382 EXPECT_NEAR( |
| 385 0.5, | 383 0.5, |
| 386 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)-> | 384 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)-> |
| 387 last_progressed_fraction(), | 385 last_progressed_fraction(), |
| 388 epsilon); | 386 epsilon); |
| 389 | 387 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 472 |
| 475 test_controller.animator()->ScheduleTogether(animations); | 473 test_controller.animator()->ScheduleTogether(animations); |
| 476 | 474 |
| 477 EXPECT_TRUE(test_controller.animator()->is_animating()); | 475 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 478 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); | 476 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); |
| 479 CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), start_bounds); | 477 CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), start_bounds); |
| 480 | 478 |
| 481 base::TimeTicks start_time = test_controller.animator()->last_step_time(); | 479 base::TimeTicks start_time = test_controller.animator()->last_step_time(); |
| 482 base::TimeTicks effective_start = start_time + delta; | 480 base::TimeTicks effective_start = start_time + delta; |
| 483 | 481 |
| 484 test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent( | 482 test_controller.animator()->OnThreadedAnimationStarted( |
| 485 cc::AnimationEvent::STARTED, 0, | 483 effective_start, cc::TargetProperty::OPACITY, |
| 486 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) | 484 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) |
| 487 ->animation_group_id(), | 485 ->animation_group_id()); |
| 488 cc::TargetProperty::OPACITY, effective_start)); | |
| 489 | 486 |
| 490 animator->Step(effective_start + delta / 2); | 487 animator->Step(effective_start + delta / 2); |
| 491 | 488 |
| 492 EXPECT_TRUE(test_controller.animator()->is_animating()); | 489 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 493 EXPECT_NEAR( | 490 EXPECT_NEAR( |
| 494 0.5, | 491 0.5, |
| 495 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)-> | 492 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)-> |
| 496 last_progressed_fraction(), | 493 last_progressed_fraction(), |
| 497 epsilon); | 494 epsilon); |
| 498 CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), middle_bounds); | 495 CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), middle_bounds); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 test_controller.animator()->StartAnimation( | 732 test_controller.animator()->StartAnimation( |
| 736 new LayerAnimationSequence( | 733 new LayerAnimationSequence( |
| 737 LayerAnimationElement::CreateOpacityElement(target_opacity, delta))); | 734 LayerAnimationElement::CreateOpacityElement(target_opacity, delta))); |
| 738 | 735 |
| 739 EXPECT_TRUE(test_controller.animator()->is_animating()); | 736 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 740 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); | 737 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); |
| 741 | 738 |
| 742 base::TimeTicks start_time = test_controller.animator()->last_step_time(); | 739 base::TimeTicks start_time = test_controller.animator()->last_step_time(); |
| 743 base::TimeTicks effective_start = start_time + delta; | 740 base::TimeTicks effective_start = start_time + delta; |
| 744 | 741 |
| 745 test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent( | 742 test_controller.animator()->OnThreadedAnimationStarted( |
| 746 cc::AnimationEvent::STARTED, 0, | 743 effective_start, cc::TargetProperty::OPACITY, |
| 747 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) | 744 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) |
| 748 ->animation_group_id(), | 745 ->animation_group_id()); |
| 749 cc::TargetProperty::OPACITY, effective_start)); | |
| 750 | 746 |
| 751 animator->Step(effective_start + delta / 2); | 747 animator->Step(effective_start + delta / 2); |
| 752 | 748 |
| 753 EXPECT_TRUE(test_controller.animator()->is_animating()); | 749 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 754 EXPECT_NEAR( | 750 EXPECT_NEAR( |
| 755 0.5, | 751 0.5, |
| 756 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)-> | 752 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)-> |
| 757 last_progressed_fraction(), | 753 last_progressed_fraction(), |
| 758 epsilon); | 754 epsilon); |
| 759 | 755 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 test_controller.animator()->set_preemption_strategy( | 855 test_controller.animator()->set_preemption_strategy( |
| 860 LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 856 LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 861 | 857 |
| 862 test_controller.animator()->StartAnimation( | 858 test_controller.animator()->StartAnimation( |
| 863 new LayerAnimationSequence( | 859 new LayerAnimationSequence( |
| 864 LayerAnimationElement::CreateOpacityElement(target_opacity, delta))); | 860 LayerAnimationElement::CreateOpacityElement(target_opacity, delta))); |
| 865 | 861 |
| 866 base::TimeTicks start_time = test_controller.animator()->last_step_time(); | 862 base::TimeTicks start_time = test_controller.animator()->last_step_time(); |
| 867 base::TimeTicks effective_start = start_time + delta; | 863 base::TimeTicks effective_start = start_time + delta; |
| 868 | 864 |
| 869 test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent( | 865 test_controller.animator()->OnThreadedAnimationStarted( |
| 870 cc::AnimationEvent::STARTED, 0, | 866 effective_start, cc::TargetProperty::OPACITY, |
| 871 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) | 867 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) |
| 872 ->animation_group_id(), | 868 ->animation_group_id()); |
| 873 cc::TargetProperty::OPACITY, effective_start)); | |
| 874 | 869 |
| 875 animator->Step(effective_start + delta / 2); | 870 animator->Step(effective_start + delta / 2); |
| 876 | 871 |
| 877 test_controller.animator()->StartAnimation( | 872 test_controller.animator()->StartAnimation( |
| 878 new LayerAnimationSequence( | 873 new LayerAnimationSequence( |
| 879 LayerAnimationElement::CreateOpacityElement(start_opacity, delta))); | 874 LayerAnimationElement::CreateOpacityElement(start_opacity, delta))); |
| 880 | 875 |
| 881 EXPECT_TRUE(test_controller.animator()->is_animating()); | 876 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 882 EXPECT_NEAR(delegate.GetOpacityForAnimation(), middle_opacity, epsilon); | 877 EXPECT_NEAR(delegate.GetOpacityForAnimation(), middle_opacity, epsilon); |
| 883 | 878 |
| 884 test_controller.animator()->StartAnimation( | 879 test_controller.animator()->StartAnimation( |
| 885 new LayerAnimationSequence( | 880 new LayerAnimationSequence( |
| 886 LayerAnimationElement::CreateOpacityElement(start_opacity, delta))); | 881 LayerAnimationElement::CreateOpacityElement(start_opacity, delta))); |
| 887 | 882 |
| 888 EXPECT_TRUE(test_controller.animator()->is_animating()); | 883 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 889 | 884 |
| 890 base::TimeTicks second_effective_start = effective_start + delta; | 885 base::TimeTicks second_effective_start = effective_start + delta; |
| 891 | 886 |
| 892 test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent( | 887 test_controller.animator()->OnThreadedAnimationStarted( |
| 893 cc::AnimationEvent::STARTED, 0, | 888 second_effective_start, cc::TargetProperty::OPACITY, |
| 894 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) | 889 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) |
| 895 ->animation_group_id(), | 890 ->animation_group_id()); |
| 896 cc::TargetProperty::OPACITY, second_effective_start)); | |
| 897 | 891 |
| 898 animator->Step(second_effective_start + delta / 2); | 892 animator->Step(second_effective_start + delta / 2); |
| 899 | 893 |
| 900 EXPECT_TRUE(test_controller.animator()->is_animating()); | 894 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 901 EXPECT_NEAR( | 895 EXPECT_NEAR( |
| 902 0.5, | 896 0.5, |
| 903 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)-> | 897 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)-> |
| 904 last_progressed_fraction(), | 898 last_progressed_fraction(), |
| 905 epsilon); | 899 epsilon); |
| 906 | 900 |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 test_controller.animator()->StartTogether( | 1176 test_controller.animator()->StartTogether( |
| 1183 CreateMultiSequence( | 1177 CreateMultiSequence( |
| 1184 LayerAnimationElement::CreateOpacityElement(target_opacity, delta), | 1178 LayerAnimationElement::CreateOpacityElement(target_opacity, delta), |
| 1185 LayerAnimationElement::CreateBrightnessElement(target_brightness, | 1179 LayerAnimationElement::CreateBrightnessElement(target_brightness, |
| 1186 delta) | 1180 delta) |
| 1187 )); | 1181 )); |
| 1188 | 1182 |
| 1189 base::TimeTicks start_time = test_controller.animator()->last_step_time(); | 1183 base::TimeTicks start_time = test_controller.animator()->last_step_time(); |
| 1190 base::TimeTicks effective_start = start_time + delta; | 1184 base::TimeTicks effective_start = start_time + delta; |
| 1191 | 1185 |
| 1192 test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent( | 1186 test_controller.animator()->OnThreadedAnimationStarted( |
| 1193 cc::AnimationEvent::STARTED, 0, | 1187 effective_start, cc::TargetProperty::OPACITY, |
| 1194 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) | 1188 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) |
| 1195 ->animation_group_id(), | 1189 ->animation_group_id()); |
| 1196 cc::TargetProperty::OPACITY, effective_start)); | |
| 1197 | 1190 |
| 1198 animator->Step(effective_start + delta / 2); | 1191 animator->Step(effective_start + delta / 2); |
| 1199 | 1192 |
| 1200 test_controller.animator()->StartTogether( | 1193 test_controller.animator()->StartTogether( |
| 1201 CreateMultiSequence( | 1194 CreateMultiSequence( |
| 1202 LayerAnimationElement::CreateOpacityElement(start_opacity, delta), | 1195 LayerAnimationElement::CreateOpacityElement(start_opacity, delta), |
| 1203 LayerAnimationElement::CreateBrightnessElement(start_brightness, | 1196 LayerAnimationElement::CreateBrightnessElement(start_brightness, |
| 1204 delta))); | 1197 delta))); |
| 1205 | 1198 |
| 1206 EXPECT_TRUE(test_controller.animator()->is_animating()); | 1199 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 1207 EXPECT_NEAR(delegate.GetOpacityForAnimation(), middle_opacity, epsilon); | 1200 EXPECT_NEAR(delegate.GetOpacityForAnimation(), middle_opacity, epsilon); |
| 1208 EXPECT_NEAR(delegate.GetBrightnessForAnimation(), middle_brightness, epsilon); | 1201 EXPECT_NEAR(delegate.GetBrightnessForAnimation(), middle_brightness, epsilon); |
| 1209 | 1202 |
| 1210 test_controller.animator()->StartTogether( | 1203 test_controller.animator()->StartTogether( |
| 1211 CreateMultiSequence( | 1204 CreateMultiSequence( |
| 1212 LayerAnimationElement::CreateOpacityElement(start_opacity, delta), | 1205 LayerAnimationElement::CreateOpacityElement(start_opacity, delta), |
| 1213 LayerAnimationElement::CreateBrightnessElement(start_brightness, | 1206 LayerAnimationElement::CreateBrightnessElement(start_brightness, |
| 1214 delta))); | 1207 delta))); |
| 1215 | 1208 |
| 1216 EXPECT_TRUE(test_controller.animator()->is_animating()); | 1209 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 1217 | 1210 |
| 1218 base::TimeTicks second_effective_start = effective_start + delta; | 1211 base::TimeTicks second_effective_start = effective_start + delta; |
| 1219 | 1212 |
| 1220 test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent( | 1213 test_controller.animator()->OnThreadedAnimationStarted( |
| 1221 cc::AnimationEvent::STARTED, 0, | 1214 second_effective_start, cc::TargetProperty::OPACITY, |
| 1222 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) | 1215 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) |
| 1223 ->animation_group_id(), | 1216 ->animation_group_id()); |
| 1224 cc::TargetProperty::OPACITY, second_effective_start)); | |
| 1225 | 1217 |
| 1226 animator->Step(second_effective_start + delta / 2); | 1218 animator->Step(second_effective_start + delta / 2); |
| 1227 | 1219 |
| 1228 EXPECT_TRUE(test_controller.animator()->is_animating()); | 1220 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 1229 EXPECT_NEAR( | 1221 EXPECT_NEAR( |
| 1230 0.5, | 1222 0.5, |
| 1231 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)-> | 1223 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)-> |
| 1232 last_progressed_fraction(), | 1224 last_progressed_fraction(), |
| 1233 epsilon); | 1225 epsilon); |
| 1234 EXPECT_NEAR(delegate.GetBrightnessForAnimation(), | 1226 EXPECT_NEAR(delegate.GetBrightnessForAnimation(), |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1452 sequence->AddElement( | 1444 sequence->AddElement( |
| 1453 LayerAnimationElement::CreateOpacityElement(start_opacity, delta)); | 1445 LayerAnimationElement::CreateOpacityElement(start_opacity, delta)); |
| 1454 | 1446 |
| 1455 sequence->set_is_cyclic(true); | 1447 sequence->set_is_cyclic(true); |
| 1456 | 1448 |
| 1457 test_controller.animator()->StartAnimation(sequence.release()); | 1449 test_controller.animator()->StartAnimation(sequence.release()); |
| 1458 | 1450 |
| 1459 base::TimeTicks start_time = test_controller.animator()->last_step_time(); | 1451 base::TimeTicks start_time = test_controller.animator()->last_step_time(); |
| 1460 base::TimeTicks effective_start = start_time + delta; | 1452 base::TimeTicks effective_start = start_time + delta; |
| 1461 | 1453 |
| 1462 test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent( | 1454 test_controller.animator()->OnThreadedAnimationStarted( |
| 1463 cc::AnimationEvent::STARTED, 0, | 1455 effective_start, cc::TargetProperty::OPACITY, |
| 1464 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) | 1456 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) |
| 1465 ->animation_group_id(), | 1457 ->animation_group_id()); |
| 1466 cc::TargetProperty::OPACITY, effective_start)); | |
| 1467 | 1458 |
| 1468 animator->Step(effective_start + delta); | 1459 animator->Step(effective_start + delta); |
| 1469 EXPECT_TRUE(test_controller.animator()->is_animating()); | 1460 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 1470 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); | 1461 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); |
| 1471 | 1462 |
| 1472 base::TimeTicks second_effective_start = effective_start + 2 * delta; | 1463 base::TimeTicks second_effective_start = effective_start + 2 * delta; |
| 1473 test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent( | 1464 test_controller.animator()->OnThreadedAnimationStarted( |
| 1474 cc::AnimationEvent::STARTED, 0, | 1465 second_effective_start, cc::TargetProperty::OPACITY, |
| 1475 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) | 1466 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) |
| 1476 ->animation_group_id(), | 1467 ->animation_group_id()); |
| 1477 cc::TargetProperty::OPACITY, second_effective_start)); | |
| 1478 | 1468 |
| 1479 animator->Step(second_effective_start + delta); | 1469 animator->Step(second_effective_start + delta); |
| 1480 | 1470 |
| 1481 EXPECT_TRUE(test_controller.animator()->is_animating()); | 1471 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 1482 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); | 1472 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); |
| 1483 | 1473 |
| 1484 base::TimeTicks third_effective_start = second_effective_start + 2 * delta; | 1474 base::TimeTicks third_effective_start = second_effective_start + 2 * delta; |
| 1485 test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent( | 1475 test_controller.animator()->OnThreadedAnimationStarted( |
| 1486 cc::AnimationEvent::STARTED, 0, | 1476 third_effective_start, cc::TargetProperty::OPACITY, |
| 1487 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) | 1477 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) |
| 1488 ->animation_group_id(), | 1478 ->animation_group_id()); |
| 1489 cc::TargetProperty::OPACITY, third_effective_start)); | |
| 1490 | 1479 |
| 1491 animator->Step(third_effective_start + delta); | 1480 animator->Step(third_effective_start + delta); |
| 1492 EXPECT_TRUE(test_controller.animator()->is_animating()); | 1481 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 1493 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); | 1482 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); |
| 1494 | 1483 |
| 1495 base::TimeTicks fourth_effective_start = third_effective_start + 2 * delta; | 1484 base::TimeTicks fourth_effective_start = third_effective_start + 2 * delta; |
| 1496 test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent( | 1485 test_controller.animator()->OnThreadedAnimationStarted( |
| 1497 cc::AnimationEvent::STARTED, 0, | 1486 fourth_effective_start, cc::TargetProperty::OPACITY, |
| 1498 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) | 1487 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) |
| 1499 ->animation_group_id(), | 1488 ->animation_group_id()); |
| 1500 cc::TargetProperty::OPACITY, fourth_effective_start)); | |
| 1501 | 1489 |
| 1502 // Skip ahead by a lot. | 1490 // Skip ahead by a lot. |
| 1503 animator->Step(fourth_effective_start + 1000 * delta); | 1491 animator->Step(fourth_effective_start + 1000 * delta); |
| 1504 | 1492 |
| 1505 EXPECT_TRUE(test_controller.animator()->is_animating()); | 1493 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 1506 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); | 1494 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), target_opacity); |
| 1507 | 1495 |
| 1508 base::TimeTicks fifth_effective_start = fourth_effective_start + 1001 * delta; | 1496 base::TimeTicks fifth_effective_start = fourth_effective_start + 1001 * delta; |
| 1509 test_controller.animator()->OnThreadedAnimationStarted(cc::AnimationEvent( | 1497 test_controller.animator()->OnThreadedAnimationStarted( |
| 1510 cc::AnimationEvent::STARTED, 0, | 1498 fifth_effective_start, cc::TargetProperty::OPACITY, |
| 1511 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) | 1499 test_controller.GetRunningSequence(LayerAnimationElement::OPACITY) |
| 1512 ->animation_group_id(), | 1500 ->animation_group_id()); |
| 1513 cc::TargetProperty::OPACITY, fifth_effective_start)); | |
| 1514 | 1501 |
| 1515 // Skip ahead by a lot. | 1502 // Skip ahead by a lot. |
| 1516 animator->Step(fifth_effective_start + 999 * delta); | 1503 animator->Step(fifth_effective_start + 999 * delta); |
| 1517 | 1504 |
| 1518 EXPECT_TRUE(test_controller.animator()->is_animating()); | 1505 EXPECT_TRUE(test_controller.animator()->is_animating()); |
| 1519 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); | 1506 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), start_opacity); |
| 1520 | 1507 |
| 1521 test_controller.animator()->StopAnimatingProperty( | 1508 test_controller.animator()->StopAnimatingProperty( |
| 1522 LayerAnimationElement::OPACITY); | 1509 LayerAnimationElement::OPACITY); |
| 1523 | 1510 |
| (...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2836 EXPECT_EQ(observer.last_ended_sequence(), nullptr); | 2823 EXPECT_EQ(observer.last_ended_sequence(), nullptr); |
| 2837 EXPECT_EQ(observer.last_detached_sequence(), first_sequence); | 2824 EXPECT_EQ(observer.last_detached_sequence(), first_sequence); |
| 2838 | 2825 |
| 2839 EXPECT_TRUE(observer.AbortedEpochIsBeforeDetachedEpoch()); | 2826 EXPECT_TRUE(observer.AbortedEpochIsBeforeDetachedEpoch()); |
| 2840 EXPECT_TRUE(observer.AbortedEpochIsBeforeStartedEpoch()); | 2827 EXPECT_TRUE(observer.AbortedEpochIsBeforeStartedEpoch()); |
| 2841 EXPECT_TRUE(observer.AttachedEpochIsBeforeScheduledEpoch()); | 2828 EXPECT_TRUE(observer.AttachedEpochIsBeforeScheduledEpoch()); |
| 2842 EXPECT_TRUE(observer.ScheduledEpochIsBeforeStartedEpoch()); | 2829 EXPECT_TRUE(observer.ScheduledEpochIsBeforeStartedEpoch()); |
| 2843 } | 2830 } |
| 2844 | 2831 |
| 2845 } // namespace ui | 2832 } // namespace ui |
| OLD | NEW |