Chromium Code Reviews| 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 207957d3548be7d6031997bbc411cff34818ccaf..42029437ee4701f7dd7ee5afd3d342f0cc2ef217 100644 |
| --- a/content/browser/renderer_host/render_widget_host_unittest.cc |
| +++ b/content/browser/renderer_host/render_widget_host_unittest.cc |
| @@ -3141,8 +3141,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 |
| @@ -3169,8 +3169,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()); |
| @@ -3181,14 +3181,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 |
| @@ -3212,13 +3212,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()); |
|
sadrul
2013/07/18 22:51:41
Why does the expectation change here?
rharrison
2013/07/23 14:36:02
I don't know... this appears to be wrong now. Reve
|
| // Indicate the end of the scrolling from the touchpad. |
| SimulateGestureFlingStartEvent(-1200.f, 0.f, WebGestureEvent::Touchpad); |
| @@ -3242,7 +3242,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); |
| @@ -3256,7 +3256,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); |
| @@ -3265,7 +3265,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); |
| @@ -3274,7 +3274,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); |
| @@ -3286,13 +3286,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); |
| @@ -3302,7 +3302,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); |
| @@ -3319,7 +3319,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); |
| @@ -3328,7 +3328,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); |
| @@ -3337,7 +3337,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); |
| @@ -3366,7 +3366,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); |
| @@ -3375,7 +3375,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); |
| @@ -3384,7 +3384,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); |
| @@ -3483,7 +3483,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(); |
| @@ -3496,7 +3496,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()); |
| @@ -3511,36 +3511,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()); |
| -} |
|
sadrul
2013/07/18 22:51:41
Can you update this test to test that there is no
rharrison
2013/07/23 14:36:02
Done.
|
| - |
| // Tests that the overscroll controller plays nice with touch-scrolls and the |
| // gesture event filter with debounce filtering turned on. |
| TEST_F(RenderWidgetHostTest, GestureScrollDebounceOverscrolls) { |
| @@ -3557,7 +3527,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()); |
| @@ -3579,7 +3549,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()); |
| @@ -3599,7 +3569,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()); |
| @@ -3637,7 +3607,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()); |
| @@ -3712,7 +3682,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, |
| @@ -3730,7 +3700,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()); |
| @@ -3852,7 +3822,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, |
| @@ -3910,7 +3880,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, |
| @@ -4015,8 +3985,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 |
| @@ -4133,9 +4103,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(); |