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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 661643004: [android] Remove unused scroll delta in TopControls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unittest Added Created 6 years, 2 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
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_host_impl.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_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 5694c01aaa37565bec2f4254a0a41db9cb8092da..693d42e309dba89e677983e2a9bfbfd9b478f189 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -7198,6 +7198,54 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) {
EXPECT_FALSE(host_impl_->top_controls_manager()->animation());
}
+TEST_F(LayerTreeHostImplWithTopControlsTest,
+ TopControlsScrollDeltaInOverScroll) {
+ LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 200));
+ host_impl_->SetViewportSize(gfx::Size(100, 100));
+ host_impl_->top_controls_manager()->UpdateTopControlsState(
+ BOTH, SHOWN, false);
+ DrawFrame();
+
+ EXPECT_EQ(InputHandler::ScrollStarted,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
+
+ float offset = 50;
+ EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)));
+ EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset());
+ EXPECT_EQ(gfx::Vector2dF().ToString(),
+ scroll_layer->TotalScrollOffset().ToString());
+
+ EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)));
+ EXPECT_EQ(gfx::Vector2dF(0, offset).ToString(),
+ scroll_layer->TotalScrollOffset().ToString());
+
+ EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)));
+ EXPECT_EQ(gfx::Vector2dF(0, scroll_layer->MaxScrollOffset().y()).ToString(),
+ scroll_layer->TotalScrollOffset().ToString());
+
+ float overscrollamount = 10;
+ EXPECT_FALSE(
+ host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, overscrollamount)));
+ EXPECT_EQ(gfx::Vector2dF(0, 2 * offset).ToString(),
+ scroll_layer->TotalScrollOffset().ToString());
+ EXPECT_EQ(gfx::Vector2dF(0, overscrollamount).ToString(),
+ host_impl_->accumulated_root_overscroll().ToString());
+
+ EXPECT_TRUE(
+ host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -2 * offset)));
+ EXPECT_EQ(gfx::Vector2dF(0, 0).ToString(),
+ scroll_layer->TotalScrollOffset().ToString());
+ EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset());
+
+ EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -offset)));
+ EXPECT_EQ(gfx::Vector2dF(0, 0).ToString(),
+ scroll_layer->TotalScrollOffset().ToString());
+ EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
+
+ host_impl_->ScrollEnd();
+}
+
class LayerTreeHostImplVirtualViewportTest : public LayerTreeHostImplTest {
public:
void SetupVirtualViewportLayers(const gfx::Size& content_size,
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698