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

Unified Diff: content/browser/renderer_host/render_widget_host_unittest.cc

Issue 11574047: overscroll: Send all gesture-events to the gesture-event filter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add a test. Created 8 years 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 | « content/browser/renderer_host/overscroll_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_unittest.cc
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index dc74728e57ef78468affda3f3f56b1123c0b2e45..b882761a893bfe7f47ab7dcdc60607be5cb6b0b8 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -2710,6 +2710,48 @@ TEST_F(RenderWidgetHostTest, WheelScrollOverscrollToggle) {
EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y());
}
+TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithFling) {
+ host_->SetupForOverscrollControllerTest();
+ process_->sink().ClearMessages();
+
+ // Send a wheel event. ACK the event as not processed. This should not
+ // initiate an overscroll gesture since it doesn't cross the threshold yet.
+ SimulateWheelEvent(10, -5, 0);
+ EXPECT_EQ(1U, process_->sink().message_count());
+ SendInputEventACK(WebInputEvent::MouseWheel, false);
+ EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
+ EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode());
+ process_->sink().ClearMessages();
+
+ // Scroll some more so as to not overscroll.
+ SimulateWheelEvent(10, -4, 0);
+ EXPECT_EQ(1U, process_->sink().message_count());
+ SendInputEventACK(WebInputEvent::MouseWheel, false);
+ EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
+ EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode());
+ process_->sink().ClearMessages();
+
+ // Scroll some more to initiate an overscroll.
+ SimulateWheelEvent(20, -4, 0);
+ EXPECT_EQ(1U, process_->sink().message_count());
+ SendInputEventACK(WebInputEvent::MouseWheel, false);
+ EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode());
+ EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode());
+ EXPECT_EQ(40.f, host_->overscroll_delta_x());
+ EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x());
+ EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y());
+ process_->sink().ClearMessages();
+ EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize());
+
+ // Send a fling start, but with a small velocity, so that the overscroll is
+ // aborted. The fling should proceed to the renderer, through the gesture
+ // event filter.
+ SimulateGestureFlingStartEvent(0.f, 0.f);
+ EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
+ EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
+ EXPECT_EQ(1U, process_->sink().message_count());
+}
+
// Tests that touch-scroll events are handled correctly by the overscroll
// controller. This also tests that the overscroll controller and the
// gesture-event filter play nice with each other.
« no previous file with comments | « content/browser/renderer_host/overscroll_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698