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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 361143002: Impl thread smooth scrolling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 5 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/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698