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

Side by Side Diff: cc/layer_animation_controller_unittest.cc

Issue 11362151: cc: Do not save the rasterScale for layers until they are finished animating transforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/layer_tree_host_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/layer_animation_controller.h" 7 #include "cc/layer_animation_controller.h"
8 8
9 #include "cc/active_animation.h" 9 #include "cc/active_animation.h"
10 #include "cc/animation_curve.h" 10 #include "cc/animation_curve.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 TEST(LayerAnimationControllerTest, doNotSyncFinishedAnimation) 120 TEST(LayerAnimationControllerTest, doNotSyncFinishedAnimation)
121 { 121 {
122 FakeLayerAnimationControllerClient dummyImpl; 122 FakeLayerAnimationControllerClient dummyImpl;
123 scoped_ptr<LayerAnimationController> controllerImpl(LayerAnimationController ::create(&dummyImpl)); 123 scoped_ptr<LayerAnimationController> controllerImpl(LayerAnimationController ::create(&dummyImpl));
124 FakeLayerAnimationControllerClient dummy; 124 FakeLayerAnimationControllerClient dummy;
125 scoped_ptr<LayerAnimationController> controller(LayerAnimationController::cr eate(&dummy)); 125 scoped_ptr<LayerAnimationController> controller(LayerAnimationController::cr eate(&dummy));
126 126
127 EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity) ); 127 EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity) );
128 128
129 addOpacityTransitionToController(*controller, 1, 0, 1, false); 129 int animationId = addOpacityTransitionToController(*controller, 1, 0, 1, fal se);
130 130
131 controller->pushAnimationUpdatesTo(controllerImpl.get()); 131 controller->pushAnimationUpdatesTo(controllerImpl.get());
132 132
133 EXPECT_TRUE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)) ; 133 EXPECT_TRUE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity)) ;
134 EXPECT_EQ(ActiveAnimation::WaitingForTargetAvailability, controllerImpl->get ActiveAnimation(0, ActiveAnimation::Opacity)->runState()); 134 EXPECT_EQ(ActiveAnimation::WaitingForTargetAvailability, controllerImpl->get ActiveAnimation(0, ActiveAnimation::Opacity)->runState());
135 135
136 // Notify main thread controller that the animation has started. 136 // Notify main thread controller that the animation has started.
137 AnimationEvent animationStartedEvent(AnimationEvent::Started, 0, 0, ActiveAn imation::Opacity, 0); 137 AnimationEvent animationStartedEvent(AnimationEvent::Started, 0, 0, ActiveAn imation::Opacity, 0);
138 controller->notifyAnimationStarted(animationStartedEvent); 138 controller->notifyAnimationStarted(animationStartedEvent);
139 139
140 // Force animation to complete on impl thread. 140 // Force animation to complete on impl thread.
141 controllerImpl->removeAnimation(0); 141 controllerImpl->removeAnimation(animationId);
142 142
143 EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity) ); 143 EXPECT_FALSE(controllerImpl->getActiveAnimation(animationId, ActiveAnimation ::Opacity));
144 144
145 controller->pushAnimationUpdatesTo(controllerImpl.get()); 145 controller->pushAnimationUpdatesTo(controllerImpl.get());
146 146
147 // Even though the main thread has a 'new' animation, it should not be pushe d because the animation has already completed on the impl thread. 147 // Even though the main thread has a 'new' animation, it should not be pushe d because the animation has already completed on the impl thread.
148 EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity) ); 148 EXPECT_FALSE(controllerImpl->getActiveAnimation(animationId, ActiveAnimation ::Opacity));
149 } 149 }
150 150
151 // Tests that transitioning opacity from 0 to 1 works as expected. 151 // Tests that transitioning opacity from 0 to 1 works as expected.
152 TEST(LayerAnimationControllerTest, TrivialTransition) 152 TEST(LayerAnimationControllerTest, TrivialTransition)
153 { 153 {
154 scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEvents Vector)); 154 scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEvents Vector));
155 FakeLayerAnimationControllerClient dummy; 155 FakeLayerAnimationControllerClient dummy;
156 scoped_ptr<LayerAnimationController> controller( 156 scoped_ptr<LayerAnimationController> controller(
157 LayerAnimationController::create(&dummy)); 157 LayerAnimationController::create(&dummy));
158 158
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 controller->setForceSync(); 552 controller->setForceSync();
553 553
554 controller->pushAnimationUpdatesTo(controllerImpl.get()); 554 controller->pushAnimationUpdatesTo(controllerImpl.get());
555 555
556 activeAnimation = controllerImpl->getActiveAnimation(0, ActiveAnimation::Opa city); 556 activeAnimation = controllerImpl->getActiveAnimation(0, ActiveAnimation::Opa city);
557 EXPECT_TRUE(activeAnimation); 557 EXPECT_TRUE(activeAnimation);
558 EXPECT_EQ(ActiveAnimation::WaitingForTargetAvailability, activeAnimation->ru nState()); 558 EXPECT_EQ(ActiveAnimation::WaitingForTargetAvailability, activeAnimation->ru nState());
559 } 559 }
560 560
561 } // anonymous namespace 561 } // anonymous namespace
OLDNEW
« no previous file with comments | « no previous file | cc/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698