| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
| 8 #include "base/timer/timer.h" | 8 #include "base/timer/timer.h" |
| 9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
| 10 #include "content/browser/renderer_host/backing_store.h" | 10 #include "content/browser/renderer_host/backing_store.h" |
| (...skipping 3116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3127 } | 3127 } |
| 3128 #endif | 3128 #endif |
| 3129 | 3129 |
| 3130 // Tests that scroll ACKs are correctly handled by the overscroll-navigation | 3130 // Tests that scroll ACKs are correctly handled by the overscroll-navigation |
| 3131 // controller. | 3131 // controller. |
| 3132 TEST_F(RenderWidgetHostTest, WheelScrollEventOverscrolls) { | 3132 TEST_F(RenderWidgetHostTest, WheelScrollEventOverscrolls) { |
| 3133 host_->SetupForOverscrollControllerTest(); | 3133 host_->SetupForOverscrollControllerTest(); |
| 3134 process_->sink().ClearMessages(); | 3134 process_->sink().ClearMessages(); |
| 3135 | 3135 |
| 3136 // Simulate wheel events. | 3136 // Simulate wheel events. |
| 3137 SimulateWheelEvent(0, -5, 0, true); // sent directly | 3137 SimulateWheelEvent(-5, 0, 0, true); // sent directly |
| 3138 SimulateWheelEvent(0, -1, 0, true); // enqueued | 3138 SimulateWheelEvent(-1, 1, 0, true); // enqueued |
| 3139 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event | 3139 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event |
| 3140 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event | 3140 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event |
| 3141 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event | 3141 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event |
| 3142 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers | 3142 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers |
| 3143 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3143 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3144 EXPECT_EQ(1U, process_->sink().message_count()); | 3144 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3145 process_->sink().ClearMessages(); | 3145 process_->sink().ClearMessages(); |
| 3146 | 3146 |
| 3147 // Receive ACK the first wheel event as not processed. | 3147 // Receive ACK the first wheel event as not processed. |
| 3148 SendInputEventACK(WebInputEvent::MouseWheel, | 3148 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3149 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3149 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3150 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3150 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3151 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3151 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3152 EXPECT_EQ(1U, process_->sink().message_count()); | 3152 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3153 process_->sink().ClearMessages(); | 3153 process_->sink().ClearMessages(); |
| 3154 | 3154 |
| 3155 // Receive ACK for the second (coalesced) event as not processed. This will | 3155 // Receive ACK for the second (coalesced) event as not processed. This will |
| 3156 // start a back navigation. However, this will also cause the queued next | 3156 // start a back navigation. However, this will also cause the queued next |
| 3157 // event to be sent to the renderer. But since overscroll navigation has | 3157 // event to be sent to the renderer. But since overscroll navigation has |
| 3158 // started, that event will also be included in the overscroll computation | 3158 // started, that event will also be included in the overscroll computation |
| 3159 // instead of being sent to the renderer. So the result will be an overscroll | 3159 // instead of being sent to the renderer. So the result will be an overscroll |
| 3160 // back navigation, and no event will be sent to the renderer. | 3160 // back navigation, and no event will be sent to the renderer. |
| 3161 SendInputEventACK(WebInputEvent::MouseWheel, | 3161 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3162 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3162 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3163 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); | 3163 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); |
| 3164 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->current_mode()); | 3164 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->current_mode()); |
| 3165 EXPECT_EQ(-75.f, host_->overscroll_delta_x()); | 3165 EXPECT_EQ(-81.f, host_->overscroll_delta_x()); |
| 3166 EXPECT_EQ(-25.f, host_->overscroll_delegate()->delta_x()); | 3166 EXPECT_EQ(-31.f, host_->overscroll_delegate()->delta_x()); |
| 3167 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3167 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); |
| 3168 EXPECT_EQ(0U, process_->sink().message_count()); | 3168 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3169 | 3169 |
| 3170 // Send a mouse-move event. This should cancel the overscroll navigation. | 3170 // Send a mouse-move event. This should cancel the overscroll navigation. |
| 3171 SimulateMouseMove(5, 10, 0); | 3171 SimulateMouseMove(5, 10, 0); |
| 3172 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3172 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3173 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3173 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3174 } | 3174 } |
| 3175 | 3175 |
| 3176 // Tests that if some scroll events are consumed towards the start, then | 3176 // Tests that if some scroll events are consumed towards the start, then |
| 3177 // subsequent scrolls do not overscroll. | 3177 // subsequent scrolls do not horizontal overscroll. |
| 3178 TEST_F(RenderWidgetHostTest, WheelScrollConsumedDoNotOverscroll) { | 3178 TEST_F(RenderWidgetHostTest, WheelScrollConsumedDoNotHorizOverscroll) { |
| 3179 host_->SetupForOverscrollControllerTest(); | 3179 host_->SetupForOverscrollControllerTest(); |
| 3180 process_->sink().ClearMessages(); | 3180 process_->sink().ClearMessages(); |
| 3181 | 3181 |
| 3182 // Simulate wheel events. | 3182 // Simulate wheel events. |
| 3183 SimulateWheelEvent(0, -5, 0, true); // sent directly | 3183 SimulateWheelEvent(-5, 0, 0, true); // sent directly |
| 3184 SimulateWheelEvent(0, -1, 0, true); // enqueued | 3184 SimulateWheelEvent(-1, -1, 0, true); // enqueued |
| 3185 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event | 3185 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event |
| 3186 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event | 3186 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event |
| 3187 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event | 3187 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event |
| 3188 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers | 3188 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers |
| 3189 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3189 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3190 EXPECT_EQ(1U, process_->sink().message_count()); | 3190 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3191 process_->sink().ClearMessages(); | 3191 process_->sink().ClearMessages(); |
| 3192 | 3192 |
| 3193 // Receive ACK the first wheel event as processed. | 3193 // Receive ACK the first wheel event as processed. |
| 3194 SendInputEventACK(WebInputEvent::MouseWheel, | 3194 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3195 INPUT_EVENT_ACK_STATE_CONSUMED); | 3195 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 3196 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3196 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3197 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3197 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3198 EXPECT_EQ(1U, process_->sink().message_count()); | 3198 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3199 process_->sink().ClearMessages(); | 3199 process_->sink().ClearMessages(); |
| 3200 | 3200 |
| 3201 // Receive ACK for the second (coalesced) event as not processed. This should | 3201 // Receive ACK for the second (coalesced) event as not processed. This should |
| 3202 // not initiate overscroll, since the beginning of the scroll has been | 3202 // not initiate overscroll, since the beginning of the scroll has been |
| 3203 // consumed. The queued event with different modifiers should be sent to the | 3203 // consumed. The queued event with different modifiers should be sent to the |
| 3204 // renderer. | 3204 // renderer. |
| 3205 SendInputEventACK(WebInputEvent::MouseWheel, | 3205 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3206 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3206 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3207 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3207 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3208 EXPECT_EQ(1U, process_->sink().message_count()); | 3208 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3209 | 3209 |
| 3210 process_->sink().ClearMessages(); | 3210 process_->sink().ClearMessages(); |
| 3211 SendInputEventACK(WebInputEvent::MouseWheel, | 3211 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3212 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3212 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3213 EXPECT_EQ(0U, process_->sink().message_count()); | 3213 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3214 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3214 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); |
| 3215 | 3215 |
| 3216 // Indicate the end of the scrolling from the touchpad. | 3216 // Indicate the end of the scrolling from the touchpad. |
| 3217 SimulateGestureFlingStartEvent(-1200.f, 0.f, WebGestureEvent::Touchpad); | 3217 SimulateGestureFlingStartEvent(-1200.f, 0.f, WebGestureEvent::Touchpad); |
| 3218 EXPECT_EQ(1U, process_->sink().message_count()); | 3218 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3219 | 3219 |
| 3220 // Start another scroll. This time, do not consume any scroll events. | 3220 // Start another scroll. This time, do not consume any scroll events. |
| 3221 process_->sink().ClearMessages(); | 3221 process_->sink().ClearMessages(); |
| 3222 SimulateWheelEvent(0, -5, 0, true); // sent directly | 3222 SimulateWheelEvent(0, -5, 0, true); // sent directly |
| 3223 SimulateWheelEvent(0, -1, 0, true); // enqueued | 3223 SimulateWheelEvent(0, -1, 0, true); // enqueued |
| 3224 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event | 3224 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event |
| 3225 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event | 3225 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event |
| 3226 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event | 3226 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event |
| 3227 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers | 3227 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers |
| 3228 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3228 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3229 EXPECT_EQ(1U, process_->sink().message_count()); | 3229 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3230 process_->sink().ClearMessages(); | 3230 process_->sink().ClearMessages(); |
| 3231 | 3231 |
| 3232 // Receive ACK for the first wheel and the subsequent coalesced event as not | 3232 // Receive ACK for the first wheel and the subsequent coalesced event as not |
| 3233 // processed. This should start a back-overscroll. | 3233 // processed. This should start a back-overscroll. |
| 3234 SendInputEventACK(WebInputEvent::MouseWheel, | 3234 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3235 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3235 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3236 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3236 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3237 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3237 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3238 EXPECT_EQ(1U, process_->sink().message_count()); | 3238 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3239 process_->sink().ClearMessages(); | 3239 process_->sink().ClearMessages(); |
| 3240 SendInputEventACK(WebInputEvent::MouseWheel, | 3240 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3241 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3241 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3242 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); | 3242 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); |
| 3243 } | 3243 } |
| 3244 | 3244 |
| 3245 // Tests that wheel-scrolling correctly turns overscroll on and off. | 3245 // Tests that wheel-scrolling correctly turns overscroll on and off. |
| 3246 TEST_F(RenderWidgetHostTest, WheelScrollOverscrollToggle) { | 3246 TEST_F(RenderWidgetHostTest, WheelScrollOverscrollToggle) { |
| 3247 host_->SetupForOverscrollControllerTest(); | 3247 host_->SetupForOverscrollControllerTest(); |
| 3248 process_->sink().ClearMessages(); | 3248 process_->sink().ClearMessages(); |
| 3249 | 3249 |
| 3250 // Send a wheel event. ACK the event as not processed. This should not | 3250 // Send a wheel event. ACK the event as not processed. This should not |
| 3251 // initiate an overscroll gesture since it doesn't cross the threshold yet. | 3251 // initiate an overscroll gesture since it doesn't cross the threshold yet. |
| 3252 SimulateWheelEvent(10, -5, 0, true); | 3252 SimulateWheelEvent(10, 0, 0, true); |
| 3253 EXPECT_EQ(1U, process_->sink().message_count()); | 3253 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3254 SendInputEventACK(WebInputEvent::MouseWheel, | 3254 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3255 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3255 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3256 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3256 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3257 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3257 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3258 process_->sink().ClearMessages(); | 3258 process_->sink().ClearMessages(); |
| 3259 | 3259 |
| 3260 // Scroll some more so as to not overscroll. | 3260 // Scroll some more so as to not overscroll. |
| 3261 SimulateWheelEvent(10, -4, 0, true); | 3261 SimulateWheelEvent(10, 0, 0, true); |
| 3262 EXPECT_EQ(1U, process_->sink().message_count()); | 3262 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3263 SendInputEventACK(WebInputEvent::MouseWheel, | 3263 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3264 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3264 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3265 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3265 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3266 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3266 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3267 process_->sink().ClearMessages(); | 3267 process_->sink().ClearMessages(); |
| 3268 | 3268 |
| 3269 // Scroll some more to initiate an overscroll. | 3269 // Scroll some more to initiate an overscroll. |
| 3270 SimulateWheelEvent(40, -4, 0, true); | 3270 SimulateWheelEvent(40, 0, 0, true); |
| 3271 EXPECT_EQ(1U, process_->sink().message_count()); | 3271 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3272 SendInputEventACK(WebInputEvent::MouseWheel, | 3272 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3273 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3273 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3274 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3274 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3275 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3275 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3276 EXPECT_EQ(60.f, host_->overscroll_delta_x()); | 3276 EXPECT_EQ(60.f, host_->overscroll_delta_x()); |
| 3277 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); | 3277 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); |
| 3278 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3278 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); |
| 3279 process_->sink().ClearMessages(); | 3279 process_->sink().ClearMessages(); |
| 3280 | 3280 |
| 3281 // Scroll in the reverse direction enough to abort the overscroll. | 3281 // Scroll in the reverse direction enough to abort the overscroll. |
| 3282 SimulateWheelEvent(-20, -4, 0, true); | 3282 SimulateWheelEvent(-20, 0, 0, true); |
| 3283 EXPECT_EQ(0U, process_->sink().message_count()); | 3283 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3284 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3284 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3285 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3285 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3286 | 3286 |
| 3287 // Continue to scroll in the reverse direction. | 3287 // Continue to scroll in the reverse direction. |
| 3288 SimulateWheelEvent(-20, 4, 0, true); | 3288 SimulateWheelEvent(-20, 0, 0, true); |
| 3289 EXPECT_EQ(1U, process_->sink().message_count()); | 3289 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3290 SendInputEventACK(WebInputEvent::MouseWheel, | 3290 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3291 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3291 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3292 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3292 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3293 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3293 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3294 process_->sink().ClearMessages(); | 3294 process_->sink().ClearMessages(); |
| 3295 | 3295 |
| 3296 // Continue to scroll in the reverse direction enough to initiate overscroll | 3296 // Continue to scroll in the reverse direction enough to initiate overscroll |
| 3297 // in that direction. | 3297 // in that direction. |
| 3298 SimulateWheelEvent(-55, -2, 0, true); | 3298 SimulateWheelEvent(-55, 0, 0, true); |
| 3299 EXPECT_EQ(1U, process_->sink().message_count()); | 3299 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3300 SendInputEventACK(WebInputEvent::MouseWheel, | 3300 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3301 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3301 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3302 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); | 3302 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); |
| 3303 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->current_mode()); | 3303 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->current_mode()); |
| 3304 EXPECT_EQ(-75.f, host_->overscroll_delta_x()); | 3304 EXPECT_EQ(-75.f, host_->overscroll_delta_x()); |
| 3305 EXPECT_EQ(-25.f, host_->overscroll_delegate()->delta_x()); | 3305 EXPECT_EQ(-25.f, host_->overscroll_delegate()->delta_x()); |
| 3306 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3306 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); |
| 3307 } | 3307 } |
| 3308 | 3308 |
| 3309 TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithFling) { | 3309 TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithFling) { |
| 3310 host_->SetupForOverscrollControllerTest(); | 3310 host_->SetupForOverscrollControllerTest(); |
| 3311 process_->sink().ClearMessages(); | 3311 process_->sink().ClearMessages(); |
| 3312 | 3312 |
| 3313 // Send a wheel event. ACK the event as not processed. This should not | 3313 // Send a wheel event. ACK the event as not processed. This should not |
| 3314 // initiate an overscroll gesture since it doesn't cross the threshold yet. | 3314 // initiate an overscroll gesture since it doesn't cross the threshold yet. |
| 3315 SimulateWheelEvent(10, -5, 0, true); | 3315 SimulateWheelEvent(10, 0, 0, true); |
| 3316 EXPECT_EQ(1U, process_->sink().message_count()); | 3316 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3317 SendInputEventACK(WebInputEvent::MouseWheel, | 3317 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3318 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3318 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3319 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3319 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3320 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3320 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3321 process_->sink().ClearMessages(); | 3321 process_->sink().ClearMessages(); |
| 3322 | 3322 |
| 3323 // Scroll some more so as to not overscroll. | 3323 // Scroll some more so as to not overscroll. |
| 3324 SimulateWheelEvent(20, -4, 0, true); | 3324 SimulateWheelEvent(20, 0, 0, true); |
| 3325 EXPECT_EQ(1U, process_->sink().message_count()); | 3325 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3326 SendInputEventACK(WebInputEvent::MouseWheel, | 3326 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3327 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3327 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3328 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3328 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3329 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3329 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3330 process_->sink().ClearMessages(); | 3330 process_->sink().ClearMessages(); |
| 3331 | 3331 |
| 3332 // Scroll some more to initiate an overscroll. | 3332 // Scroll some more to initiate an overscroll. |
| 3333 SimulateWheelEvent(30, -4, 0, true); | 3333 SimulateWheelEvent(30, 0, 0, true); |
| 3334 EXPECT_EQ(1U, process_->sink().message_count()); | 3334 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3335 SendInputEventACK(WebInputEvent::MouseWheel, | 3335 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3336 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3336 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3337 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3337 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3338 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3338 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3339 EXPECT_EQ(60.f, host_->overscroll_delta_x()); | 3339 EXPECT_EQ(60.f, host_->overscroll_delta_x()); |
| 3340 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); | 3340 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); |
| 3341 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3341 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); |
| 3342 process_->sink().ClearMessages(); | 3342 process_->sink().ClearMessages(); |
| 3343 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3343 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3344 | 3344 |
| 3345 // Send a fling start, but with a small velocity, so that the overscroll is | 3345 // Send a fling start, but with a small velocity, so that the overscroll is |
| 3346 // aborted. The fling should proceed to the renderer, through the gesture | 3346 // aborted. The fling should proceed to the renderer, through the gesture |
| 3347 // event filter. | 3347 // event filter. |
| 3348 SimulateGestureFlingStartEvent(0.f, 0.1f, WebGestureEvent::Touchpad); | 3348 SimulateGestureFlingStartEvent(0.f, 0.1f, WebGestureEvent::Touchpad); |
| 3349 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3349 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3350 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3350 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3351 EXPECT_EQ(1U, process_->sink().message_count()); | 3351 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3352 } | 3352 } |
| 3353 | 3353 |
| 3354 // Same as ScrollEventsOverscrollWithFling, but with zero velocity. Checks that | 3354 // Same as ScrollEventsOverscrollWithFling, but with zero velocity. Checks that |
| 3355 // the zero-velocity fling does not reach the renderer. | 3355 // the zero-velocity fling does not reach the renderer. |
| 3356 TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithZeroFling) { | 3356 TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithZeroFling) { |
| 3357 host_->SetupForOverscrollControllerTest(); | 3357 host_->SetupForOverscrollControllerTest(); |
| 3358 process_->sink().ClearMessages(); | 3358 process_->sink().ClearMessages(); |
| 3359 | 3359 |
| 3360 // Send a wheel event. ACK the event as not processed. This should not | 3360 // Send a wheel event. ACK the event as not processed. This should not |
| 3361 // initiate an overscroll gesture since it doesn't cross the threshold yet. | 3361 // initiate an overscroll gesture since it doesn't cross the threshold yet. |
| 3362 SimulateWheelEvent(10, -5, 0, true); | 3362 SimulateWheelEvent(10, 0, 0, true); |
| 3363 EXPECT_EQ(1U, process_->sink().message_count()); | 3363 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3364 SendInputEventACK(WebInputEvent::MouseWheel, | 3364 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3365 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3365 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3366 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3366 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3367 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3367 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3368 process_->sink().ClearMessages(); | 3368 process_->sink().ClearMessages(); |
| 3369 | 3369 |
| 3370 // Scroll some more so as to not overscroll. | 3370 // Scroll some more so as to not overscroll. |
| 3371 SimulateWheelEvent(20, -4, 0, true); | 3371 SimulateWheelEvent(20, 0, 0, true); |
| 3372 EXPECT_EQ(1U, process_->sink().message_count()); | 3372 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3373 SendInputEventACK(WebInputEvent::MouseWheel, | 3373 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3374 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3374 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3375 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3375 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3376 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3376 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3377 process_->sink().ClearMessages(); | 3377 process_->sink().ClearMessages(); |
| 3378 | 3378 |
| 3379 // Scroll some more to initiate an overscroll. | 3379 // Scroll some more to initiate an overscroll. |
| 3380 SimulateWheelEvent(30, -4, 0, true); | 3380 SimulateWheelEvent(30, 0, 0, true); |
| 3381 EXPECT_EQ(1U, process_->sink().message_count()); | 3381 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3382 SendInputEventACK(WebInputEvent::MouseWheel, | 3382 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3383 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3383 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3384 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3384 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3385 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3385 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3386 EXPECT_EQ(60.f, host_->overscroll_delta_x()); | 3386 EXPECT_EQ(60.f, host_->overscroll_delta_x()); |
| 3387 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); | 3387 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); |
| 3388 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3388 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); |
| 3389 process_->sink().ClearMessages(); | 3389 process_->sink().ClearMessages(); |
| 3390 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3390 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3469 // Send another gesture event and ACK as not being processed. This should | 3469 // Send another gesture event and ACK as not being processed. This should |
| 3470 // initiate the navigation gesture. | 3470 // initiate the navigation gesture. |
| 3471 SimulateGestureScrollUpdateEvent(55, -5, 0); | 3471 SimulateGestureScrollUpdateEvent(55, -5, 0); |
| 3472 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3472 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3473 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3473 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3474 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3474 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3475 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3475 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3476 EXPECT_EQ(55.f, host_->overscroll_delta_x()); | 3476 EXPECT_EQ(55.f, host_->overscroll_delta_x()); |
| 3477 EXPECT_EQ(-5.f, host_->overscroll_delta_y()); | 3477 EXPECT_EQ(-5.f, host_->overscroll_delta_y()); |
| 3478 EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x()); | 3478 EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x()); |
| 3479 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3479 EXPECT_EQ(-5.f, host_->overscroll_delegate()->delta_y()); |
| 3480 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3480 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3481 process_->sink().ClearMessages(); | 3481 process_->sink().ClearMessages(); |
| 3482 | 3482 |
| 3483 // Send another gesture update event. This event should be consumed by the | 3483 // Send another gesture update event. This event should be consumed by the |
| 3484 // controller, and not be forwarded to the renderer. The gesture-event filter | 3484 // controller, and not be forwarded to the renderer. The gesture-event filter |
| 3485 // should not also receive this event. | 3485 // should not also receive this event. |
| 3486 SimulateGestureScrollUpdateEvent(10, -5, 0); | 3486 SimulateGestureScrollUpdateEvent(10, -5, 0); |
| 3487 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3487 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3488 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3488 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3489 EXPECT_EQ(65.f, host_->overscroll_delta_x()); | 3489 EXPECT_EQ(65.f, host_->overscroll_delta_x()); |
| 3490 EXPECT_EQ(-10.f, host_->overscroll_delta_y()); | 3490 EXPECT_EQ(-10.f, host_->overscroll_delta_y()); |
| 3491 EXPECT_EQ(15.f, host_->overscroll_delegate()->delta_x()); | 3491 EXPECT_EQ(15.f, host_->overscroll_delegate()->delta_x()); |
| 3492 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3492 EXPECT_EQ(-10.f, host_->overscroll_delegate()->delta_y()); |
| 3493 EXPECT_EQ(0U, process_->sink().message_count()); | 3493 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3494 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3494 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3495 | 3495 |
| 3496 // Now send a scroll end. This should cancel the overscroll gesture, and send | 3496 // Now send a scroll end. This should cancel the overscroll gesture, and send |
| 3497 // the event to the renderer. The gesture-event filter should receive this | 3497 // the event to the renderer. The gesture-event filter should receive this |
| 3498 // event. | 3498 // event. |
| 3499 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 3499 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
| 3500 WebGestureEvent::Touchscreen); | 3500 WebGestureEvent::Touchscreen); |
| 3501 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3501 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3502 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3502 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3503 EXPECT_EQ(1U, process_->sink().message_count()); | 3503 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3504 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3504 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3505 } | 3505 } |
| 3506 | 3506 |
| 3507 // Tests that if the page is scrolled because of a scroll-gesture, then that | |
| 3508 // particular scroll sequence never generates overscroll, even if there is no | |
| 3509 // content to scroll on the page anymore. | |
| 3510 TEST_F(RenderWidgetHostTest, GestureScrollConsumedDoNotOverscroll) { | |
| 3511 // Turn off debounce handling for test isolation. | |
| 3512 host_->SetupForOverscrollControllerTest(); | |
| 3513 host_->set_debounce_interval_time_ms(0); | |
| 3514 process_->sink().ClearMessages(); | |
| 3515 | |
| 3516 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 3517 WebGestureEvent::Touchscreen); | |
| 3518 SimulateGestureScrollUpdateEvent(8, -5, 0); | |
| 3519 | |
| 3520 // ACK both events as being processed. | |
| 3521 SendInputEventACK(WebInputEvent::GestureScrollBegin, | |
| 3522 INPUT_EVENT_ACK_STATE_CONSUMED); | |
| 3523 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 3524 INPUT_EVENT_ACK_STATE_CONSUMED); | |
| 3525 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 3526 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 3527 | |
| 3528 // Send another gesture event and ACK as not being processed. This should | |
| 3529 // not initiate overscroll because the beginning of the scroll event did | |
| 3530 // scroll some content on the page. | |
| 3531 SimulateGestureScrollUpdateEvent(55, -5, 0); | |
| 3532 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 3533 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 3534 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 3535 } | |
| 3536 | |
| 3537 // Tests that the overscroll controller plays nice with touch-scrolls and the | 3507 // Tests that the overscroll controller plays nice with touch-scrolls and the |
| 3538 // gesture event filter with debounce filtering turned on. | 3508 // gesture event filter with debounce filtering turned on. |
| 3539 TEST_F(RenderWidgetHostTest, GestureScrollDebounceOverscrolls) { | 3509 TEST_F(RenderWidgetHostTest, GestureScrollDebounceOverscrolls) { |
| 3540 host_->SetupForOverscrollControllerTest(); | 3510 host_->SetupForOverscrollControllerTest(); |
| 3541 host_->set_debounce_interval_time_ms(100); | 3511 host_->set_debounce_interval_time_ms(100); |
| 3542 process_->sink().ClearMessages(); | 3512 process_->sink().ClearMessages(); |
| 3543 | 3513 |
| 3544 // Start scrolling. Receive ACK as it being processed. | 3514 // Start scrolling. Receive ACK as it being processed. |
| 3545 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3515 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3546 WebGestureEvent::Touchscreen); | 3516 WebGestureEvent::Touchscreen); |
| 3547 EXPECT_EQ(1U, process_->sink().message_count()); | 3517 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3548 process_->sink().ClearMessages(); | 3518 process_->sink().ClearMessages(); |
| 3549 SendInputEventACK(WebInputEvent::GestureScrollBegin, | 3519 SendInputEventACK(WebInputEvent::GestureScrollBegin, |
| 3550 INPUT_EVENT_ACK_STATE_CONSUMED); | 3520 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 3551 | 3521 |
| 3552 // Send update events. | 3522 // Send update events. |
| 3553 SimulateGestureScrollUpdateEvent(25, -5, 0); | 3523 SimulateGestureScrollUpdateEvent(25, 0, 0); |
| 3554 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3524 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3555 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | 3525 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); |
| 3556 EXPECT_TRUE(host_->ScrollingInProgress()); | 3526 EXPECT_TRUE(host_->ScrollingInProgress()); |
| 3557 EXPECT_EQ(1U, process_->sink().message_count()); | 3527 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3558 process_->sink().ClearMessages(); | 3528 process_->sink().ClearMessages(); |
| 3559 | 3529 |
| 3560 // Quickly end and restart the scroll gesture. These two events should get | 3530 // Quickly end and restart the scroll gesture. These two events should get |
| 3561 // discarded. | 3531 // discarded. |
| 3562 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 3532 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
| 3563 WebGestureEvent::Touchscreen); | 3533 WebGestureEvent::Touchscreen); |
| 3564 EXPECT_EQ(0U, process_->sink().message_count()); | 3534 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3565 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3535 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3566 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); | 3536 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); |
| 3567 | 3537 |
| 3568 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3538 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3569 WebGestureEvent::Touchscreen); | 3539 WebGestureEvent::Touchscreen); |
| 3570 EXPECT_EQ(0U, process_->sink().message_count()); | 3540 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3571 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3541 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3572 EXPECT_EQ(2U, host_->GestureEventDebouncingQueueSize()); | 3542 EXPECT_EQ(2U, host_->GestureEventDebouncingQueueSize()); |
| 3573 | 3543 |
| 3574 // Send another update event. This should get into the queue. | 3544 // Send another update event. This should get into the queue. |
| 3575 SimulateGestureScrollUpdateEvent(30, 5, 0); | 3545 SimulateGestureScrollUpdateEvent(30, 0, 0); |
| 3576 EXPECT_EQ(0U, process_->sink().message_count()); | 3546 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3577 EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize()); | 3547 EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize()); |
| 3578 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | 3548 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); |
| 3579 EXPECT_TRUE(host_->ScrollingInProgress()); | 3549 EXPECT_TRUE(host_->ScrollingInProgress()); |
| 3580 | 3550 |
| 3581 // Receive an ACK for the first scroll-update event as not being processed. | 3551 // Receive an ACK for the first scroll-update event as not being processed. |
| 3582 // This will contribute to the overscroll gesture, but not enough for the | 3552 // This will contribute to the overscroll gesture, but not enough for the |
| 3583 // overscroll controller to start consuming gesture events. This also cause | 3553 // overscroll controller to start consuming gesture events. This also cause |
| 3584 // the queued gesture event to be forwarded to the renderer. | 3554 // the queued gesture event to be forwarded to the renderer. |
| 3585 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3555 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3586 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3556 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3587 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3557 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3588 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3558 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3589 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3559 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3590 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | 3560 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); |
| 3591 EXPECT_EQ(1U, process_->sink().message_count()); | 3561 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3592 process_->sink().ClearMessages(); | 3562 process_->sink().ClearMessages(); |
| 3593 | 3563 |
| 3594 // Send another update event. This should get into the queue. | 3564 // Send another update event. This should get into the queue. |
| 3595 SimulateGestureScrollUpdateEvent(10, 5, 0); | 3565 SimulateGestureScrollUpdateEvent(10, 0, 0); |
| 3596 EXPECT_EQ(0U, process_->sink().message_count()); | 3566 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3597 EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize()); | 3567 EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize()); |
| 3598 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | 3568 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); |
| 3599 EXPECT_TRUE(host_->ScrollingInProgress()); | 3569 EXPECT_TRUE(host_->ScrollingInProgress()); |
| 3600 | 3570 |
| 3601 // Receive an ACK for the second scroll-update event as not being processed. | 3571 // Receive an ACK for the second scroll-update event as not being processed. |
| 3602 // This will now initiate an overscroll. This will also cause the queued | 3572 // This will now initiate an overscroll. This will also cause the queued |
| 3603 // gesture event to be released. But instead of going to the renderer, it will | 3573 // gesture event to be released. But instead of going to the renderer, it will |
| 3604 // be consumed by the overscroll controller. | 3574 // be consumed by the overscroll controller. |
| 3605 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3575 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3623 | 3593 |
| 3624 // Start scrolling. Receive ACK as it being processed. | 3594 // Start scrolling. Receive ACK as it being processed. |
| 3625 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3595 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3626 WebGestureEvent::Touchscreen); | 3596 WebGestureEvent::Touchscreen); |
| 3627 EXPECT_EQ(1U, process_->sink().message_count()); | 3597 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3628 process_->sink().ClearMessages(); | 3598 process_->sink().ClearMessages(); |
| 3629 SendInputEventACK(WebInputEvent::GestureScrollBegin, | 3599 SendInputEventACK(WebInputEvent::GestureScrollBegin, |
| 3630 INPUT_EVENT_ACK_STATE_CONSUMED); | 3600 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 3631 | 3601 |
| 3632 // Send update events. | 3602 // Send update events. |
| 3633 SimulateGestureScrollUpdateEvent(55, -5, 0); | 3603 SimulateGestureScrollUpdateEvent(55, 0, 0); |
| 3634 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3604 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3635 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | 3605 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); |
| 3636 EXPECT_TRUE(host_->ScrollingInProgress()); | 3606 EXPECT_TRUE(host_->ScrollingInProgress()); |
| 3637 EXPECT_EQ(1U, process_->sink().message_count()); | 3607 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3638 process_->sink().ClearMessages(); | 3608 process_->sink().ClearMessages(); |
| 3639 | 3609 |
| 3640 // Send an end event. This should get in the debounce queue. | 3610 // Send an end event. This should get in the debounce queue. |
| 3641 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 3611 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
| 3642 WebGestureEvent::Touchscreen); | 3612 WebGestureEvent::Touchscreen); |
| 3643 EXPECT_EQ(0U, process_->sink().message_count()); | 3613 EXPECT_EQ(0U, process_->sink().message_count()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3698 EXPECT_EQ(1U, process_->sink().message_count()); | 3668 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3699 process_->sink().ClearMessages(); | 3669 process_->sink().ClearMessages(); |
| 3700 SendInputEventACK(WebInputEvent::TouchMove, | 3670 SendInputEventACK(WebInputEvent::TouchMove, |
| 3701 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3671 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3702 | 3672 |
| 3703 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3673 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3704 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3674 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3705 | 3675 |
| 3706 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3676 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3707 WebGestureEvent::Touchscreen); | 3677 WebGestureEvent::Touchscreen); |
| 3708 SimulateGestureScrollUpdateEvent(20, 4, 0); | 3678 SimulateGestureScrollUpdateEvent(20, 0, 0); |
| 3709 SendInputEventACK(WebInputEvent::GestureScrollBegin, | 3679 SendInputEventACK(WebInputEvent::GestureScrollBegin, |
| 3710 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3680 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3711 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3681 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3712 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3682 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3713 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3683 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3714 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3684 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3715 process_->sink().ClearMessages(); | 3685 process_->sink().ClearMessages(); |
| 3716 | 3686 |
| 3717 // Another touch move event should reach the renderer since overscroll hasn't | 3687 // Another touch move event should reach the renderer since overscroll hasn't |
| 3718 // started yet. | 3688 // started yet. |
| 3719 MoveTouchPoint(0, 65, 10); | 3689 MoveTouchPoint(0, 65, 10); |
| 3720 SendTouchEvent(); | 3690 SendTouchEvent(); |
| 3721 EXPECT_EQ(1U, process_->sink().message_count()); | 3691 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3722 process_->sink().ClearMessages(); | 3692 process_->sink().ClearMessages(); |
| 3723 | 3693 |
| 3724 SendInputEventACK(WebInputEvent::TouchMove, | 3694 SendInputEventACK(WebInputEvent::TouchMove, |
| 3725 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3695 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3726 SimulateGestureScrollUpdateEvent(45, 5, 0); | 3696 SimulateGestureScrollUpdateEvent(45, 0, 0); |
| 3727 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3697 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3728 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3698 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3729 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3699 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3730 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3700 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3731 EXPECT_EQ(65.f, host_->overscroll_delta_x()); | 3701 EXPECT_EQ(65.f, host_->overscroll_delta_x()); |
| 3732 EXPECT_EQ(15.f, host_->overscroll_delegate()->delta_x()); | 3702 EXPECT_EQ(15.f, host_->overscroll_delegate()->delta_x()); |
| 3733 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3703 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); |
| 3734 EXPECT_EQ(0U, host_->TouchEventQueueSize()); | 3704 EXPECT_EQ(0U, host_->TouchEventQueueSize()); |
| 3735 process_->sink().ClearMessages(); | 3705 process_->sink().ClearMessages(); |
| 3736 | 3706 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3838 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3808 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3839 | 3809 |
| 3840 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3810 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3841 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3811 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3842 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3812 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3843 EXPECT_EQ(0U, process_->sink().message_count()); | 3813 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3844 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3814 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3845 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3815 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3846 EXPECT_EQ(55.f, host_->overscroll_delta_x()); | 3816 EXPECT_EQ(55.f, host_->overscroll_delta_x()); |
| 3847 EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x()); | 3817 EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x()); |
| 3848 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3818 EXPECT_EQ(-5.f, host_->overscroll_delegate()->delta_y()); |
| 3849 | 3819 |
| 3850 // Send end event. | 3820 // Send end event. |
| 3851 SimulateGestureEvent(WebKit::WebInputEvent::GestureScrollEnd, | 3821 SimulateGestureEvent(WebKit::WebInputEvent::GestureScrollEnd, |
| 3852 WebGestureEvent::Touchscreen); | 3822 WebGestureEvent::Touchscreen); |
| 3853 EXPECT_EQ(0U, process_->sink().message_count()); | 3823 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3854 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3824 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3855 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3825 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3856 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->completed_mode()); | 3826 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->completed_mode()); |
| 3857 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3827 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3858 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); | 3828 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3896 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3866 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3897 | 3867 |
| 3898 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3868 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3899 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3869 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3900 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3870 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3901 EXPECT_EQ(0U, process_->sink().message_count()); | 3871 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3902 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3872 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3903 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3873 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3904 EXPECT_EQ(235.f, host_->overscroll_delta_x()); | 3874 EXPECT_EQ(235.f, host_->overscroll_delta_x()); |
| 3905 EXPECT_EQ(185.f, host_->overscroll_delegate()->delta_x()); | 3875 EXPECT_EQ(185.f, host_->overscroll_delegate()->delta_x()); |
| 3906 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3876 EXPECT_EQ(-5.f, host_->overscroll_delegate()->delta_y()); |
| 3907 | 3877 |
| 3908 // Send end event. | 3878 // Send end event. |
| 3909 SimulateGestureEvent(WebKit::WebInputEvent::GestureScrollEnd, | 3879 SimulateGestureEvent(WebKit::WebInputEvent::GestureScrollEnd, |
| 3910 WebGestureEvent::Touchscreen); | 3880 WebGestureEvent::Touchscreen); |
| 3911 EXPECT_EQ(0U, process_->sink().message_count()); | 3881 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3912 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3882 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3913 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3883 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3914 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); | 3884 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); |
| 3915 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3885 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3916 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); | 3886 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4001 | 3971 |
| 4002 // Tests that if a mouse-move event completes the overscroll gesture, future | 3972 // Tests that if a mouse-move event completes the overscroll gesture, future |
| 4003 // move events do reach the renderer. | 3973 // move events do reach the renderer. |
| 4004 TEST_F(RenderWidgetHostTest, OverscrollMouseMoveCompletion) { | 3974 TEST_F(RenderWidgetHostTest, OverscrollMouseMoveCompletion) { |
| 4005 host_->SetupForOverscrollControllerTest(); | 3975 host_->SetupForOverscrollControllerTest(); |
| 4006 host_->set_debounce_interval_time_ms(0); | 3976 host_->set_debounce_interval_time_ms(0); |
| 4007 process_->sink().ClearMessages(); | 3977 process_->sink().ClearMessages(); |
| 4008 view_->set_bounds(gfx::Rect(0, 0, 400, 200)); | 3978 view_->set_bounds(gfx::Rect(0, 0, 400, 200)); |
| 4009 view_->Show(); | 3979 view_->Show(); |
| 4010 | 3980 |
| 4011 SimulateWheelEvent(0, -5, 0, true); // sent directly | 3981 SimulateWheelEvent(5, 0, 0, true); // sent directly |
| 4012 SimulateWheelEvent(0, -1, 0, true); // enqueued | 3982 SimulateWheelEvent(-1, 0, 0, true); // enqueued |
| 4013 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event | 3983 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event |
| 4014 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event | 3984 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event |
| 4015 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event | 3985 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event |
| 4016 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3986 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 4017 EXPECT_EQ(1U, process_->sink().message_count()); | 3987 EXPECT_EQ(1U, process_->sink().message_count()); |
| 4018 process_->sink().ClearMessages(); | 3988 process_->sink().ClearMessages(); |
| 4019 | 3989 |
| 4020 // Receive ACK the first wheel event as not processed. | 3990 // Receive ACK the first wheel event as not processed. |
| 4021 SendInputEventACK(WebInputEvent::MouseWheel, | 3991 SendInputEventACK(WebInputEvent::MouseWheel, |
| 4022 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3992 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4119 SendInputEventACK(WebInputEvent::MouseWheel, | 4089 SendInputEventACK(WebInputEvent::MouseWheel, |
| 4120 INPUT_EVENT_ACK_STATE_CONSUMED); | 4090 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 4121 EXPECT_TRUE(host_->ScrollStateIsContentScrolling()); | 4091 EXPECT_TRUE(host_->ScrollStateIsContentScrolling()); |
| 4122 | 4092 |
| 4123 // Touchpad scroll can end with a zero-velocity fling. But it is not | 4093 // Touchpad scroll can end with a zero-velocity fling. But it is not |
| 4124 // dispatched, but it should still reset the overscroll controller state. | 4094 // dispatched, but it should still reset the overscroll controller state. |
| 4125 SimulateGestureFlingStartEvent(0.f, 0.f, WebGestureEvent::Touchpad); | 4095 SimulateGestureFlingStartEvent(0.f, 0.f, WebGestureEvent::Touchpad); |
| 4126 EXPECT_TRUE(host_->ScrollStateIsUnknown()); | 4096 EXPECT_TRUE(host_->ScrollStateIsUnknown()); |
| 4127 EXPECT_EQ(0U, process_->sink().message_count()); | 4097 EXPECT_EQ(0U, process_->sink().message_count()); |
| 4128 | 4098 |
| 4129 SimulateWheelEvent(0, -5, 0, true); // sent directly | 4099 SimulateWheelEvent(-5, 0, 0, true); // sent directly |
| 4130 SimulateWheelEvent(-60, -1, 0, true); // enqueued | 4100 SimulateWheelEvent(-60, 0, 0, true); // enqueued |
| 4131 SimulateWheelEvent(-100, -3, 0, true); // coalesced into previous event | 4101 SimulateWheelEvent(-100, 0, 0, true); // coalesced into previous event |
| 4132 EXPECT_EQ(1U, process_->sink().message_count()); | 4102 EXPECT_EQ(1U, process_->sink().message_count()); |
| 4133 EXPECT_TRUE(host_->ScrollStateIsUnknown()); | 4103 EXPECT_TRUE(host_->ScrollStateIsUnknown()); |
| 4134 process_->sink().ClearMessages(); | 4104 process_->sink().ClearMessages(); |
| 4135 | 4105 |
| 4136 // The first wheel scroll did not scroll content. Overscroll should not start | 4106 // The first wheel scroll did not scroll content. Overscroll should not start |
| 4137 // yet, since enough hasn't been scrolled. | 4107 // yet, since enough hasn't been scrolled. |
| 4138 SendInputEventACK(WebInputEvent::MouseWheel, | 4108 SendInputEventACK(WebInputEvent::MouseWheel, |
| 4139 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 4109 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 4140 EXPECT_TRUE(host_->ScrollStateIsUnknown()); | 4110 EXPECT_TRUE(host_->ScrollStateIsUnknown()); |
| 4141 EXPECT_EQ(1U, process_->sink().message_count()); | 4111 EXPECT_EQ(1U, process_->sink().message_count()); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4197 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->completed_mode()); | 4167 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->completed_mode()); |
| 4198 | 4168 |
| 4199 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 4169 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
| 4200 WebGestureEvent::Touchscreen); | 4170 WebGestureEvent::Touchscreen); |
| 4201 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 4171 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 4202 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); | 4172 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); |
| 4203 process_->sink().ClearMessages(); | 4173 process_->sink().ClearMessages(); |
| 4204 } | 4174 } |
| 4205 | 4175 |
| 4206 } // namespace content | 4176 } // namespace content |
| OLD | NEW |