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

Unified Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 1971063004: cc: Fix cc_unittests when main frame before activation is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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/scheduler/scheduler_state_machine_unittest.cc ('k') | no next file » | 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 22a3d554b1f093bc4aeb372a24ae23b50d632383..16efbec7040ac4f642248298038eaadb4634a169 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -862,41 +862,14 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval
}
void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override {
- host_impl->BlockNotifyReadyToActivateForTesting(true);
+ host_impl->BlockNotifyReadyToActivateForTesting(
+ ShouldBlockActivation(host_impl));
}
void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
const BeginFrameArgs& args) override {
- if (!host_impl->pending_tree())
- return;
-
- if (!host_impl->active_tree()->root_layer()) {
- host_impl->BlockNotifyReadyToActivateForTesting(false);
- return;
- }
-
- scoped_refptr<AnimationTimeline> timeline_impl =
- host_impl->animation_host()->GetTimelineById(timeline_id_);
- scoped_refptr<AnimationPlayer> player_impl =
- timeline_impl->GetPlayerById(player_child_id_);
-
- LayerImpl* scroll_layer_impl =
- host_impl->active_tree()->LayerById(scroll_layer_->id());
- Animation* animation = player_impl->element_animations()
- ->GetAnimation(TargetProperty::SCROLL_OFFSET);
-
- if (!animation || animation->run_state() != Animation::RUNNING) {
- host_impl->BlockNotifyReadyToActivateForTesting(false);
- return;
- }
-
- // Block activation until the running animation has a chance to produce a
- // scroll delta.
- gfx::Vector2dF scroll_delta = ScrollDelta(scroll_layer_impl);
- if (scroll_delta.x() < 1.f || scroll_delta.y() < 1.f)
- return;
-
- host_impl->BlockNotifyReadyToActivateForTesting(false);
+ host_impl->BlockNotifyReadyToActivateForTesting(
+ ShouldBlockActivation(host_impl));
}
void WillActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
@@ -921,6 +894,35 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval
}
private:
+ bool ShouldBlockActivation(LayerTreeHostImpl* host_impl) {
+ if (!host_impl->pending_tree())
+ return false;
+
+ if (!host_impl->active_tree()->root_layer())
+ return false;
+
+ scoped_refptr<AnimationTimeline> timeline_impl =
+ host_impl->animation_host()->GetTimelineById(timeline_id_);
+ scoped_refptr<AnimationPlayer> player_impl =
+ timeline_impl->GetPlayerById(player_child_id_);
+
+ LayerImpl* scroll_layer_impl =
+ host_impl->active_tree()->LayerById(scroll_layer_->id());
+ Animation* animation = player_impl->element_animations()->GetAnimation(
+ TargetProperty::SCROLL_OFFSET);
+
+ if (!animation || animation->run_state() != Animation::RUNNING)
+ return false;
+
+ // Block activation until the running animation has a chance to produce a
+ // scroll delta.
+ gfx::Vector2dF scroll_delta = ScrollDelta(scroll_layer_impl);
+ if (scroll_delta.x() > 0.f || scroll_delta.y() > 0.f)
+ return false;
+
+ return true;
+ }
+
FakeContentLayerClient client_;
scoped_refptr<FakePictureLayer> scroll_layer_;
const gfx::ScrollOffset final_postion_;
« no previous file with comments | « cc/scheduler/scheduler_state_machine_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698