From bbc69ad5146233db8d14a3ca0f6a4ad5dbe56dc5 Mon Sep 17 00:00:00 2001 From: "tedchoc@chromium.org" Date: Mon, 11 Feb 2013 21:53:47 +0000 Subject: Top controls hiding anchor should only apply on scroll up. Toolbar should hide right away (bottom of the toolbar = new anchor position) when scrolling down the page. TEST=run cc_unittests -f TopControlsManagerTest* BUG=174446 Review URL: https://chromiumcodereview.appspot.com/12225073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181767 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/top_controls_manager_unittest.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cc/top_controls_manager_unittest.cc') diff --git a/cc/top_controls_manager_unittest.cc b/cc/top_controls_manager_unittest.cc index 1418be3..d201454 100644 --- a/cc/top_controls_manager_unittest.cc +++ b/cc/top_controls_manager_unittest.cc @@ -180,6 +180,19 @@ TEST(TopControlsManagerTest, ensureScrollThresholdApplied) { EXPECT_EQ(0.f, manager->content_top_offset()); client.rootScrollLayer()->setScrollOffset(gfx::Vector2d(0, 240)); + // Reset the scroll threshold by going further up the page than the initial + // threshold. + manager->ScrollBy(gfx::Vector2dF(0.f, -100.f)); + EXPECT_EQ(0.f, manager->controls_top_offset()); + EXPECT_EQ(0.f, manager->content_top_offset()); + client.rootScrollLayer()->setScrollOffset(gfx::Vector2d(0, 140)); + + // See that scrolling down the page now will result in the controls hiding. + manager->ScrollBy(gfx::Vector2dF(0.f, 20.f)); + EXPECT_EQ(-20.f, manager->controls_top_offset()); + EXPECT_EQ(0.f, manager->content_top_offset()); + client.rootScrollLayer()->setScrollOffset(gfx::Vector2d(0, 160)); + manager->ScrollEnd(); } -- cgit v1.1