Index: cc/trees/layer_tree_host_impl_unittest.cc |
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc |
index 9f2a5a2fba0e08a42a81d104ac7bd29a86eb1297..f76abbb239e78ce345f051cc2ef6a4630f5f18f7 100644 |
--- a/cc/trees/layer_tree_host_impl_unittest.cc |
+++ b/cc/trees/layer_tree_host_impl_unittest.cc |
@@ -6723,5 +6723,36 @@ TEST_F(LayerTreeHostImplTest, ExternalTransformReflectedInNextDraw) { |
external_transform, layer->draw_properties().target_space_transform); |
} |
+TEST_F(LayerTreeHostImplTest, ScrollAnimated) { |
+ SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
+ host_impl_->SetViewportSize(gfx::Size(50, 50)); |
+ DrawFrame(); |
+ |
+ base::TimeTicks start_time = |
+ base::TimeTicks() + base::TimeDelta::FromMilliseconds(100); |
+ |
+ EXPECT_EQ(InputHandler::ScrollStarted, |
+ host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50))); |
+ |
+ LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer(); |
+ |
+ host_impl_->Animate(start_time); |
+ host_impl_->UpdateAnimationState(true); |
+ |
+ EXPECT_EQ(gfx::Vector2dF(), scrolling_layer->TotalScrollOffset()); |
+ |
+ host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(50)); |
+ host_impl_->UpdateAnimationState(true); |
+ |
+ float y = scrolling_layer->TotalScrollOffset().y(); |
+ EXPECT_TRUE(y > 1 && y < 49); |
+ |
+ host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200)); |
+ host_impl_->UpdateAnimationState(true); |
+ |
+ EXPECT_EQ(gfx::Vector2dF(0, 50), scrolling_layer->TotalScrollOffset()); |
+ EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
+} |
+ |
} // namespace |
} // namespace cc |