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 703ad75bb7fa85dd1d9619ee31591af2193ffa47..316e9a335a4b7e86ca896a15c7f5420ace451909 100644 |
--- a/cc/trees/layer_tree_host_unittest_animation.cc |
+++ b/cc/trees/layer_tree_host_unittest_animation.cc |
@@ -264,18 +264,18 @@ class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded |
PostAddAnimationToMainThread(layer_tree_host()->root_layer()); |
} |
+ virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
+ if (num_animates_ == 1) |
+ PostSetVisibleToMainThread(false); |
+ } |
+ |
// Use WillAnimateLayers to set visible false before the animation runs and |
// causes a commit, so we block the second visible animate in single-thread |
// mode. |
virtual void WillAnimateLayers( |
LayerTreeHostImpl* host_impl, |
base::TimeTicks monotonic_time) OVERRIDE { |
- if (num_animates_ < 2) { |
- if (!num_animates_) { |
- // We have a long animation running. It should continue to tick even |
- // if we are not visible. |
- PostSetVisibleToMainThread(false); |
- } |
+ if (num_animates_ < 3) { |
num_animates_++; |
return; |
} |
@@ -311,6 +311,8 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction |
virtual void AnimateLayers( |
LayerTreeHostImpl* host_impl, |
base::TimeTicks monotonic_time) OVERRIDE { |
+ if (!host_impl->active_tree()->root_layer()) |
+ return; |
LayerAnimationController* controller_impl = |
host_impl->active_tree()->root_layer()->children()[0]-> |
layer_animation_controller(); |
@@ -380,6 +382,9 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes |
virtual void UpdateAnimationState( |
LayerTreeHostImpl* impl_host, |
bool has_unfinished_animation) OVERRIDE { |
+ if (!impl_host->active_tree()->root_layer()) |
+ return; |
+ |
LayerAnimationController* controller = |
impl_host->active_tree()->root_layer()->children()[0]-> |
layer_animation_controller(); |
@@ -741,16 +746,18 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations |
virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
LayerTreeHostImpl::FrameData* frame_data, |
bool result) OVERRIDE { |
- if (added_animations_ < 2) |
+ if (host_impl->active_tree()->source_frame_number() < 2) |
return result; |
if (TestEnded()) |
return result; |
// Act like there is checkerboard when the second animation wants to draw. |
++prevented_draw_; |
+ if (finished_times_) |
+ EndTest(); |
return false; |
} |
- virtual void DidCommitAndDrawFrame() OVERRIDE { |
+ virtual void DidCommit() OVERRIDE { |
switch (layer_tree_host()->source_frame_number()) { |
case 1: |
// The animation is longer than 1 BeginFrame interval. |
@@ -774,9 +781,9 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations |
virtual void NotifyAnimationFinished(double wall_clock_time) OVERRIDE { |
// We should be checkerboarding already, but it should still finish the |
// first animation. |
- EXPECT_EQ(2, added_animations_); |
finished_times_++; |
- EndTest(); |
+ if (prevented_draw_) |
+ EndTest(); |
} |
virtual void AfterTest() OVERRIDE { |