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

Unified Diff: cc/layer_animation_controller_unittest.cc

Issue 11598005: Ref count layer animation controllers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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/layer_animation_controller.cc ('k') | cc/layer_animation_event_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_animation_controller_unittest.cc
diff --git a/cc/layer_animation_controller_unittest.cc b/cc/layer_animation_controller_unittest.cc
index 698fe77fedf2c38bc12eee29a5b21b097d4a6fc3..f93ea7cb54ca1ace1d7f9c71d2e2d0b38e4d0fad 100644
--- a/cc/layer_animation_controller_unittest.cc
+++ b/cc/layer_animation_controller_unittest.cc
@@ -26,10 +26,12 @@ scoped_ptr<ActiveAnimation> createActiveAnimation(scoped_ptr<AnimationCurve> cur
TEST(LayerAnimationControllerTest, syncNewAnimation)
{
- FakeLayerAnimationControllerClient dummyImpl;
- scoped_ptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(&dummyImpl));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummyImpl;
+ scoped_refptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(0));
+ controllerImpl->addObserver(&dummyImpl);
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity));
@@ -45,10 +47,12 @@ TEST(LayerAnimationControllerTest, syncNewAnimation)
// thread, we must be sure to respect the synchronized start time.
TEST(LayerAnimationControllerTest, doNotClobberStartTimes)
{
- FakeLayerAnimationControllerClient dummyImpl;
- scoped_ptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(&dummyImpl));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummyImpl;
+ scoped_refptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(0));
+ controllerImpl->addObserver(&dummyImpl);
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity));
@@ -74,10 +78,12 @@ TEST(LayerAnimationControllerTest, doNotClobberStartTimes)
TEST(LayerAnimationControllerTest, syncPauseAndResume)
{
- FakeLayerAnimationControllerClient dummyImpl;
- scoped_ptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(&dummyImpl));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummyImpl;
+ scoped_refptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(0));
+ controllerImpl->addObserver(&dummyImpl);
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity));
@@ -114,10 +120,12 @@ TEST(LayerAnimationControllerTest, syncPauseAndResume)
TEST(LayerAnimationControllerTest, doNotSyncFinishedAnimation)
{
- FakeLayerAnimationControllerClient dummyImpl;
- scoped_ptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(&dummyImpl));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummyImpl;
+ scoped_refptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(0));
+ controllerImpl->addObserver(&dummyImpl);
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
EXPECT_FALSE(controllerImpl->getActiveAnimation(0, ActiveAnimation::Opacity));
@@ -147,9 +155,9 @@ TEST(LayerAnimationControllerTest, doNotSyncFinishedAnimation)
TEST(LayerAnimationControllerTest, TrivialTransition)
{
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity));
@@ -166,9 +174,9 @@ TEST(LayerAnimationControllerTest, TrivialTransition)
TEST(LayerAnimationControllerTest, AnimationsWaitingForStartTimeDoNotFinishIfTheyWaitLongerToStartThanTheirDuration)
{
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity));
toAdd->setNeedsSynchronizedStartTime(true);
@@ -196,9 +204,9 @@ TEST(LayerAnimationControllerTest, AnimationsWaitingForStartTimeDoNotFinishIfThe
TEST(LayerAnimationControllerTest, TrivialQueuing)
{
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity));
controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 1, 0.5)).PassAs<AnimationCurve>(), 2, ActiveAnimation::Opacity));
@@ -218,9 +226,9 @@ TEST(LayerAnimationControllerTest, TrivialQueuing)
TEST(LayerAnimationControllerTest, Interrupt)
{
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity));
controller->animate(0, events.get());
EXPECT_TRUE(controller->hasActiveAnimation());
@@ -244,9 +252,9 @@ TEST(LayerAnimationControllerTest, Interrupt)
TEST(LayerAnimationControllerTest, ScheduleTogetherWhenAPropertyIsBlocked)
{
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeTransformTransition(1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Transform));
controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeTransformTransition(1)).PassAs<AnimationCurve>(), 2, ActiveAnimation::Transform));
@@ -271,9 +279,9 @@ TEST(LayerAnimationControllerTest, ScheduleTogetherWhenAPropertyIsBlocked)
TEST(LayerAnimationControllerTest, ScheduleTogetherWithAnAnimWaiting)
{
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeTransformTransition(2)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Transform));
controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity));
@@ -301,9 +309,9 @@ TEST(LayerAnimationControllerTest, ScheduleTogetherWithAnAnimWaiting)
TEST(LayerAnimationControllerTest, ScheduleAnimation)
{
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity));
toAdd->setRunState(ActiveAnimation::WaitingForStartTime, 0);
@@ -325,9 +333,9 @@ TEST(LayerAnimationControllerTest, ScheduleAnimation)
TEST(LayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimation)
{
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity));
@@ -356,9 +364,9 @@ TEST(LayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimation)
TEST(LayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimationWithAnimInQueue)
{
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity));
@@ -392,9 +400,9 @@ TEST(LayerAnimationControllerTest, ScheduledAnimationInterruptsRunningAnimationW
TEST(LayerAnimationControllerTest, TrivialLooping)
{
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), 1, ActiveAnimation::Opacity));
toAdd->setIterations(3);
@@ -428,9 +436,9 @@ TEST(LayerAnimationControllerTest, TrivialLooping)
TEST(LayerAnimationControllerTest, InfiniteLooping)
{
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
const int id = 1;
scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), id, ActiveAnimation::Opacity));
@@ -464,9 +472,9 @@ TEST(LayerAnimationControllerTest, InfiniteLooping)
TEST(LayerAnimationControllerTest, PauseResume)
{
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
const int id = 1;
controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(1, 0, 1)).PassAs<AnimationCurve>(), id, ActiveAnimation::Opacity));
@@ -499,9 +507,9 @@ TEST(LayerAnimationControllerTest, PauseResume)
TEST(LayerAnimationControllerTest, AbortAGroupedAnimation)
{
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
const int id = 1;
controller->addAnimation(createActiveAnimation(make_scoped_ptr(new FakeTransformTransition(1)).PassAs<AnimationCurve>(), id, ActiveAnimation::Transform));
@@ -527,12 +535,13 @@ TEST(LayerAnimationControllerTest, AbortAGroupedAnimation)
TEST(LayerAnimationControllerTest, ForceSyncWhenSynchronizedStartTimeNeeded)
{
- FakeLayerAnimationControllerClient dummyImpl;
- scoped_ptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(&dummyImpl));
+ FakeLayerAnimationValueObserver dummyImpl;
+ scoped_refptr<LayerAnimationController> controllerImpl(LayerAnimationController::create(0));
+ controllerImpl->addObserver(&dummyImpl);
scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- FakeLayerAnimationControllerClient dummy;
- scoped_ptr<LayerAnimationController> controller(
- LayerAnimationController::create(&dummy));
+ FakeLayerAnimationValueObserver dummy;
+ scoped_refptr<LayerAnimationController> controller(LayerAnimationController::create(0));
+ controller->addObserver(&dummy);
scoped_ptr<ActiveAnimation> toAdd(createActiveAnimation(make_scoped_ptr(new FakeFloatTransition(2, 0, 1)).PassAs<AnimationCurve>(), 0, ActiveAnimation::Opacity));
toAdd->setNeedsSynchronizedStartTime(true);
« no previous file with comments | « cc/layer_animation_controller.cc ('k') | cc/layer_animation_event_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698