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

Unified Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_settings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 83181925b3dd09267e7d7cd17e06f46008dcd0ea..f6bc4d9011b9db51a03597d52fcce8e377252d78 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -106,13 +106,12 @@ MULTI_THREAD_TEST_F(
LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback);
// Add a layer animation and confirm that
-// LayerTreeHostImpl::updateAnimationState does get called and continues to
-// get called.
+// LayerTreeHostImpl::UpdateAnimationState does get called.
class LayerTreeHostAnimationTestAddAnimation
: public LayerTreeHostAnimationTest {
public:
LayerTreeHostAnimationTestAddAnimation()
- : num_begin_frames_(0), received_animation_started_notification_(false) {}
+ : update_animation_state_was_called_(false) {}
void BeginTest() override {
PostAddInstantAnimationToMainThread(layer_tree_host()->root_layer());
@@ -120,53 +119,28 @@ class LayerTreeHostAnimationTestAddAnimation
void UpdateAnimationState(LayerTreeHostImpl* host_impl,
bool has_unfinished_animation) override {
- if (!num_begin_frames_) {
- // The animation had zero duration so LayerTreeHostImpl should no
- // longer need to animate its layers.
- EXPECT_FALSE(has_unfinished_animation);
- num_begin_frames_++;
- return;
- }
-
- if (received_animation_started_notification_) {
- EXPECT_LT(base::TimeTicks(), start_time_);
-
- LayerAnimationController* controller_impl =
- host_impl->active_tree()->root_layer()->layer_animation_controller();
- Animation* animation_impl =
- controller_impl->GetAnimation(Animation::Opacity);
- if (animation_impl)
- controller_impl->RemoveAnimation(animation_impl->id());
-
- EndTest();
- }
+ EXPECT_FALSE(has_unfinished_animation);
+ update_animation_state_was_called_ = true;
}
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
Animation::TargetProperty target_property,
int group) override {
- received_animation_started_notification_ = true;
- start_time_ = monotonic_time;
- if (num_begin_frames_) {
- EXPECT_LT(base::TimeTicks(), start_time_);
-
- LayerAnimationController* controller =
- layer_tree_host()->root_layer()->layer_animation_controller();
- Animation* animation =
- controller->GetAnimation(Animation::Opacity);
- if (animation)
- controller->RemoveAnimation(animation->id());
+ EXPECT_LT(base::TimeTicks(), monotonic_time);
- EndTest();
- }
+ LayerAnimationController* controller =
+ layer_tree_host()->root_layer()->layer_animation_controller();
+ Animation* animation = controller->GetAnimation(Animation::Opacity);
+ if (animation)
+ controller->RemoveAnimation(animation->id());
+
+ EndTest();
}
- void AfterTest() override {}
+ void AfterTest() override { EXPECT_TRUE(update_animation_state_was_called_); }
private:
- int num_begin_frames_;
- bool received_animation_started_notification_;
- base::TimeTicks start_time_;
+ bool update_animation_state_was_called_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestAddAnimation);
@@ -531,9 +505,7 @@ SINGLE_AND_MULTI_THREAD_TEST_F(
class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
: public LayerTreeHostAnimationTest {
public:
- LayerTreeHostAnimationTestSynchronizeAnimationStartTimes()
- : main_start_time_(-1.0),
- impl_start_time_(-1.0) {}
+ LayerTreeHostAnimationTestSynchronizeAnimationStartTimes() {}
void SetupTree() override {
LayerTreeHostAnimationTest::SetupTree();
@@ -553,12 +525,9 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
layer_animation_controller();
Animation* animation =
controller->GetAnimation(Animation::Opacity);
- main_start_time_ =
- (animation->start_time() - base::TimeTicks()).InSecondsF();
+ main_start_time_ = animation->start_time();
controller->RemoveAnimation(animation->id());
-
- if (impl_start_time_ > 0.0)
- EndTest();
+ EndTest();
}
void UpdateAnimationState(LayerTreeHostImpl* impl_host,
@@ -571,21 +540,17 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
if (!animation)
return;
- impl_start_time_ =
- (animation->start_time() - base::TimeTicks()).InSecondsF();
- controller->RemoveAnimation(animation->id());
-
- if (main_start_time_ > 0.0)
- EndTest();
+ impl_start_time_ = animation->start_time();
}
void AfterTest() override {
- EXPECT_FLOAT_EQ(impl_start_time_, main_start_time_);
+ EXPECT_EQ(impl_start_time_, main_start_time_);
+ EXPECT_LT(base::TimeTicks(), impl_start_time_);
}
private:
- double main_start_time_;
- double impl_start_time_;
+ base::TimeTicks main_start_time_;
+ base::TimeTicks impl_start_time_;
FakeContentLayerClient client_;
scoped_refptr<FakeContentLayer> content_;
};
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698