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

Unified Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 1698813002: CC Animation: Expose TargetProperty enum to be aliased in Blink Platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use custom hash in unordered_set. Created 4 years, 10 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
Index: cc/trees/layer_tree_host_unittest_animation.cc
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index 3e269c31ceba1f500dded0bca65a8bb79af1c80b..02b298e9cbe6144493f5cd0fb402db418e9036d5 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -136,13 +136,14 @@ class LayerTreeHostAnimationTestAddAnimation
}
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ AnimationTargetProperty target_property,
int group) override {
EXPECT_LT(base::TimeTicks(), monotonic_time);
LayerAnimationController* controller =
layer_tree_host()->root_layer()->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* animation =
+ controller->GetAnimation(AnimationTargetProperty::OPACITY);
if (animation)
controller->RemoveAnimation(animation->id());
@@ -220,7 +221,7 @@ class LayerTreeHostAnimationTestAnimationsGetDeleted
}
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ AnimationTargetProperty target_property,
int group) override {
// Animations on the impl-side controller only get deleted during a commit,
// so we need to schedule a commit.
@@ -258,7 +259,8 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
LayerAnimationController* controller_impl =
host_impl->active_tree()->root_layer()->children()[0]->
layer_animation_controller();
- Animation* animation = controller_impl->GetAnimation(Animation::OPACITY);
+ Animation* animation =
+ controller_impl->GetAnimation(AnimationTargetProperty::OPACITY);
if (!animation)
return;
@@ -303,12 +305,13 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
void BeginTest() override { PostAddAnimationToMainThread(picture_.get()); }
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ AnimationTargetProperty target_property,
int group) override {
LayerAnimationController* controller =
layer_tree_host()->root_layer()->children()[0]->
layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* animation =
+ controller->GetAnimation(AnimationTargetProperty::OPACITY);
main_start_time_ = animation->start_time();
controller->RemoveAnimation(animation->id());
EndTest();
@@ -319,7 +322,8 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
LayerAnimationController* controller =
impl_host->active_tree()->root_layer()->children()[0]->
layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* animation =
+ controller->GetAnimation(AnimationTargetProperty::OPACITY);
if (!animation)
return;
@@ -350,11 +354,12 @@ class LayerTreeHostAnimationTestAnimationFinishedEvents
}
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ AnimationTargetProperty target_property,
int group) override {
LayerAnimationController* controller =
layer_tree_host()->root_layer()->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* animation =
+ controller->GetAnimation(AnimationTargetProperty::OPACITY);
if (animation)
controller->RemoveAnimation(animation->id());
EndTest();
@@ -390,7 +395,7 @@ class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity
LayerAnimationController* controller_impl =
host_impl->active_tree()->root_layer()->layer_animation_controller();
Animation* animation_impl =
- controller_impl->GetAnimation(Animation::OPACITY);
+ controller_impl->GetAnimation(AnimationTargetProperty::OPACITY);
controller_impl->RemoveAnimation(animation_impl->id());
EndTest();
}
@@ -426,8 +431,8 @@ class LayerTreeHostAnimationTestLayerAddedWithAnimation
// Any valid AnimationCurve will do here.
scoped_ptr<AnimationCurve> curve(new FakeFloatAnimationCurve());
- scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 1, Animation::OPACITY));
+ scoped_ptr<Animation> animation(Animation::Create(
+ std::move(curve), 1, 1, AnimationTargetProperty::OPACITY));
layer->layer_animation_controller()->AddAnimation(std::move(animation));
// We add the animation *before* attaching the layer to the tree.
@@ -616,7 +621,7 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
}
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ AnimationTargetProperty target_property,
int group) override {
if (TestEnded())
return;
@@ -667,7 +672,7 @@ class LayerTreeHostAnimationTestScrollOffsetChangesArePropagated
gfx::ScrollOffset(500.f, 550.f),
EaseInOutTimingFunction::Create()));
scoped_ptr<Animation> animation(Animation::Create(
- std::move(curve), 1, 0, Animation::SCROLL_OFFSET));
+ std::move(curve), 1, 0, AnimationTargetProperty::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
bool animation_added =
scroll_layer_->AddAnimation(std::move(animation));
@@ -718,8 +723,8 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval
scoped_ptr<ScrollOffsetAnimationCurve> curve(
ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f),
EaseInOutTimingFunction::Create()));
- scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 0, Animation::SCROLL_OFFSET));
+ scoped_ptr<Animation> animation(Animation::Create(
+ std::move(curve), 1, 0, AnimationTargetProperty::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
scroll_layer_->AddAnimation(std::move(animation));
}
@@ -733,7 +738,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval
case 1: {
Animation* animation =
scroll_layer_->layer_animation_controller()->GetAnimation(
- Animation::SCROLL_OFFSET);
+ AnimationTargetProperty::SCROLL_OFFSET);
scroll_layer_->layer_animation_controller()->RemoveAnimation(
animation->id());
scroll_layer_->SetScrollOffset(final_postion_);
@@ -762,7 +767,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval
host_impl->active_tree()->root_layer()->children()[0].get();
Animation* animation =
scroll_layer_impl->layer_animation_controller()->GetAnimation(
- Animation::SCROLL_OFFSET);
+ AnimationTargetProperty::SCROLL_OFFSET);
if (!animation || animation->run_state() != Animation::RUNNING) {
host_impl->BlockNotifyReadyToActivateForTesting(false);
@@ -864,7 +869,7 @@ class LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers
LayerAnimationController* root_controller_impl =
host_impl->active_tree()->root_layer()->layer_animation_controller();
Animation* root_animation =
- root_controller_impl->GetAnimation(Animation::OPACITY);
+ root_controller_impl->GetAnimation(AnimationTargetProperty::OPACITY);
if (!root_animation || root_animation->run_state() != Animation::RUNNING)
return;
@@ -872,12 +877,12 @@ class LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers
host_impl->active_tree()->root_layer()->children()
[0]->layer_animation_controller();
Animation* child_animation =
- child_controller_impl->GetAnimation(Animation::OPACITY);
+ child_controller_impl->GetAnimation(AnimationTargetProperty::OPACITY);
EXPECT_EQ(Animation::RUNNING, child_animation->run_state());
EXPECT_EQ(root_animation->start_time(), child_animation->start_time());
- root_controller_impl->AbortAnimations(Animation::OPACITY);
- root_controller_impl->AbortAnimations(Animation::TRANSFORM);
- child_controller_impl->AbortAnimations(Animation::OPACITY);
+ root_controller_impl->AbortAnimations(AnimationTargetProperty::OPACITY);
+ root_controller_impl->AbortAnimations(AnimationTargetProperty::TRANSFORM);
+ child_controller_impl->AbortAnimations(AnimationTargetProperty::OPACITY);
EndTest();
}
@@ -932,7 +937,8 @@ class LayerTreeHostAnimationTestPendingTreeAnimatesFirstCommit
LayerImpl* child = root->children()[0].get();
LayerAnimationController* controller_impl =
child->layer_animation_controller();
- Animation* animation = controller_impl->GetAnimation(Animation::TRANSFORM);
+ Animation* animation =
+ controller_impl->GetAnimation(AnimationTargetProperty::TRANSFORM);
// The animation should be starting for the first frame.
EXPECT_EQ(Animation::STARTING, animation->run_state());
@@ -945,7 +951,7 @@ class LayerTreeHostAnimationTestPendingTreeAnimatesFirstCommit
// And the sync tree layer should know it is animating.
EXPECT_TRUE(child->screen_space_transform_is_animating());
- controller_impl->AbortAnimations(Animation::TRANSFORM);
+ controller_impl->AbortAnimations(AnimationTargetProperty::TRANSFORM);
EndTest();
}
@@ -1046,10 +1052,12 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating
for (auto& it : controllers_copy) {
int id = it.first;
if (id == host_impl->RootLayer()->id()) {
- Animation* anim = it.second->GetAnimation(Animation::TRANSFORM);
+ Animation* anim =
+ it.second->GetAnimation(AnimationTargetProperty::TRANSFORM);
EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0);
} else if (id == host_impl->RootLayer()->children()[0]->id()) {
- Animation* anim = it.second->GetAnimation(Animation::OPACITY);
+ Animation* anim =
+ it.second->GetAnimation(AnimationTargetProperty::OPACITY);
EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0);
}
EndTest();
@@ -1086,7 +1094,8 @@ class LayerTreeHostAnimationTestRemoveAnimation
case 2:
LayerAnimationController* controller =
layer_->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::TRANSFORM);
+ Animation* animation =
+ controller->GetAnimation(AnimationTargetProperty::TRANSFORM);
layer_->RemoveAnimation(animation->id());
gfx::Transform transform;
transform.Translate(10.f, 10.f);
@@ -1162,7 +1171,8 @@ class LayerTreeHostAnimationTestIsAnimating
case 2:
LayerAnimationController* controller =
layer_->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::TRANSFORM);
+ Animation* animation =
+ controller->GetAnimation(AnimationTargetProperty::TRANSFORM);
layer_->RemoveAnimation(animation->id());
break;
}
@@ -1310,7 +1320,7 @@ class LayerTreeHostAnimationTestNotifyAnimationFinished
}
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ AnimationTargetProperty target_property,
int group) override {
called_animation_started_ = true;
layer_tree_host()->AnimateLayers(base::TimeTicks::FromInternalValue(
@@ -1319,7 +1329,7 @@ class LayerTreeHostAnimationTestNotifyAnimationFinished
}
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ AnimationTargetProperty target_property,
int group) override {
called_animation_finished_ = true;
EndTest();

Powered by Google App Engine
This is Rietveld 408576698