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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 393713002: Scroll offset animation curve retargeting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove workaround. 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') | ui/gfx/geometry/cubic_bezier.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 d9d3d570d657a4b9add12a57a17448329ac6505c..d185f7427982c343c5c90a0280e68bc09201fcc7 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -6737,7 +6737,7 @@ TEST_F(LayerTreeHostImplTest, ExternalTransformReflectedInNextDraw) {
}
TEST_F(LayerTreeHostImplTest, ScrollAnimated) {
- SetupScrollAndContentsLayers(gfx::Size(100, 100));
+ SetupScrollAndContentsLayers(gfx::Size(100, 150));
host_impl_->SetViewportSize(gfx::Size(50, 50));
DrawFrame();
@@ -6760,10 +6760,21 @@ TEST_F(LayerTreeHostImplTest, ScrollAnimated) {
float y = scrolling_layer->TotalScrollOffset().y();
EXPECT_TRUE(y > 1 && y < 49);
+ // Update target.
+ EXPECT_EQ(InputHandler::ScrollStarted,
+ host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50)));
+
host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200));
host_impl_->UpdateAnimationState(true);
- EXPECT_EQ(gfx::Vector2dF(0, 50), scrolling_layer->TotalScrollOffset());
+ y = scrolling_layer->TotalScrollOffset().y();
+ EXPECT_TRUE(y > 50 && y < 100);
+ EXPECT_EQ(scrolling_layer, host_impl_->CurrentlyScrollingLayer());
+
+ host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(250));
+ host_impl_->UpdateAnimationState(true);
+
+ EXPECT_EQ(gfx::Vector2dF(0, 100), scrolling_layer->TotalScrollOffset());
EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer());
}
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | ui/gfx/geometry/cubic_bezier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698