Chromium Code Reviews| 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/memory/shared_memory.h" | 7 #include "base/memory/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 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3144 } | 3144 } |
| 3145 #endif | 3145 #endif |
| 3146 | 3146 |
| 3147 // Tests that scroll ACKs are correctly handled by the overscroll-navigation | 3147 // Tests that scroll ACKs are correctly handled by the overscroll-navigation |
| 3148 // controller. | 3148 // controller. |
| 3149 TEST_F(RenderWidgetHostTest, WheelScrollEventOverscrolls) { | 3149 TEST_F(RenderWidgetHostTest, WheelScrollEventOverscrolls) { |
| 3150 host_->SetupForOverscrollControllerTest(); | 3150 host_->SetupForOverscrollControllerTest(); |
| 3151 process_->sink().ClearMessages(); | 3151 process_->sink().ClearMessages(); |
| 3152 | 3152 |
| 3153 // Simulate wheel events. | 3153 // Simulate wheel events. |
| 3154 SimulateWheelEvent(0, -5, 0, true); // sent directly | 3154 SimulateWheelEvent(-5, 0, 0, true); // sent directly |
| 3155 SimulateWheelEvent(0, -1, 0, true); // enqueued | 3155 SimulateWheelEvent(-1, 1, 0, true); // enqueued |
| 3156 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event | 3156 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event |
| 3157 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event | 3157 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event |
| 3158 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event | 3158 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event |
| 3159 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers | 3159 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers |
| 3160 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3160 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3161 EXPECT_EQ(1U, process_->sink().message_count()); | 3161 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3162 process_->sink().ClearMessages(); | 3162 process_->sink().ClearMessages(); |
| 3163 | 3163 |
| 3164 // Receive ACK the first wheel event as not processed. | 3164 // Receive ACK the first wheel event as not processed. |
| 3165 SendInputEventACK(WebInputEvent::MouseWheel, | 3165 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3166 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3166 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3167 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3167 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3168 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3168 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3169 EXPECT_EQ(1U, process_->sink().message_count()); | 3169 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3170 process_->sink().ClearMessages(); | 3170 process_->sink().ClearMessages(); |
| 3171 | 3171 |
| 3172 // Receive ACK for the second (coalesced) event as not processed. This will | 3172 // Receive ACK for the second (coalesced) event as not processed. This will |
| 3173 // start a back navigation. However, this will also cause the queued next | 3173 // start a back navigation. However, this will also cause the queued next |
| 3174 // event to be sent to the renderer. But since overscroll navigation has | 3174 // event to be sent to the renderer. But since overscroll navigation has |
| 3175 // started, that event will also be included in the overscroll computation | 3175 // started, that event will also be included in the overscroll computation |
| 3176 // instead of being sent to the renderer. So the result will be an overscroll | 3176 // instead of being sent to the renderer. So the result will be an overscroll |
| 3177 // back navigation, and no event will be sent to the renderer. | 3177 // back navigation, and no event will be sent to the renderer. |
| 3178 SendInputEventACK(WebInputEvent::MouseWheel, | 3178 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3179 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3179 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3180 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); | 3180 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); |
| 3181 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->current_mode()); | 3181 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->current_mode()); |
| 3182 EXPECT_EQ(-75.f, host_->overscroll_delta_x()); | 3182 EXPECT_EQ(-81.f, host_->overscroll_delta_x()); |
| 3183 EXPECT_EQ(-25.f, host_->overscroll_delegate()->delta_x()); | 3183 EXPECT_EQ(-31.f, host_->overscroll_delegate()->delta_x()); |
| 3184 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3184 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); |
| 3185 EXPECT_EQ(0U, process_->sink().message_count()); | 3185 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3186 | 3186 |
| 3187 // Send a mouse-move event. This should cancel the overscroll navigation. | 3187 // Send a mouse-move event. This should cancel the overscroll navigation. |
| 3188 SimulateMouseMove(5, 10, 0); | 3188 SimulateMouseMove(5, 10, 0); |
| 3189 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3189 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3190 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3190 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3191 } | 3191 } |
| 3192 | 3192 |
| 3193 // Tests that if some scroll events are consumed towards the start, then | 3193 // Tests that if some scroll events are consumed towards the start, then |
| 3194 // subsequent scrolls do not overscroll. | 3194 // subsequent scrolls do not horizontal overscroll. |
| 3195 TEST_F(RenderWidgetHostTest, WheelScrollConsumedDoNotOverscroll) { | 3195 TEST_F(RenderWidgetHostTest, WheelScrollConsumedDoNotHorizOverscroll) { |
| 3196 host_->SetupForOverscrollControllerTest(); | 3196 host_->SetupForOverscrollControllerTest(); |
| 3197 process_->sink().ClearMessages(); | 3197 process_->sink().ClearMessages(); |
| 3198 | 3198 |
| 3199 // Simulate wheel events. | 3199 // Simulate wheel events. |
| 3200 SimulateWheelEvent(0, -5, 0, true); // sent directly | 3200 SimulateWheelEvent(-5, 0, 0, true); // sent directly |
| 3201 SimulateWheelEvent(0, -1, 0, true); // enqueued | 3201 SimulateWheelEvent(-1, -1, 0, true); // enqueued |
| 3202 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event | 3202 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event |
| 3203 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event | 3203 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event |
| 3204 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event | 3204 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event |
| 3205 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers | 3205 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers |
| 3206 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3206 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3207 EXPECT_EQ(1U, process_->sink().message_count()); | 3207 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3208 process_->sink().ClearMessages(); | 3208 process_->sink().ClearMessages(); |
| 3209 | 3209 |
| 3210 // Receive ACK the first wheel event as processed. | 3210 // Receive ACK the first wheel event as processed. |
| 3211 SendInputEventACK(WebInputEvent::MouseWheel, | 3211 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3212 INPUT_EVENT_ACK_STATE_CONSUMED); | 3212 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 3213 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3213 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3214 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3214 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3215 EXPECT_EQ(1U, process_->sink().message_count()); | 3215 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3216 process_->sink().ClearMessages(); | 3216 process_->sink().ClearMessages(); |
| 3217 | 3217 |
| 3218 // Receive ACK for the second (coalesced) event as not processed. This should | 3218 // Receive ACK for the second (coalesced) event as not processed. This should |
| 3219 // not initiate overscroll, since the beginning of the scroll has been | 3219 // not initiate overscroll, since the beginning of the scroll has been |
| 3220 // consumed. The queued event with different modifiers should be sent to the | 3220 // consumed. The queued event with different modifiers should be sent to the |
| 3221 // renderer. | 3221 // renderer. |
| 3222 SendInputEventACK(WebInputEvent::MouseWheel, | 3222 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3223 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3223 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3224 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3224 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3225 EXPECT_EQ(1U, process_->sink().message_count()); | 3225 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3226 | 3226 |
| 3227 process_->sink().ClearMessages(); | 3227 process_->sink().ClearMessages(); |
| 3228 SendInputEventACK(WebInputEvent::MouseWheel, | 3228 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3229 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3229 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3230 EXPECT_EQ(0U, process_->sink().message_count()); | 3230 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3231 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3231 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3232 | 3232 |
| 3233 // Indicate the end of the scrolling from the touchpad. | 3233 // Indicate the end of the scrolling from the touchpad. |
| 3234 SimulateGestureFlingStartEvent(-1200.f, 0.f, WebGestureEvent::Touchpad); | 3234 SimulateGestureFlingStartEvent(-1200.f, 0.f, WebGestureEvent::Touchpad); |
| 3235 EXPECT_EQ(1U, process_->sink().message_count()); | 3235 EXPECT_EQ(1U, process_->sink().message_count()); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 3259 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); | 3259 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); |
| 3260 } | 3260 } |
| 3261 | 3261 |
| 3262 // Tests that wheel-scrolling correctly turns overscroll on and off. | 3262 // Tests that wheel-scrolling correctly turns overscroll on and off. |
| 3263 TEST_F(RenderWidgetHostTest, WheelScrollOverscrollToggle) { | 3263 TEST_F(RenderWidgetHostTest, WheelScrollOverscrollToggle) { |
| 3264 host_->SetupForOverscrollControllerTest(); | 3264 host_->SetupForOverscrollControllerTest(); |
| 3265 process_->sink().ClearMessages(); | 3265 process_->sink().ClearMessages(); |
| 3266 | 3266 |
| 3267 // Send a wheel event. ACK the event as not processed. This should not | 3267 // Send a wheel event. ACK the event as not processed. This should not |
| 3268 // initiate an overscroll gesture since it doesn't cross the threshold yet. | 3268 // initiate an overscroll gesture since it doesn't cross the threshold yet. |
| 3269 SimulateWheelEvent(10, -5, 0, true); | 3269 SimulateWheelEvent(10, 0, 0, true); |
| 3270 EXPECT_EQ(1U, process_->sink().message_count()); | 3270 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3271 SendInputEventACK(WebInputEvent::MouseWheel, | 3271 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3272 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3272 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3273 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3273 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3274 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3274 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3275 process_->sink().ClearMessages(); | 3275 process_->sink().ClearMessages(); |
| 3276 | 3276 |
| 3277 // Scroll some more so as to not overscroll. | 3277 // Scroll some more so as to not overscroll. |
| 3278 SimulateWheelEvent(10, -4, 0, true); | 3278 SimulateWheelEvent(10, 0, 0, true); |
| 3279 EXPECT_EQ(1U, process_->sink().message_count()); | 3279 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3280 SendInputEventACK(WebInputEvent::MouseWheel, | 3280 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3281 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3281 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3282 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3282 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3283 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3283 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3284 process_->sink().ClearMessages(); | 3284 process_->sink().ClearMessages(); |
| 3285 | 3285 |
| 3286 // Scroll some more to initiate an overscroll. | 3286 // Scroll some more to initiate an overscroll. |
| 3287 SimulateWheelEvent(40, -4, 0, true); | 3287 SimulateWheelEvent(40, 0, 0, true); |
| 3288 EXPECT_EQ(1U, process_->sink().message_count()); | 3288 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3289 SendInputEventACK(WebInputEvent::MouseWheel, | 3289 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3290 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3290 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3291 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3291 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3292 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3292 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3293 EXPECT_EQ(60.f, host_->overscroll_delta_x()); | 3293 EXPECT_EQ(60.f, host_->overscroll_delta_x()); |
| 3294 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); | 3294 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); |
| 3295 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3295 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); |
| 3296 process_->sink().ClearMessages(); | 3296 process_->sink().ClearMessages(); |
| 3297 | 3297 |
| 3298 // Scroll in the reverse direction enough to abort the overscroll. | 3298 // Scroll in the reverse direction enough to abort the overscroll. |
| 3299 SimulateWheelEvent(-20, -4, 0, true); | 3299 SimulateWheelEvent(-20, 0, 0, true); |
| 3300 EXPECT_EQ(0U, process_->sink().message_count()); | 3300 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3301 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3301 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3302 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3302 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3303 | 3303 |
| 3304 // Continue to scroll in the reverse direction. | 3304 // Continue to scroll in the reverse direction. |
| 3305 SimulateWheelEvent(-20, 4, 0, true); | 3305 SimulateWheelEvent(-20, 0, 0, true); |
| 3306 EXPECT_EQ(1U, process_->sink().message_count()); | 3306 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3307 SendInputEventACK(WebInputEvent::MouseWheel, | 3307 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3308 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3308 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3309 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3309 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3310 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3310 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3311 process_->sink().ClearMessages(); | 3311 process_->sink().ClearMessages(); |
| 3312 | 3312 |
| 3313 // Continue to scroll in the reverse direction enough to initiate overscroll | 3313 // Continue to scroll in the reverse direction enough to initiate overscroll |
| 3314 // in that direction. | 3314 // in that direction. |
| 3315 SimulateWheelEvent(-55, -2, 0, true); | 3315 SimulateWheelEvent(-55, 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_WEST, host_->overscroll_mode()); | 3319 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); |
| 3320 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->current_mode()); | 3320 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->current_mode()); |
| 3321 EXPECT_EQ(-75.f, host_->overscroll_delta_x()); | 3321 EXPECT_EQ(-75.f, host_->overscroll_delta_x()); |
| 3322 EXPECT_EQ(-25.f, host_->overscroll_delegate()->delta_x()); | 3322 EXPECT_EQ(-25.f, host_->overscroll_delegate()->delta_x()); |
| 3323 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3323 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); |
| 3324 } | 3324 } |
| 3325 | 3325 |
| 3326 TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithFling) { | 3326 TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithFling) { |
| 3327 host_->SetupForOverscrollControllerTest(); | 3327 host_->SetupForOverscrollControllerTest(); |
| 3328 process_->sink().ClearMessages(); | 3328 process_->sink().ClearMessages(); |
| 3329 | 3329 |
| 3330 // Send a wheel event. ACK the event as not processed. This should not | 3330 // Send a wheel event. ACK the event as not processed. This should not |
| 3331 // initiate an overscroll gesture since it doesn't cross the threshold yet. | 3331 // initiate an overscroll gesture since it doesn't cross the threshold yet. |
| 3332 SimulateWheelEvent(10, -5, 0, true); | 3332 SimulateWheelEvent(10, 0, 0, true); |
| 3333 EXPECT_EQ(1U, process_->sink().message_count()); | 3333 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3334 SendInputEventACK(WebInputEvent::MouseWheel, | 3334 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3335 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3335 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3336 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3336 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3337 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3337 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3338 process_->sink().ClearMessages(); | 3338 process_->sink().ClearMessages(); |
| 3339 | 3339 |
| 3340 // Scroll some more so as to not overscroll. | 3340 // Scroll some more so as to not overscroll. |
| 3341 SimulateWheelEvent(20, -4, 0, true); | 3341 SimulateWheelEvent(20, 0, 0, true); |
| 3342 EXPECT_EQ(1U, process_->sink().message_count()); | 3342 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3343 SendInputEventACK(WebInputEvent::MouseWheel, | 3343 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3344 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3344 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3345 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3345 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3346 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3346 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3347 process_->sink().ClearMessages(); | 3347 process_->sink().ClearMessages(); |
| 3348 | 3348 |
| 3349 // Scroll some more to initiate an overscroll. | 3349 // Scroll some more to initiate an overscroll. |
| 3350 SimulateWheelEvent(30, -4, 0, true); | 3350 SimulateWheelEvent(30, 0, 0, true); |
| 3351 EXPECT_EQ(1U, process_->sink().message_count()); | 3351 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3352 SendInputEventACK(WebInputEvent::MouseWheel, | 3352 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3353 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3353 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3354 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3354 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3355 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3355 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3356 EXPECT_EQ(60.f, host_->overscroll_delta_x()); | 3356 EXPECT_EQ(60.f, host_->overscroll_delta_x()); |
| 3357 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); | 3357 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); |
| 3358 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3358 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); |
| 3359 process_->sink().ClearMessages(); | 3359 process_->sink().ClearMessages(); |
| 3360 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3360 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3361 | 3361 |
| 3362 // Send a fling start, but with a small velocity, so that the overscroll is | 3362 // Send a fling start, but with a small velocity, so that the overscroll is |
| 3363 // aborted. The fling should proceed to the renderer, through the gesture | 3363 // aborted. The fling should proceed to the renderer, through the gesture |
| 3364 // event filter. | 3364 // event filter. |
| 3365 SimulateGestureFlingStartEvent(0.f, 0.1f, WebGestureEvent::Touchpad); | 3365 SimulateGestureFlingStartEvent(0.f, 0.1f, WebGestureEvent::Touchpad); |
| 3366 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3366 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3367 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3367 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3368 EXPECT_EQ(1U, process_->sink().message_count()); | 3368 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3369 } | 3369 } |
| 3370 | 3370 |
| 3371 // Same as ScrollEventsOverscrollWithFling, but with zero velocity. Checks that | 3371 // Same as ScrollEventsOverscrollWithFling, but with zero velocity. Checks that |
| 3372 // the zero-velocity fling does not reach the renderer. | 3372 // the zero-velocity fling does not reach the renderer. |
| 3373 TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithZeroFling) { | 3373 TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithZeroFling) { |
| 3374 host_->SetupForOverscrollControllerTest(); | 3374 host_->SetupForOverscrollControllerTest(); |
| 3375 process_->sink().ClearMessages(); | 3375 process_->sink().ClearMessages(); |
| 3376 | 3376 |
| 3377 // Send a wheel event. ACK the event as not processed. This should not | 3377 // Send a wheel event. ACK the event as not processed. This should not |
| 3378 // initiate an overscroll gesture since it doesn't cross the threshold yet. | 3378 // initiate an overscroll gesture since it doesn't cross the threshold yet. |
| 3379 SimulateWheelEvent(10, -5, 0, true); | 3379 SimulateWheelEvent(10, 0, 0, true); |
| 3380 EXPECT_EQ(1U, process_->sink().message_count()); | 3380 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3381 SendInputEventACK(WebInputEvent::MouseWheel, | 3381 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3382 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3382 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3383 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3383 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3384 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3384 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3385 process_->sink().ClearMessages(); | 3385 process_->sink().ClearMessages(); |
| 3386 | 3386 |
| 3387 // Scroll some more so as to not overscroll. | 3387 // Scroll some more so as to not overscroll. |
| 3388 SimulateWheelEvent(20, -4, 0, true); | 3388 SimulateWheelEvent(20, 0, 0, true); |
| 3389 EXPECT_EQ(1U, process_->sink().message_count()); | 3389 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3390 SendInputEventACK(WebInputEvent::MouseWheel, | 3390 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3391 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3391 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3392 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3392 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3393 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3393 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3394 process_->sink().ClearMessages(); | 3394 process_->sink().ClearMessages(); |
| 3395 | 3395 |
| 3396 // Scroll some more to initiate an overscroll. | 3396 // Scroll some more to initiate an overscroll. |
| 3397 SimulateWheelEvent(30, -4, 0, true); | 3397 SimulateWheelEvent(30, 0, 0, true); |
| 3398 EXPECT_EQ(1U, process_->sink().message_count()); | 3398 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3399 SendInputEventACK(WebInputEvent::MouseWheel, | 3399 SendInputEventACK(WebInputEvent::MouseWheel, |
| 3400 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3400 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3401 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3401 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3402 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3402 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3403 EXPECT_EQ(60.f, host_->overscroll_delta_x()); | 3403 EXPECT_EQ(60.f, host_->overscroll_delta_x()); |
| 3404 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); | 3404 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); |
| 3405 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3405 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); |
| 3406 process_->sink().ClearMessages(); | 3406 process_->sink().ClearMessages(); |
| 3407 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3407 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3486 // Send another gesture event and ACK as not being processed. This should | 3486 // Send another gesture event and ACK as not being processed. This should |
| 3487 // initiate the navigation gesture. | 3487 // initiate the navigation gesture. |
| 3488 SimulateGestureScrollUpdateEvent(55, -5, 0); | 3488 SimulateGestureScrollUpdateEvent(55, -5, 0); |
| 3489 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3489 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3490 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3490 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3491 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3491 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3492 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3492 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3493 EXPECT_EQ(55.f, host_->overscroll_delta_x()); | 3493 EXPECT_EQ(55.f, host_->overscroll_delta_x()); |
| 3494 EXPECT_EQ(-5.f, host_->overscroll_delta_y()); | 3494 EXPECT_EQ(-5.f, host_->overscroll_delta_y()); |
| 3495 EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x()); | 3495 EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x()); |
| 3496 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3496 EXPECT_EQ(-5.f, host_->overscroll_delegate()->delta_y()); |
| 3497 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3497 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3498 process_->sink().ClearMessages(); | 3498 process_->sink().ClearMessages(); |
| 3499 | 3499 |
| 3500 // Send another gesture update event. This event should be consumed by the | 3500 // Send another gesture update event. This event should be consumed by the |
| 3501 // controller, and not be forwarded to the renderer. The gesture-event filter | 3501 // controller, and not be forwarded to the renderer. The gesture-event filter |
| 3502 // should not also receive this event. | 3502 // should not also receive this event. |
| 3503 SimulateGestureScrollUpdateEvent(10, -5, 0); | 3503 SimulateGestureScrollUpdateEvent(10, -5, 0); |
| 3504 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3504 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3505 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3505 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3506 EXPECT_EQ(65.f, host_->overscroll_delta_x()); | 3506 EXPECT_EQ(65.f, host_->overscroll_delta_x()); |
| 3507 EXPECT_EQ(-10.f, host_->overscroll_delta_y()); | 3507 EXPECT_EQ(-10.f, host_->overscroll_delta_y()); |
| 3508 EXPECT_EQ(15.f, host_->overscroll_delegate()->delta_x()); | 3508 EXPECT_EQ(15.f, host_->overscroll_delegate()->delta_x()); |
| 3509 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3509 EXPECT_EQ(-10.f, host_->overscroll_delegate()->delta_y()); |
| 3510 EXPECT_EQ(0U, process_->sink().message_count()); | 3510 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3511 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3511 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3512 | 3512 |
| 3513 // Now send a scroll end. This should cancel the overscroll gesture, and send | 3513 // Now send a scroll end. This should cancel the overscroll gesture, and send |
| 3514 // the event to the renderer. The gesture-event filter should receive this | 3514 // the event to the renderer. The gesture-event filter should receive this |
| 3515 // event. | 3515 // event. |
| 3516 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 3516 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
| 3517 WebGestureEvent::Touchscreen); | 3517 WebGestureEvent::Touchscreen); |
| 3518 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3518 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3519 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3519 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3520 EXPECT_EQ(1U, process_->sink().message_count()); | 3520 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3521 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3521 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3522 } | 3522 } |
| 3523 | 3523 |
| 3524 // Tests that if the page is scrolled because of a scroll-gesture, then that | 3524 // Tests that if the page is scrolled because of a scroll-gesture, then that |
| 3525 // particular scroll sequence never generates overscroll, even if there is no | 3525 // particular scroll sequence never generates overscroll if the scroll direction |
| 3526 // content to scroll on the page anymore. | 3526 // is horizontal. |
| 3527 TEST_F(RenderWidgetHostTest, GestureScrollConsumedDoNotOverscroll) { | 3527 TEST_F(RenderWidgetHostTest, GestureScrollConsumedHorizontal) { |
| 3528 // Turn off debounce handling for test isolation. | 3528 // Turn off debounce handling for test isolation. |
| 3529 host_->SetupForOverscrollControllerTest(); | 3529 host_->SetupForOverscrollControllerTest(); |
| 3530 host_->set_debounce_interval_time_ms(0); | 3530 host_->set_debounce_interval_time_ms(0); |
| 3531 process_->sink().ClearMessages(); | 3531 process_->sink().ClearMessages(); |
| 3532 | 3532 |
| 3533 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3533 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3534 WebGestureEvent::Touchscreen); | 3534 WebGestureEvent::Touchscreen); |
| 3535 SimulateGestureScrollUpdateEvent(8, -5, 0); | 3535 SimulateGestureScrollUpdateEvent(10, 0, 0); |
| 3536 | 3536 |
| 3537 // ACK both events as being processed. | 3537 // Start scrolling on content. ACK both events as being processed. |
| 3538 SendInputEventACK(WebInputEvent::GestureScrollBegin, | 3538 SendInputEventACK(WebInputEvent::GestureScrollBegin, |
| 3539 INPUT_EVENT_ACK_STATE_CONSUMED); | 3539 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 3540 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3540 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3541 INPUT_EVENT_ACK_STATE_CONSUMED); | 3541 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 3542 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3542 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3543 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3543 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3544 | 3544 |
| 3545 // Send another gesture event and ACK as not being processed. This should | 3545 // Send another gesture event and ACK as not being processed. This should |
| 3546 // not initiate overscroll because the beginning of the scroll event did | 3546 // not initiate overscroll because the beginning of the scroll event did |
| 3547 // scroll some content on the page. | 3547 // scroll some content on the page. |
| 3548 SimulateGestureScrollUpdateEvent(55, -5, 0); | 3548 SimulateGestureScrollUpdateEvent(55, 0, 0); |
| 3549 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3549 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3550 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3550 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3551 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3551 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3552 } | 3552 } |
| 3553 | 3553 |
| 3554 // Tests that if the page is scrolled because of a scroll-gesture, then that | |
| 3555 // particular scroll sequence never generates overscroll if the scroll direction | |
| 3556 // is vertical. | |
| 3557 TEST_F(RenderWidgetHostTest, GestureScrollConsumedVertical) { | |
| 3558 // Turn off debounce handling for test isolation. | |
| 3559 host_->SetupForOverscrollControllerTest(); | |
| 3560 host_->set_debounce_interval_time_ms(0); | |
| 3561 process_->sink().ClearMessages(); | |
| 3562 | |
| 3563 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 3564 WebGestureEvent::Touchscreen); | |
| 3565 SimulateGestureScrollUpdateEvent(0, -1, 0); | |
| 3566 | |
| 3567 // Start scrolling on content. ACK both events as being processed. | |
| 3568 SendInputEventACK(WebInputEvent::GestureScrollBegin, | |
| 3569 INPUT_EVENT_ACK_STATE_CONSUMED); | |
| 3570 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 3571 INPUT_EVENT_ACK_STATE_CONSUMED); | |
| 3572 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 3573 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 3574 | |
| 3575 // Send another gesture event and ACK as not being processed. This should | |
| 3576 // nitiate overscroll because the scroll was in the vertical direction even | |
|
sadrul
2013/07/23 14:42:22
*initiate
rharrison
2013/07/23 14:50:07
Done.
| |
| 3577 // though the beginning of the scroll did scroll content. | |
| 3578 SimulateGestureScrollUpdateEvent(0, -50, 0); | |
| 3579 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 3580 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 3581 EXPECT_EQ(OVERSCROLL_NORTH, host_->overscroll_mode()); | |
|
sadrul
2013/07/23 14:42:22
Send a sufficiently large unprocessed horizontal s
rharrison
2013/07/23 14:50:07
Done.
| |
| 3582 } | |
| 3583 | |
| 3554 // Tests that the overscroll controller plays nice with touch-scrolls and the | 3584 // Tests that the overscroll controller plays nice with touch-scrolls and the |
| 3555 // gesture event filter with debounce filtering turned on. | 3585 // gesture event filter with debounce filtering turned on. |
| 3556 TEST_F(RenderWidgetHostTest, GestureScrollDebounceOverscrolls) { | 3586 TEST_F(RenderWidgetHostTest, GestureScrollDebounceOverscrolls) { |
| 3557 host_->SetupForOverscrollControllerTest(); | 3587 host_->SetupForOverscrollControllerTest(); |
| 3558 host_->set_debounce_interval_time_ms(100); | 3588 host_->set_debounce_interval_time_ms(100); |
| 3559 process_->sink().ClearMessages(); | 3589 process_->sink().ClearMessages(); |
| 3560 | 3590 |
| 3561 // Start scrolling. Receive ACK as it being processed. | 3591 // Start scrolling. Receive ACK as it being processed. |
| 3562 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3592 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3563 WebGestureEvent::Touchscreen); | 3593 WebGestureEvent::Touchscreen); |
| 3564 EXPECT_EQ(1U, process_->sink().message_count()); | 3594 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3565 process_->sink().ClearMessages(); | 3595 process_->sink().ClearMessages(); |
| 3566 SendInputEventACK(WebInputEvent::GestureScrollBegin, | 3596 SendInputEventACK(WebInputEvent::GestureScrollBegin, |
| 3567 INPUT_EVENT_ACK_STATE_CONSUMED); | 3597 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 3568 | 3598 |
| 3569 // Send update events. | 3599 // Send update events. |
| 3570 SimulateGestureScrollUpdateEvent(25, -5, 0); | 3600 SimulateGestureScrollUpdateEvent(25, 0, 0); |
| 3571 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3601 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3572 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | 3602 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); |
| 3573 EXPECT_TRUE(host_->ScrollingInProgress()); | 3603 EXPECT_TRUE(host_->ScrollingInProgress()); |
| 3574 EXPECT_EQ(1U, process_->sink().message_count()); | 3604 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3575 process_->sink().ClearMessages(); | 3605 process_->sink().ClearMessages(); |
| 3576 | 3606 |
| 3577 // Quickly end and restart the scroll gesture. These two events should get | 3607 // Quickly end and restart the scroll gesture. These two events should get |
| 3578 // discarded. | 3608 // discarded. |
| 3579 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 3609 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
| 3580 WebGestureEvent::Touchscreen); | 3610 WebGestureEvent::Touchscreen); |
| 3581 EXPECT_EQ(0U, process_->sink().message_count()); | 3611 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3582 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3612 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3583 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); | 3613 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); |
| 3584 | 3614 |
| 3585 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3615 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3586 WebGestureEvent::Touchscreen); | 3616 WebGestureEvent::Touchscreen); |
| 3587 EXPECT_EQ(0U, process_->sink().message_count()); | 3617 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3588 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3618 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3589 EXPECT_EQ(2U, host_->GestureEventDebouncingQueueSize()); | 3619 EXPECT_EQ(2U, host_->GestureEventDebouncingQueueSize()); |
| 3590 | 3620 |
| 3591 // Send another update event. This should get into the queue. | 3621 // Send another update event. This should get into the queue. |
| 3592 SimulateGestureScrollUpdateEvent(30, 5, 0); | 3622 SimulateGestureScrollUpdateEvent(30, 0, 0); |
| 3593 EXPECT_EQ(0U, process_->sink().message_count()); | 3623 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3594 EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize()); | 3624 EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize()); |
| 3595 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | 3625 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); |
| 3596 EXPECT_TRUE(host_->ScrollingInProgress()); | 3626 EXPECT_TRUE(host_->ScrollingInProgress()); |
| 3597 | 3627 |
| 3598 // Receive an ACK for the first scroll-update event as not being processed. | 3628 // Receive an ACK for the first scroll-update event as not being processed. |
| 3599 // This will contribute to the overscroll gesture, but not enough for the | 3629 // This will contribute to the overscroll gesture, but not enough for the |
| 3600 // overscroll controller to start consuming gesture events. This also cause | 3630 // overscroll controller to start consuming gesture events. This also cause |
| 3601 // the queued gesture event to be forwarded to the renderer. | 3631 // the queued gesture event to be forwarded to the renderer. |
| 3602 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3632 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3603 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3633 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3604 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3634 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3605 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3635 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3606 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3636 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3607 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | 3637 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); |
| 3608 EXPECT_EQ(1U, process_->sink().message_count()); | 3638 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3609 process_->sink().ClearMessages(); | 3639 process_->sink().ClearMessages(); |
| 3610 | 3640 |
| 3611 // Send another update event. This should get into the queue. | 3641 // Send another update event. This should get into the queue. |
| 3612 SimulateGestureScrollUpdateEvent(10, 5, 0); | 3642 SimulateGestureScrollUpdateEvent(10, 0, 0); |
| 3613 EXPECT_EQ(0U, process_->sink().message_count()); | 3643 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3614 EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize()); | 3644 EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize()); |
| 3615 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | 3645 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); |
| 3616 EXPECT_TRUE(host_->ScrollingInProgress()); | 3646 EXPECT_TRUE(host_->ScrollingInProgress()); |
| 3617 | 3647 |
| 3618 // Receive an ACK for the second scroll-update event as not being processed. | 3648 // Receive an ACK for the second scroll-update event as not being processed. |
| 3619 // This will now initiate an overscroll. This will also cause the queued | 3649 // This will now initiate an overscroll. This will also cause the queued |
| 3620 // gesture event to be released. But instead of going to the renderer, it will | 3650 // gesture event to be released. But instead of going to the renderer, it will |
| 3621 // be consumed by the overscroll controller. | 3651 // be consumed by the overscroll controller. |
| 3622 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3652 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 3640 | 3670 |
| 3641 // Start scrolling. Receive ACK as it being processed. | 3671 // Start scrolling. Receive ACK as it being processed. |
| 3642 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3672 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3643 WebGestureEvent::Touchscreen); | 3673 WebGestureEvent::Touchscreen); |
| 3644 EXPECT_EQ(1U, process_->sink().message_count()); | 3674 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3645 process_->sink().ClearMessages(); | 3675 process_->sink().ClearMessages(); |
| 3646 SendInputEventACK(WebInputEvent::GestureScrollBegin, | 3676 SendInputEventACK(WebInputEvent::GestureScrollBegin, |
| 3647 INPUT_EVENT_ACK_STATE_CONSUMED); | 3677 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 3648 | 3678 |
| 3649 // Send update events. | 3679 // Send update events. |
| 3650 SimulateGestureScrollUpdateEvent(55, -5, 0); | 3680 SimulateGestureScrollUpdateEvent(55, 0, 0); |
| 3651 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | 3681 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); |
| 3652 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | 3682 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); |
| 3653 EXPECT_TRUE(host_->ScrollingInProgress()); | 3683 EXPECT_TRUE(host_->ScrollingInProgress()); |
| 3654 EXPECT_EQ(1U, process_->sink().message_count()); | 3684 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3655 process_->sink().ClearMessages(); | 3685 process_->sink().ClearMessages(); |
| 3656 | 3686 |
| 3657 // Send an end event. This should get in the debounce queue. | 3687 // Send an end event. This should get in the debounce queue. |
| 3658 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 3688 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
| 3659 WebGestureEvent::Touchscreen); | 3689 WebGestureEvent::Touchscreen); |
| 3660 EXPECT_EQ(0U, process_->sink().message_count()); | 3690 EXPECT_EQ(0U, process_->sink().message_count()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3715 EXPECT_EQ(1U, process_->sink().message_count()); | 3745 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3716 process_->sink().ClearMessages(); | 3746 process_->sink().ClearMessages(); |
| 3717 SendInputEventACK(WebInputEvent::TouchMove, | 3747 SendInputEventACK(WebInputEvent::TouchMove, |
| 3718 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3748 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3719 | 3749 |
| 3720 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3750 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3721 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3751 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3722 | 3752 |
| 3723 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | 3753 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
| 3724 WebGestureEvent::Touchscreen); | 3754 WebGestureEvent::Touchscreen); |
| 3725 SimulateGestureScrollUpdateEvent(20, 4, 0); | 3755 SimulateGestureScrollUpdateEvent(20, 0, 0); |
| 3726 SendInputEventACK(WebInputEvent::GestureScrollBegin, | 3756 SendInputEventACK(WebInputEvent::GestureScrollBegin, |
| 3727 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3757 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3728 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3758 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3729 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3759 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3730 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3760 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3731 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3761 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3732 process_->sink().ClearMessages(); | 3762 process_->sink().ClearMessages(); |
| 3733 | 3763 |
| 3734 // Another touch move event should reach the renderer since overscroll hasn't | 3764 // Another touch move event should reach the renderer since overscroll hasn't |
| 3735 // started yet. | 3765 // started yet. |
| 3736 MoveTouchPoint(0, 65, 10); | 3766 MoveTouchPoint(0, 65, 10); |
| 3737 SendTouchEvent(); | 3767 SendTouchEvent(); |
| 3738 EXPECT_EQ(1U, process_->sink().message_count()); | 3768 EXPECT_EQ(1U, process_->sink().message_count()); |
| 3739 process_->sink().ClearMessages(); | 3769 process_->sink().ClearMessages(); |
| 3740 | 3770 |
| 3741 SendInputEventACK(WebInputEvent::TouchMove, | 3771 SendInputEventACK(WebInputEvent::TouchMove, |
| 3742 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3772 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3743 SimulateGestureScrollUpdateEvent(45, 5, 0); | 3773 SimulateGestureScrollUpdateEvent(45, 0, 0); |
| 3744 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3774 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3745 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3775 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3746 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3776 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3747 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3777 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3748 EXPECT_EQ(65.f, host_->overscroll_delta_x()); | 3778 EXPECT_EQ(65.f, host_->overscroll_delta_x()); |
| 3749 EXPECT_EQ(15.f, host_->overscroll_delegate()->delta_x()); | 3779 EXPECT_EQ(15.f, host_->overscroll_delegate()->delta_x()); |
| 3750 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3780 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); |
| 3751 EXPECT_EQ(0U, host_->TouchEventQueueSize()); | 3781 EXPECT_EQ(0U, host_->TouchEventQueueSize()); |
| 3752 process_->sink().ClearMessages(); | 3782 process_->sink().ClearMessages(); |
| 3753 | 3783 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3855 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3885 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3856 | 3886 |
| 3857 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3887 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3858 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3888 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3859 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3889 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3860 EXPECT_EQ(0U, process_->sink().message_count()); | 3890 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3861 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3891 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3862 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3892 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3863 EXPECT_EQ(55.f, host_->overscroll_delta_x()); | 3893 EXPECT_EQ(55.f, host_->overscroll_delta_x()); |
| 3864 EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x()); | 3894 EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x()); |
| 3865 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3895 EXPECT_EQ(-5.f, host_->overscroll_delegate()->delta_y()); |
| 3866 | 3896 |
| 3867 // Send end event. | 3897 // Send end event. |
| 3868 SimulateGestureEvent(WebKit::WebInputEvent::GestureScrollEnd, | 3898 SimulateGestureEvent(WebKit::WebInputEvent::GestureScrollEnd, |
| 3869 WebGestureEvent::Touchscreen); | 3899 WebGestureEvent::Touchscreen); |
| 3870 EXPECT_EQ(0U, process_->sink().message_count()); | 3900 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3871 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3901 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3872 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3902 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3873 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->completed_mode()); | 3903 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->completed_mode()); |
| 3874 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3904 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3875 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); | 3905 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3913 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3943 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3914 | 3944 |
| 3915 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 3945 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 3916 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 3946 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 3917 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3947 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3918 EXPECT_EQ(0U, process_->sink().message_count()); | 3948 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3919 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | 3949 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); |
| 3920 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | 3950 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); |
| 3921 EXPECT_EQ(235.f, host_->overscroll_delta_x()); | 3951 EXPECT_EQ(235.f, host_->overscroll_delta_x()); |
| 3922 EXPECT_EQ(185.f, host_->overscroll_delegate()->delta_x()); | 3952 EXPECT_EQ(185.f, host_->overscroll_delegate()->delta_x()); |
| 3923 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | 3953 EXPECT_EQ(-5.f, host_->overscroll_delegate()->delta_y()); |
| 3924 | 3954 |
| 3925 // Send end event. | 3955 // Send end event. |
| 3926 SimulateGestureEvent(WebKit::WebInputEvent::GestureScrollEnd, | 3956 SimulateGestureEvent(WebKit::WebInputEvent::GestureScrollEnd, |
| 3927 WebGestureEvent::Touchscreen); | 3957 WebGestureEvent::Touchscreen); |
| 3928 EXPECT_EQ(0U, process_->sink().message_count()); | 3958 EXPECT_EQ(0U, process_->sink().message_count()); |
| 3929 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 3959 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 3930 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 3960 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 3931 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); | 3961 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); |
| 3932 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | 3962 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); |
| 3933 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); | 3963 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4018 | 4048 |
| 4019 // Tests that if a mouse-move event completes the overscroll gesture, future | 4049 // Tests that if a mouse-move event completes the overscroll gesture, future |
| 4020 // move events do reach the renderer. | 4050 // move events do reach the renderer. |
| 4021 TEST_F(RenderWidgetHostTest, OverscrollMouseMoveCompletion) { | 4051 TEST_F(RenderWidgetHostTest, OverscrollMouseMoveCompletion) { |
| 4022 host_->SetupForOverscrollControllerTest(); | 4052 host_->SetupForOverscrollControllerTest(); |
| 4023 host_->set_debounce_interval_time_ms(0); | 4053 host_->set_debounce_interval_time_ms(0); |
| 4024 process_->sink().ClearMessages(); | 4054 process_->sink().ClearMessages(); |
| 4025 view_->set_bounds(gfx::Rect(0, 0, 400, 200)); | 4055 view_->set_bounds(gfx::Rect(0, 0, 400, 200)); |
| 4026 view_->Show(); | 4056 view_->Show(); |
| 4027 | 4057 |
| 4028 SimulateWheelEvent(0, -5, 0, true); // sent directly | 4058 SimulateWheelEvent(5, 0, 0, true); // sent directly |
| 4029 SimulateWheelEvent(0, -1, 0, true); // enqueued | 4059 SimulateWheelEvent(-1, 0, 0, true); // enqueued |
| 4030 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event | 4060 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event |
| 4031 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event | 4061 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event |
| 4032 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event | 4062 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event |
| 4033 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | 4063 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); |
| 4034 EXPECT_EQ(1U, process_->sink().message_count()); | 4064 EXPECT_EQ(1U, process_->sink().message_count()); |
| 4035 process_->sink().ClearMessages(); | 4065 process_->sink().ClearMessages(); |
| 4036 | 4066 |
| 4037 // Receive ACK the first wheel event as not processed. | 4067 // Receive ACK the first wheel event as not processed. |
| 4038 SendInputEventACK(WebInputEvent::MouseWheel, | 4068 SendInputEventACK(WebInputEvent::MouseWheel, |
| 4039 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 4069 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4136 SendInputEventACK(WebInputEvent::MouseWheel, | 4166 SendInputEventACK(WebInputEvent::MouseWheel, |
| 4137 INPUT_EVENT_ACK_STATE_CONSUMED); | 4167 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 4138 EXPECT_TRUE(host_->ScrollStateIsContentScrolling()); | 4168 EXPECT_TRUE(host_->ScrollStateIsContentScrolling()); |
| 4139 | 4169 |
| 4140 // Touchpad scroll can end with a zero-velocity fling. But it is not | 4170 // Touchpad scroll can end with a zero-velocity fling. But it is not |
| 4141 // dispatched, but it should still reset the overscroll controller state. | 4171 // dispatched, but it should still reset the overscroll controller state. |
| 4142 SimulateGestureFlingStartEvent(0.f, 0.f, WebGestureEvent::Touchpad); | 4172 SimulateGestureFlingStartEvent(0.f, 0.f, WebGestureEvent::Touchpad); |
| 4143 EXPECT_TRUE(host_->ScrollStateIsUnknown()); | 4173 EXPECT_TRUE(host_->ScrollStateIsUnknown()); |
| 4144 EXPECT_EQ(0U, process_->sink().message_count()); | 4174 EXPECT_EQ(0U, process_->sink().message_count()); |
| 4145 | 4175 |
| 4146 SimulateWheelEvent(0, -5, 0, true); // sent directly | 4176 SimulateWheelEvent(-5, 0, 0, true); // sent directly |
| 4147 SimulateWheelEvent(-60, -1, 0, true); // enqueued | 4177 SimulateWheelEvent(-60, 0, 0, true); // enqueued |
| 4148 SimulateWheelEvent(-100, -3, 0, true); // coalesced into previous event | 4178 SimulateWheelEvent(-100, 0, 0, true); // coalesced into previous event |
| 4149 EXPECT_EQ(1U, process_->sink().message_count()); | 4179 EXPECT_EQ(1U, process_->sink().message_count()); |
| 4150 EXPECT_TRUE(host_->ScrollStateIsUnknown()); | 4180 EXPECT_TRUE(host_->ScrollStateIsUnknown()); |
| 4151 process_->sink().ClearMessages(); | 4181 process_->sink().ClearMessages(); |
| 4152 | 4182 |
| 4153 // The first wheel scroll did not scroll content. Overscroll should not start | 4183 // The first wheel scroll did not scroll content. Overscroll should not start |
| 4154 // yet, since enough hasn't been scrolled. | 4184 // yet, since enough hasn't been scrolled. |
| 4155 SendInputEventACK(WebInputEvent::MouseWheel, | 4185 SendInputEventACK(WebInputEvent::MouseWheel, |
| 4156 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 4186 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 4157 EXPECT_TRUE(host_->ScrollStateIsUnknown()); | 4187 EXPECT_TRUE(host_->ScrollStateIsUnknown()); |
| 4158 EXPECT_EQ(1U, process_->sink().message_count()); | 4188 EXPECT_EQ(1U, process_->sink().message_count()); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4214 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->completed_mode()); | 4244 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->completed_mode()); |
| 4215 | 4245 |
| 4216 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 4246 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
| 4217 WebGestureEvent::Touchscreen); | 4247 WebGestureEvent::Touchscreen); |
| 4218 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | 4248 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); |
| 4219 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); | 4249 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); |
| 4220 process_->sink().ClearMessages(); | 4250 process_->sink().ClearMessages(); |
| 4221 } | 4251 } |
| 4222 | 4252 |
| 4223 } // namespace content | 4253 } // namespace content |
| OLD | NEW |