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

Unified Diff: cc/animation/layer_animation_controller_unittest.cc

Issue 1148333002: cc: Make re-added animations get pushed to the compositor thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/layer_animation_controller.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/layer_animation_controller_unittest.cc
diff --git a/cc/animation/layer_animation_controller_unittest.cc b/cc/animation/layer_animation_controller_unittest.cc
index ad1d4c9eecec6d4f33b844ddd82e12e596003c9a..c5637764bcbb46d0d735ebcc27be2d5181ea2da9 100644
--- a/cc/animation/layer_animation_controller_unittest.cc
+++ b/cc/animation/layer_animation_controller_unittest.cc
@@ -298,12 +298,13 @@ TEST(LayerAnimationControllerTest, DoNotSyncFinishedAnimation) {
scoped_refptr<LayerAnimationController> controller(
LayerAnimationController::Create(0));
controller->AddValueObserver(&dummy);
+ scoped_ptr<AnimationEventsVector> events(
+ make_scoped_ptr(new AnimationEventsVector));
EXPECT_FALSE(controller_impl->GetAnimation(Animation::OPACITY));
int animation_id =
AddOpacityTransitionToController(controller.get(), 1, 0, 1, false);
- int group_id = controller->GetAnimationById(animation_id)->group();
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
@@ -312,21 +313,30 @@ TEST(LayerAnimationControllerTest, DoNotSyncFinishedAnimation) {
EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
controller_impl->GetAnimationById(animation_id)->run_state());
+ events.reset(new AnimationEventsVector);
+ controller_impl->Animate(kInitialTickTime);
+ controller_impl->UpdateState(true, events.get());
+ EXPECT_EQ(1u, events->size());
+ EXPECT_EQ(AnimationEvent::STARTED, (*events)[0].type);
+
// Notify main thread controller that the animation has started.
- AnimationEvent animation_started_event(AnimationEvent::STARTED, 0, group_id,
- Animation::OPACITY, kInitialTickTime);
- controller->NotifyAnimationStarted(animation_started_event);
+ controller->NotifyAnimationStarted((*events)[0]);
- // Force animation to complete on impl thread.
- controller_impl->RemoveAnimation(animation_id);
+ // Complete animation on impl thread.
+ events.reset(new AnimationEventsVector);
+ controller_impl->Animate(kInitialTickTime + TimeDelta::FromSeconds(1));
+ controller_impl->UpdateState(true, events.get());
+ EXPECT_EQ(1u, events->size());
+ EXPECT_EQ(AnimationEvent::FINISHED, (*events)[0].type);
- EXPECT_FALSE(controller_impl->GetAnimationById(animation_id));
+ controller->NotifyAnimationFinished((*events)[0]);
+
+ controller->Animate(kInitialTickTime + TimeDelta::FromSeconds(2));
+ controller->UpdateState(true, nullptr);
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
-
- // Even though the main thread has a 'new' animation, it should not be pushed
- // because the animation has already completed on the impl thread.
+ EXPECT_FALSE(controller->GetAnimationById(animation_id));
EXPECT_FALSE(controller_impl->GetAnimationById(animation_id));
}
« no previous file with comments | « cc/animation/layer_animation_controller.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698