OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/animation/element_animations.h" | 5 #include "cc/animation/element_animations.h" |
6 | 6 |
7 #include "cc/animation/animation_delegate.h" | 7 #include "cc/animation/animation_delegate.h" |
8 #include "cc/animation/animation_host.h" | 8 #include "cc/animation/animation_host.h" |
9 #include "cc/animation/animation_id_provider.h" | 9 #include "cc/animation/animation_id_provider.h" |
10 #include "cc/animation/animation_player.h" | 10 #include "cc/animation/animation_player.h" |
(...skipping 2870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2881 EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating( | 2881 EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating( |
2882 element_id_, ElementListType::PENDING)); | 2882 element_id_, ElementListType::PENDING)); |
2883 EXPECT_FALSE(client_impl_.GetHasPotentialTransformAnimation( | 2883 EXPECT_FALSE(client_impl_.GetHasPotentialTransformAnimation( |
2884 element_id_, ElementListType::ACTIVE)); | 2884 element_id_, ElementListType::ACTIVE)); |
2885 EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating( | 2885 EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating( |
2886 element_id_, ElementListType::ACTIVE)); | 2886 element_id_, ElementListType::ACTIVE)); |
2887 | 2887 |
2888 // Case 2: An animation that's removed before it finishes. | 2888 // Case 2: An animation that's removed before it finishes. |
2889 int animation_id = | 2889 int animation_id = |
2890 AddAnimatedTransformToElementAnimations(animations.get(), 10.0, 2, 2); | 2890 AddAnimatedTransformToElementAnimations(animations.get(), 10.0, 2, 2); |
2891 int animation2_id = | |
2892 AddAnimatedTransformToElementAnimations(animations.get(), 10.0, 2, 1); | |
2893 animations->GetAnimationById(animation2_id) | |
2894 ->set_time_offset(base::TimeDelta::FromMilliseconds(-10000)); | |
2895 animations->GetAnimationById(animation2_id) | |
2896 ->set_fill_mode(Animation::FillMode::NONE); | |
2891 EXPECT_TRUE(client_.GetHasPotentialTransformAnimation( | 2897 EXPECT_TRUE(client_.GetHasPotentialTransformAnimation( |
2892 element_id_, ElementListType::ACTIVE)); | 2898 element_id_, ElementListType::ACTIVE)); |
2893 EXPECT_TRUE(client_.GetTransformIsCurrentlyAnimating( | 2899 EXPECT_TRUE(client_.GetTransformIsCurrentlyAnimating( |
2894 element_id_, ElementListType::ACTIVE)); | 2900 element_id_, ElementListType::ACTIVE)); |
2895 | 2901 |
2896 PushProperties(); | 2902 PushProperties(); |
2897 EXPECT_TRUE(client_impl_.GetHasPotentialTransformAnimation( | 2903 EXPECT_TRUE(client_impl_.GetHasPotentialTransformAnimation( |
2898 element_id_, ElementListType::PENDING)); | 2904 element_id_, ElementListType::PENDING)); |
2899 EXPECT_TRUE(client_impl_.GetTransformIsCurrentlyAnimating( | 2905 EXPECT_TRUE(client_impl_.GetTransformIsCurrentlyAnimating( |
2900 element_id_, ElementListType::PENDING)); | 2906 element_id_, ElementListType::PENDING)); |
2901 EXPECT_FALSE(client_impl_.GetHasPotentialTransformAnimation( | 2907 EXPECT_FALSE(client_impl_.GetHasPotentialTransformAnimation( |
2902 element_id_, ElementListType::ACTIVE)); | 2908 element_id_, ElementListType::ACTIVE)); |
2903 EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating( | 2909 EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating( |
2904 element_id_, ElementListType::ACTIVE)); | 2910 element_id_, ElementListType::ACTIVE)); |
2905 | 2911 |
2906 animations_impl->ActivateAnimations(); | 2912 animations_impl->ActivateAnimations(); |
2907 EXPECT_TRUE(client_impl_.GetHasPotentialTransformAnimation( | 2913 EXPECT_TRUE(client_impl_.GetHasPotentialTransformAnimation( |
2908 element_id_, ElementListType::ACTIVE)); | 2914 element_id_, ElementListType::ACTIVE)); |
2915 // animation1 is in effect currently and animation2 isn't. As the element has | |
2916 // atleast one animation that's in effect currently, client should be notified | |
2917 // that the transform is currently animating. | |
ajuma
2016/09/14 21:41:13
Would one of the tests above also have failed with
jaydasika
2016/09/14 21:50:55
Yes, the test in line 2906.
| |
2909 EXPECT_TRUE(client_impl_.GetTransformIsCurrentlyAnimating( | 2918 EXPECT_TRUE(client_impl_.GetTransformIsCurrentlyAnimating( |
2910 element_id_, ElementListType::ACTIVE)); | 2919 element_id_, ElementListType::ACTIVE)); |
2911 | 2920 |
2912 animations_impl->Animate(kInitialTickTime + | 2921 animations_impl->Animate(kInitialTickTime + |
2913 TimeDelta::FromMilliseconds(2000)); | 2922 TimeDelta::FromMilliseconds(2000)); |
2914 animations_impl->UpdateState(true, events.get()); | 2923 animations_impl->UpdateState(true, events.get()); |
2915 | 2924 |
2916 animations->NotifyAnimationStarted(events->events_[0]); | 2925 animations->NotifyAnimationStarted(events->events_[0]); |
2917 events->events_.clear(); | 2926 events->events_.clear(); |
2918 | 2927 |
2919 animations->RemoveAnimation(animation_id); | 2928 animations->RemoveAnimation(animation_id); |
2929 animations->RemoveAnimation(animation2_id); | |
2920 EXPECT_FALSE(client_.GetHasPotentialTransformAnimation( | 2930 EXPECT_FALSE(client_.GetHasPotentialTransformAnimation( |
2921 element_id_, ElementListType::ACTIVE)); | 2931 element_id_, ElementListType::ACTIVE)); |
2922 EXPECT_FALSE(client_.GetTransformIsCurrentlyAnimating( | 2932 EXPECT_FALSE(client_.GetTransformIsCurrentlyAnimating( |
2923 element_id_, ElementListType::ACTIVE)); | 2933 element_id_, ElementListType::ACTIVE)); |
2924 | 2934 |
2925 PushProperties(); | 2935 PushProperties(); |
2926 EXPECT_FALSE(client_impl_.GetHasPotentialTransformAnimation( | 2936 EXPECT_FALSE(client_impl_.GetHasPotentialTransformAnimation( |
2927 element_id_, ElementListType::PENDING)); | 2937 element_id_, ElementListType::PENDING)); |
2928 EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating( | 2938 EXPECT_FALSE(client_impl_.GetTransformIsCurrentlyAnimating( |
2929 element_id_, ElementListType::PENDING)); | 2939 element_id_, ElementListType::PENDING)); |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3764 EXPECT_FALSE(animations->IsPotentiallyAnimatingProperty( | 3774 EXPECT_FALSE(animations->IsPotentiallyAnimatingProperty( |
3765 TargetProperty::OPACITY, ElementListType::ACTIVE)); | 3775 TargetProperty::OPACITY, ElementListType::ACTIVE)); |
3766 EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty( | 3776 EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty( |
3767 TargetProperty::OPACITY, ElementListType::PENDING)); | 3777 TargetProperty::OPACITY, ElementListType::PENDING)); |
3768 EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty( | 3778 EXPECT_FALSE(animations->IsCurrentlyAnimatingProperty( |
3769 TargetProperty::OPACITY, ElementListType::ACTIVE)); | 3779 TargetProperty::OPACITY, ElementListType::ACTIVE)); |
3770 } | 3780 } |
3771 | 3781 |
3772 } // namespace | 3782 } // namespace |
3773 } // namespace cc | 3783 } // namespace cc |
OLD | NEW |