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

Unified Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11365238: cc: Return whether any layer was scrolled from InputHandlerClient::scrollBy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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/layer_tree_host_impl.cc ('k') | webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_impl_unittest.cc
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index ce71ced10d8f1f5c504d3e2adfa3d0ce72ebfd03..9ac89709b85013dac4d73446d4a1661111328c05 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -479,6 +479,35 @@ TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionWithOffset)
EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(10, 10), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread);
}
+TEST_P(LayerTreeHostImplTest, scrollByReturnsCorrectValue)
+{
+ setupScrollAndContentsLayers(gfx::Size(200, 200));
+ m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
+
+ initializeRendererAndDrawFrame();
+
+ EXPECT_EQ(InputHandlerClient::ScrollStarted,
+ m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
+
+ // Trying to scroll to the left/top will not succeed.
+ EXPECT_FALSE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0)));
+ EXPECT_FALSE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, -10)));
+ EXPECT_FALSE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, -10)));
+
+ // Scrolling to the right/bottom will succeed.
+ EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, 0)));
+ EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10)));
+ EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, 10)));
+
+ // Scrolling to left/top will now succeed.
+ EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0)));
+ EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, -10)));
+ EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, -10)));
+
+ // Trying to scroll more than the available space will also succeed.
+ EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(5000, 5000)));
+}
+
TEST_P(LayerTreeHostImplTest, maxScrollOffsetChangedByDeviceScaleFactor)
{
setupScrollAndContentsLayers(gfx::Size(100, 100));
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | webkit/compositor_bindings/web_to_ccinput_handler_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698