| 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 0b750e3284a0ff9f45df74a0e06e212a2d840a2a..ccc409b6a8420c4d78d66013c091176f82a392e4 100644
|
| --- a/content/browser/renderer_host/render_widget_host_unittest.cc
|
| +++ b/content/browser/renderer_host/render_widget_host_unittest.cc
|
| @@ -3134,8 +3134,8 @@ TEST_F(RenderWidgetHostTest, WheelScrollEventOverscrolls) {
|
| process_->sink().ClearMessages();
|
|
|
| // Simulate wheel events.
|
| - SimulateWheelEvent(0, -5, 0, true); // sent directly
|
| - SimulateWheelEvent(0, -1, 0, true); // enqueued
|
| + SimulateWheelEvent(-5, 0, 0, true); // sent directly
|
| + SimulateWheelEvent(-1, 1, 0, true); // enqueued
|
| SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event
|
| SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event
|
| SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event
|
| @@ -3162,8 +3162,8 @@ TEST_F(RenderWidgetHostTest, WheelScrollEventOverscrolls) {
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode());
|
| EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->current_mode());
|
| - EXPECT_EQ(-75.f, host_->overscroll_delta_x());
|
| - EXPECT_EQ(-25.f, host_->overscroll_delegate()->delta_x());
|
| + EXPECT_EQ(-81.f, host_->overscroll_delta_x());
|
| + EXPECT_EQ(-31.f, host_->overscroll_delegate()->delta_x());
|
| EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y());
|
| EXPECT_EQ(0U, process_->sink().message_count());
|
|
|
| @@ -3174,14 +3174,14 @@ TEST_F(RenderWidgetHostTest, WheelScrollEventOverscrolls) {
|
| }
|
|
|
| // Tests that if some scroll events are consumed towards the start, then
|
| -// subsequent scrolls do not overscroll.
|
| -TEST_F(RenderWidgetHostTest, WheelScrollConsumedDoNotOverscroll) {
|
| +// subsequent scrolls do not horizontal overscroll.
|
| +TEST_F(RenderWidgetHostTest, WheelScrollConsumedDoNotHorizOverscroll) {
|
| host_->SetupForOverscrollControllerTest();
|
| process_->sink().ClearMessages();
|
|
|
| // Simulate wheel events.
|
| - SimulateWheelEvent(0, -5, 0, true); // sent directly
|
| - SimulateWheelEvent(0, -1, 0, true); // enqueued
|
| + SimulateWheelEvent(-5, 0, 0, true); // sent directly
|
| + SimulateWheelEvent(-1, -1, 0, true); // enqueued
|
| SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event
|
| SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event
|
| SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event
|
| @@ -3205,13 +3205,13 @@ TEST_F(RenderWidgetHostTest, WheelScrollConsumedDoNotOverscroll) {
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
|
| - EXPECT_EQ(1U, process_->sink().message_count());
|
| + EXPECT_EQ(0U, process_->sink().message_count());
|
|
|
| process_->sink().ClearMessages();
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| EXPECT_EQ(0U, process_->sink().message_count());
|
| - EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
|
| + EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode());
|
|
|
| // Indicate the end of the scrolling from the touchpad.
|
| SimulateGestureFlingStartEvent(-1200.f, 0.f, WebGestureEvent::Touchpad);
|
| @@ -3235,7 +3235,7 @@ TEST_F(RenderWidgetHostTest, WheelScrollConsumedDoNotOverscroll) {
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
|
| EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode());
|
| - EXPECT_EQ(1U, process_->sink().message_count());
|
| + EXPECT_EQ(0U, process_->sink().message_count());
|
| process_->sink().ClearMessages();
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -3249,7 +3249,7 @@ TEST_F(RenderWidgetHostTest, WheelScrollOverscrollToggle) {
|
|
|
| // 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, true);
|
| + SimulateWheelEvent(10, 0, 0, true);
|
| EXPECT_EQ(1U, process_->sink().message_count());
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -3258,7 +3258,7 @@ TEST_F(RenderWidgetHostTest, WheelScrollOverscrollToggle) {
|
| process_->sink().ClearMessages();
|
|
|
| // Scroll some more so as to not overscroll.
|
| - SimulateWheelEvent(10, -4, 0, true);
|
| + SimulateWheelEvent(10, 0, 0, true);
|
| EXPECT_EQ(1U, process_->sink().message_count());
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -3267,7 +3267,7 @@ TEST_F(RenderWidgetHostTest, WheelScrollOverscrollToggle) {
|
| process_->sink().ClearMessages();
|
|
|
| // Scroll some more to initiate an overscroll.
|
| - SimulateWheelEvent(40, -4, 0, true);
|
| + SimulateWheelEvent(40, 0, 0, true);
|
| EXPECT_EQ(1U, process_->sink().message_count());
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -3279,13 +3279,13 @@ TEST_F(RenderWidgetHostTest, WheelScrollOverscrollToggle) {
|
| process_->sink().ClearMessages();
|
|
|
| // Scroll in the reverse direction enough to abort the overscroll.
|
| - SimulateWheelEvent(-20, -4, 0, true);
|
| + SimulateWheelEvent(-20, 0, 0, true);
|
| EXPECT_EQ(0U, process_->sink().message_count());
|
| EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
|
| EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode());
|
|
|
| // Continue to scroll in the reverse direction.
|
| - SimulateWheelEvent(-20, 4, 0, true);
|
| + SimulateWheelEvent(-20, 0, 0, true);
|
| EXPECT_EQ(1U, process_->sink().message_count());
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -3295,7 +3295,7 @@ TEST_F(RenderWidgetHostTest, WheelScrollOverscrollToggle) {
|
|
|
| // Continue to scroll in the reverse direction enough to initiate overscroll
|
| // in that direction.
|
| - SimulateWheelEvent(-55, -2, 0, true);
|
| + SimulateWheelEvent(-55, 0, 0, true);
|
| EXPECT_EQ(1U, process_->sink().message_count());
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -3312,7 +3312,7 @@ TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithFling) {
|
|
|
| // 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, true);
|
| + SimulateWheelEvent(10, 0, 0, true);
|
| EXPECT_EQ(1U, process_->sink().message_count());
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -3321,7 +3321,7 @@ TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithFling) {
|
| process_->sink().ClearMessages();
|
|
|
| // Scroll some more so as to not overscroll.
|
| - SimulateWheelEvent(20, -4, 0, true);
|
| + SimulateWheelEvent(20, 0, 0, true);
|
| EXPECT_EQ(1U, process_->sink().message_count());
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -3330,7 +3330,7 @@ TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithFling) {
|
| process_->sink().ClearMessages();
|
|
|
| // Scroll some more to initiate an overscroll.
|
| - SimulateWheelEvent(30, -4, 0, true);
|
| + SimulateWheelEvent(30, 0, 0, true);
|
| EXPECT_EQ(1U, process_->sink().message_count());
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -3359,7 +3359,7 @@ TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithZeroFling) {
|
|
|
| // 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, true);
|
| + SimulateWheelEvent(10, 0, 0, true);
|
| EXPECT_EQ(1U, process_->sink().message_count());
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -3368,7 +3368,7 @@ TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithZeroFling) {
|
| process_->sink().ClearMessages();
|
|
|
| // Scroll some more so as to not overscroll.
|
| - SimulateWheelEvent(20, -4, 0, true);
|
| + SimulateWheelEvent(20, 0, 0, true);
|
| EXPECT_EQ(1U, process_->sink().message_count());
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -3377,7 +3377,7 @@ TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithZeroFling) {
|
| process_->sink().ClearMessages();
|
|
|
| // Scroll some more to initiate an overscroll.
|
| - SimulateWheelEvent(30, -4, 0, true);
|
| + SimulateWheelEvent(30, 0, 0, true);
|
| EXPECT_EQ(1U, process_->sink().message_count());
|
| SendInputEventACK(WebInputEvent::MouseWheel,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| @@ -3476,7 +3476,7 @@ TEST_F(RenderWidgetHostTest, GestureScrollOverscrolls) {
|
| EXPECT_EQ(55.f, host_->overscroll_delta_x());
|
| EXPECT_EQ(-5.f, host_->overscroll_delta_y());
|
| EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x());
|
| - EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y());
|
| + EXPECT_EQ(-5.f, host_->overscroll_delegate()->delta_y());
|
| EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize());
|
| process_->sink().ClearMessages();
|
|
|
| @@ -3489,7 +3489,7 @@ TEST_F(RenderWidgetHostTest, GestureScrollOverscrolls) {
|
| EXPECT_EQ(65.f, host_->overscroll_delta_x());
|
| EXPECT_EQ(-10.f, host_->overscroll_delta_y());
|
| EXPECT_EQ(15.f, host_->overscroll_delegate()->delta_x());
|
| - EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y());
|
| + EXPECT_EQ(-10.f, host_->overscroll_delegate()->delta_y());
|
| EXPECT_EQ(0U, process_->sink().message_count());
|
| EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize());
|
|
|
| @@ -3504,36 +3504,6 @@ TEST_F(RenderWidgetHostTest, GestureScrollOverscrolls) {
|
| EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
|
| }
|
|
|
| -// Tests that if the page is scrolled because of a scroll-gesture, then that
|
| -// particular scroll sequence never generates overscroll, even if there is no
|
| -// content to scroll on the page anymore.
|
| -TEST_F(RenderWidgetHostTest, GestureScrollConsumedDoNotOverscroll) {
|
| - // Turn off debounce handling for test isolation.
|
| - host_->SetupForOverscrollControllerTest();
|
| - host_->set_debounce_interval_time_ms(0);
|
| - process_->sink().ClearMessages();
|
| -
|
| - SimulateGestureEvent(WebInputEvent::GestureScrollBegin,
|
| - WebGestureEvent::Touchscreen);
|
| - SimulateGestureScrollUpdateEvent(8, -5, 0);
|
| -
|
| - // ACK both events as being processed.
|
| - SendInputEventACK(WebInputEvent::GestureScrollBegin,
|
| - INPUT_EVENT_ACK_STATE_CONSUMED);
|
| - SendInputEventACK(WebInputEvent::GestureScrollUpdate,
|
| - INPUT_EVENT_ACK_STATE_CONSUMED);
|
| - EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
|
| - EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode());
|
| -
|
| - // Send another gesture event and ACK as not being processed. This should
|
| - // not initiate overscroll because the beginning of the scroll event did
|
| - // scroll some content on the page.
|
| - SimulateGestureScrollUpdateEvent(55, -5, 0);
|
| - SendInputEventACK(WebInputEvent::GestureScrollUpdate,
|
| - INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| - EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
|
| -}
|
| -
|
| // Tests that the overscroll controller plays nice with touch-scrolls and the
|
| // gesture event filter with debounce filtering turned on.
|
| TEST_F(RenderWidgetHostTest, GestureScrollDebounceOverscrolls) {
|
| @@ -3550,7 +3520,7 @@ TEST_F(RenderWidgetHostTest, GestureScrollDebounceOverscrolls) {
|
| INPUT_EVENT_ACK_STATE_CONSUMED);
|
|
|
| // Send update events.
|
| - SimulateGestureScrollUpdateEvent(25, -5, 0);
|
| + SimulateGestureScrollUpdateEvent(25, 0, 0);
|
| EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
|
| EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize());
|
| EXPECT_TRUE(host_->ScrollingInProgress());
|
| @@ -3572,7 +3542,7 @@ TEST_F(RenderWidgetHostTest, GestureScrollDebounceOverscrolls) {
|
| EXPECT_EQ(2U, host_->GestureEventDebouncingQueueSize());
|
|
|
| // Send another update event. This should get into the queue.
|
| - SimulateGestureScrollUpdateEvent(30, 5, 0);
|
| + SimulateGestureScrollUpdateEvent(30, 0, 0);
|
| EXPECT_EQ(0U, process_->sink().message_count());
|
| EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize());
|
| EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize());
|
| @@ -3592,7 +3562,7 @@ TEST_F(RenderWidgetHostTest, GestureScrollDebounceOverscrolls) {
|
| process_->sink().ClearMessages();
|
|
|
| // Send another update event. This should get into the queue.
|
| - SimulateGestureScrollUpdateEvent(10, 5, 0);
|
| + SimulateGestureScrollUpdateEvent(10, 0, 0);
|
| EXPECT_EQ(0U, process_->sink().message_count());
|
| EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize());
|
| EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize());
|
| @@ -3630,7 +3600,7 @@ TEST_F(RenderWidgetHostTest, GestureScrollDebounceTimerOverscroll) {
|
| INPUT_EVENT_ACK_STATE_CONSUMED);
|
|
|
| // Send update events.
|
| - SimulateGestureScrollUpdateEvent(55, -5, 0);
|
| + SimulateGestureScrollUpdateEvent(55, 0, 0);
|
| EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize());
|
| EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize());
|
| EXPECT_TRUE(host_->ScrollingInProgress());
|
| @@ -3705,7 +3675,7 @@ TEST_F(RenderWidgetHostTest, OverscrollWithTouchEvents) {
|
|
|
| SimulateGestureEvent(WebInputEvent::GestureScrollBegin,
|
| WebGestureEvent::Touchscreen);
|
| - SimulateGestureScrollUpdateEvent(20, 4, 0);
|
| + SimulateGestureScrollUpdateEvent(20, 0, 0);
|
| SendInputEventACK(WebInputEvent::GestureScrollBegin,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| SendInputEventACK(WebInputEvent::GestureScrollUpdate,
|
| @@ -3723,7 +3693,7 @@ TEST_F(RenderWidgetHostTest, OverscrollWithTouchEvents) {
|
|
|
| SendInputEventACK(WebInputEvent::TouchMove,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| - SimulateGestureScrollUpdateEvent(45, 5, 0);
|
| + SimulateGestureScrollUpdateEvent(45, 0, 0);
|
| SendInputEventACK(WebInputEvent::GestureScrollUpdate,
|
| INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode());
|
| @@ -3845,7 +3815,7 @@ TEST_F(RenderWidgetHostTest, TouchGestureEndDispatchedAfterOverscrollComplete) {
|
| EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode());
|
| EXPECT_EQ(55.f, host_->overscroll_delta_x());
|
| EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x());
|
| - EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y());
|
| + EXPECT_EQ(-5.f, host_->overscroll_delegate()->delta_y());
|
|
|
| // Send end event.
|
| SimulateGestureEvent(WebKit::WebInputEvent::GestureScrollEnd,
|
| @@ -3903,7 +3873,7 @@ TEST_F(RenderWidgetHostTest, TouchGestureEndDispatchedAfterOverscrollComplete) {
|
| EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode());
|
| EXPECT_EQ(235.f, host_->overscroll_delta_x());
|
| EXPECT_EQ(185.f, host_->overscroll_delegate()->delta_x());
|
| - EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y());
|
| + EXPECT_EQ(-5.f, host_->overscroll_delegate()->delta_y());
|
|
|
| // Send end event.
|
| SimulateGestureEvent(WebKit::WebInputEvent::GestureScrollEnd,
|
| @@ -4008,8 +3978,8 @@ TEST_F(RenderWidgetHostTest, OverscrollMouseMoveCompletion) {
|
| view_->set_bounds(gfx::Rect(0, 0, 400, 200));
|
| view_->Show();
|
|
|
| - SimulateWheelEvent(0, -5, 0, true); // sent directly
|
| - SimulateWheelEvent(0, -1, 0, true); // enqueued
|
| + SimulateWheelEvent(5, 0, 0, true); // sent directly
|
| + SimulateWheelEvent(-1, 0, 0, true); // enqueued
|
| SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event
|
| SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event
|
| SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event
|
| @@ -4126,9 +4096,9 @@ TEST_F(RenderWidgetHostTest, OverscrollStateResetsAfterScroll) {
|
| EXPECT_TRUE(host_->ScrollStateIsUnknown());
|
| EXPECT_EQ(0U, process_->sink().message_count());
|
|
|
| - SimulateWheelEvent(0, -5, 0, true); // sent directly
|
| - SimulateWheelEvent(-60, -1, 0, true); // enqueued
|
| - SimulateWheelEvent(-100, -3, 0, true); // coalesced into previous event
|
| + SimulateWheelEvent(-5, 0, 0, true); // sent directly
|
| + SimulateWheelEvent(-60, 0, 0, true); // enqueued
|
| + SimulateWheelEvent(-100, 0, 0, true); // coalesced into previous event
|
| EXPECT_EQ(1U, process_->sink().message_count());
|
| EXPECT_TRUE(host_->ScrollStateIsUnknown());
|
| process_->sink().ClearMessages();
|
|
|