Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4514)

Unified Diff: cc/animation/element_animations_unittest.cc

Issue 1988293003: cc : Delete code not used outside tests related to impl-only animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/animation/element_animations.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/element_animations_unittest.cc
diff --git a/cc/animation/element_animations_unittest.cc b/cc/animation/element_animations_unittest.cc
index 7d84d498871bca73b82011b45cf5f4842f40f48c..c4e98da87dbe10eda6e5f23cd22528b416814328 100644
--- a/cc/animation/element_animations_unittest.cc
+++ b/cc/animation/element_animations_unittest.cc
@@ -698,100 +698,6 @@ TEST_F(ElementAnimationsTest, TrivialTransition) {
EXPECT_FALSE(event);
}
-TEST_F(ElementAnimationsTest, TrivialTransitionOnImpl) {
- CreateTestLayer(true, false);
- AttachTimelinePlayerLayer();
- CreateImplTimelineAndPlayer();
-
- scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
-
- auto events = host_impl_->CreateEvents();
-
- std::unique_ptr<Animation> to_add(CreateAnimation(
- std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
- 1, TargetProperty::OPACITY));
- to_add->set_is_impl_only(true);
-
- animations_impl->AddAnimation(std::move(to_add));
- animations_impl->Animate(kInitialTickTime);
- animations_impl->UpdateState(true, events.get());
- EXPECT_TRUE(animations_impl->HasActiveAnimation());
- EXPECT_EQ(0.f, client_impl_.GetOpacity(element_id_, ElementListType::ACTIVE));
- EXPECT_EQ(1u, events->events_.size());
- const AnimationEvent* start_opacity_event =
- GetMostRecentPropertyUpdateEvent(events.get());
- EXPECT_EQ(0.f, start_opacity_event->opacity);
-
- animations_impl->Animate(kInitialTickTime +
- TimeDelta::FromMilliseconds(1000));
- animations_impl->UpdateState(true, events.get());
- EXPECT_EQ(1.f, client_impl_.GetOpacity(element_id_, ElementListType::ACTIVE));
- EXPECT_FALSE(animations_impl->HasActiveAnimation());
- EXPECT_EQ(2u, events->events_.size());
- const AnimationEvent* end_opacity_event =
- GetMostRecentPropertyUpdateEvent(events.get());
- EXPECT_EQ(1.f, end_opacity_event->opacity);
-}
-
-TEST_F(ElementAnimationsTest, TrivialTransformOnImpl) {
- CreateTestLayer(true, false);
- AttachTimelinePlayerLayer();
- CreateImplTimelineAndPlayer();
-
- scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
-
- auto events = host_impl_->CreateEvents();
-
- // Choose different values for x and y to avoid coincidental values in the
- // observed transforms.
- const float delta_x = 3;
- const float delta_y = 4;
-
- std::unique_ptr<KeyframedTransformAnimationCurve> curve(
- KeyframedTransformAnimationCurve::Create());
-
- // Create simple TRANSFORM animation.
- TransformOperations operations;
- curve->AddKeyframe(
- TransformKeyframe::Create(base::TimeDelta(), operations, nullptr));
- operations.AppendTranslate(delta_x, delta_y, 0);
- curve->AddKeyframe(TransformKeyframe::Create(
- base::TimeDelta::FromSecondsD(1.0), operations, nullptr));
-
- std::unique_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 0, TargetProperty::TRANSFORM));
- animation->set_is_impl_only(true);
- animations_impl->AddAnimation(std::move(animation));
-
- // Run animation.
- animations_impl->Animate(kInitialTickTime);
- animations_impl->UpdateState(true, events.get());
- EXPECT_TRUE(animations_impl->HasActiveAnimation());
- EXPECT_EQ(gfx::Transform(),
- client_impl_.GetTransform(element_id_, ElementListType::ACTIVE));
- EXPECT_EQ(1u, events->events_.size());
- const AnimationEvent* start_transform_event =
- GetMostRecentPropertyUpdateEvent(events.get());
- ASSERT_TRUE(start_transform_event);
- EXPECT_EQ(gfx::Transform(), start_transform_event->transform);
- EXPECT_TRUE(start_transform_event->is_impl_only);
-
- gfx::Transform expected_transform;
- expected_transform.Translate(delta_x, delta_y);
-
- animations_impl->Animate(kInitialTickTime +
- TimeDelta::FromMilliseconds(1000));
- animations_impl->UpdateState(true, events.get());
- EXPECT_EQ(expected_transform,
- client_impl_.GetTransform(element_id_, ElementListType::ACTIVE));
- EXPECT_FALSE(animations_impl->HasActiveAnimation());
- EXPECT_EQ(2u, events->events_.size());
- const AnimationEvent* end_transform_event =
- GetMostRecentPropertyUpdateEvent(events.get());
- EXPECT_EQ(expected_transform, end_transform_event->transform);
- EXPECT_TRUE(end_transform_event->is_impl_only);
-}
-
TEST_F(ElementAnimationsTest, FilterTransition) {
CreateTestLayer(true, false);
AttachTimelinePlayerLayer();
@@ -843,60 +749,6 @@ TEST_F(ElementAnimationsTest, FilterTransition) {
EXPECT_FALSE(event);
}
-TEST_F(ElementAnimationsTest, FilterTransitionOnImplOnly) {
- CreateTestLayer(true, false);
- AttachTimelinePlayerLayer();
- CreateImplTimelineAndPlayer();
-
- scoped_refptr<ElementAnimations> animations_impl = element_animations_impl();
-
- auto events = host_impl_->CreateEvents();
-
- std::unique_ptr<KeyframedFilterAnimationCurve> curve(
- KeyframedFilterAnimationCurve::Create());
-
- // Create simple FILTER animation.
- FilterOperations start_filters;
- start_filters.Append(FilterOperation::CreateBrightnessFilter(1.f));
- curve->AddKeyframe(
- FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr));
- FilterOperations end_filters;
- end_filters.Append(FilterOperation::CreateBrightnessFilter(2.f));
- curve->AddKeyframe(FilterKeyframe::Create(base::TimeDelta::FromSecondsD(1.0),
- end_filters, nullptr));
-
- std::unique_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 0, TargetProperty::FILTER));
- animation->set_is_impl_only(true);
- animations_impl->AddAnimation(std::move(animation));
-
- // Run animation.
- animations_impl->Animate(kInitialTickTime);
- animations_impl->UpdateState(true, events.get());
- EXPECT_TRUE(animations_impl->HasActiveAnimation());
- EXPECT_EQ(start_filters,
- client_impl_.GetFilters(element_id_, ElementListType::ACTIVE));
- EXPECT_EQ(1u, events->events_.size());
- const AnimationEvent* start_filter_event =
- GetMostRecentPropertyUpdateEvent(events.get());
- EXPECT_TRUE(start_filter_event);
- EXPECT_EQ(start_filters, start_filter_event->filters);
- EXPECT_TRUE(start_filter_event->is_impl_only);
-
- animations_impl->Animate(kInitialTickTime +
- TimeDelta::FromMilliseconds(1000));
- animations_impl->UpdateState(true, events.get());
- EXPECT_EQ(end_filters,
- client_impl_.GetFilters(element_id_, ElementListType::ACTIVE));
- EXPECT_FALSE(animations_impl->HasActiveAnimation());
- EXPECT_EQ(2u, events->events_.size());
- const AnimationEvent* end_filter_event =
- GetMostRecentPropertyUpdateEvent(events.get());
- EXPECT_TRUE(end_filter_event);
- EXPECT_EQ(end_filters, end_filter_event->filters);
- EXPECT_TRUE(end_filter_event->is_impl_only);
-}
-
TEST_F(ElementAnimationsTest, ScrollOffsetTransition) {
CreateTestLayer(true, false);
AttachTimelinePlayerLayer();
@@ -1233,9 +1085,15 @@ TEST_F(ElementAnimationsTest,
TestAnimationDelegate delegate;
player_impl_->set_animation_delegate(&delegate);
- std::unique_ptr<Animation> to_add(CreateAnimation(
- std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
- 1, TargetProperty::OPACITY));
+ gfx::ScrollOffset initial_value(100.f, 300.f);
+ gfx::ScrollOffset target_value(300.f, 200.f);
+ std::unique_ptr<ScrollOffsetAnimationCurve> curve(
+ ScrollOffsetAnimationCurve::Create(target_value,
+ EaseInOutTimingFunction::Create()));
+ curve->SetInitialValue(initial_value);
+ TimeDelta duration = curve->Duration();
+ std::unique_ptr<Animation> to_add(
+ Animation::Create(std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET));
to_add->set_is_impl_only(true);
animations_impl->AddAnimation(std::move(to_add));
@@ -1249,8 +1107,11 @@ TEST_F(ElementAnimationsTest,
EXPECT_FALSE(delegate.finished());
events = host_impl_->CreateEvents();
- animations_impl->Animate(kInitialTickTime +
- TimeDelta::FromMilliseconds(1000));
+ animations_impl->Animate(kInitialTickTime + duration);
+ EXPECT_EQ(duration,
+ animations_impl->GetAnimation(TargetProperty::SCROLL_OFFSET)
+ ->curve()
+ ->Duration());
animations_impl->UpdateState(true, events.get());
EXPECT_TRUE(delegate.started());
« no previous file with comments | « cc/animation/element_animations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698