| 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/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| 11 #include "content/browser/browser_thread_impl.h" | 11 #include "content/browser/browser_thread_impl.h" |
| 12 #include "content/browser/renderer_host/input/gesture_event_queue.h" | |
| 13 #include "content/browser/renderer_host/input/input_router_impl.h" | 12 #include "content/browser/renderer_host/input/input_router_impl.h" |
| 14 #include "content/browser/renderer_host/input/touch_event_queue.h" | |
| 15 #include "content/browser/renderer_host/overscroll_controller.h" | |
| 16 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | |
| 17 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 13 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 18 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 14 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 19 #include "content/common/input/synthetic_web_input_event_builders.h" | 15 #include "content/common/input/synthetic_web_input_event_builders.h" |
| 20 #include "content/common/input_messages.h" | 16 #include "content/common/input_messages.h" |
| 21 #include "content/common/view_messages.h" | 17 #include "content/common/view_messages.h" |
| 22 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
| 23 #include "content/public/test/mock_render_process_host.h" | 19 #include "content/public/test/mock_render_process_host.h" |
| 24 #include "content/public/test/test_browser_context.h" | 20 #include "content/public/test/test_browser_context.h" |
| 25 #include "content/test/test_render_view_host.h" | 21 #include "content/test/test_render_view_host.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 46 using blink::WebGestureEvent; | 42 using blink::WebGestureEvent; |
| 47 using blink::WebInputEvent; | 43 using blink::WebInputEvent; |
| 48 using blink::WebKeyboardEvent; | 44 using blink::WebKeyboardEvent; |
| 49 using blink::WebMouseEvent; | 45 using blink::WebMouseEvent; |
| 50 using blink::WebMouseWheelEvent; | 46 using blink::WebMouseWheelEvent; |
| 51 using blink::WebTouchEvent; | 47 using blink::WebTouchEvent; |
| 52 using blink::WebTouchPoint; | 48 using blink::WebTouchPoint; |
| 53 | 49 |
| 54 namespace content { | 50 namespace content { |
| 55 | 51 |
| 56 // TestOverscrollDelegate ------------------------------------------------------ | |
| 57 | |
| 58 class TestOverscrollDelegate : public OverscrollControllerDelegate { | |
| 59 public: | |
| 60 explicit TestOverscrollDelegate(RenderWidgetHostView* view) | |
| 61 : view_(view), | |
| 62 current_mode_(OVERSCROLL_NONE), | |
| 63 completed_mode_(OVERSCROLL_NONE), | |
| 64 delta_x_(0.f), | |
| 65 delta_y_(0.f) { | |
| 66 } | |
| 67 | |
| 68 virtual ~TestOverscrollDelegate() {} | |
| 69 | |
| 70 OverscrollMode current_mode() const { return current_mode_; } | |
| 71 OverscrollMode completed_mode() const { return completed_mode_; } | |
| 72 float delta_x() const { return delta_x_; } | |
| 73 float delta_y() const { return delta_y_; } | |
| 74 | |
| 75 void Reset() { | |
| 76 current_mode_ = OVERSCROLL_NONE; | |
| 77 completed_mode_ = OVERSCROLL_NONE; | |
| 78 delta_x_ = delta_y_ = 0.f; | |
| 79 } | |
| 80 | |
| 81 private: | |
| 82 // Overridden from OverscrollControllerDelegate: | |
| 83 virtual gfx::Rect GetVisibleBounds() const OVERRIDE { | |
| 84 return view_->IsShowing() ? view_->GetViewBounds() : gfx::Rect(); | |
| 85 } | |
| 86 | |
| 87 virtual void OnOverscrollUpdate(float delta_x, float delta_y) OVERRIDE { | |
| 88 delta_x_ = delta_x; | |
| 89 delta_y_ = delta_y; | |
| 90 } | |
| 91 | |
| 92 virtual void OnOverscrollComplete(OverscrollMode overscroll_mode) OVERRIDE { | |
| 93 EXPECT_EQ(current_mode_, overscroll_mode); | |
| 94 completed_mode_ = overscroll_mode; | |
| 95 current_mode_ = OVERSCROLL_NONE; | |
| 96 } | |
| 97 | |
| 98 virtual void OnOverscrollModeChange(OverscrollMode old_mode, | |
| 99 OverscrollMode new_mode) OVERRIDE { | |
| 100 EXPECT_EQ(current_mode_, old_mode); | |
| 101 current_mode_ = new_mode; | |
| 102 delta_x_ = delta_y_ = 0.f; | |
| 103 } | |
| 104 | |
| 105 RenderWidgetHostView* view_; | |
| 106 OverscrollMode current_mode_; | |
| 107 OverscrollMode completed_mode_; | |
| 108 float delta_x_; | |
| 109 float delta_y_; | |
| 110 | |
| 111 DISALLOW_COPY_AND_ASSIGN(TestOverscrollDelegate); | |
| 112 }; | |
| 113 | |
| 114 // MockInputRouter ------------------------------------------------------------- | 52 // MockInputRouter ------------------------------------------------------------- |
| 115 | 53 |
| 116 class MockInputRouter : public InputRouter { | 54 class MockInputRouter : public InputRouter { |
| 117 public: | 55 public: |
| 118 explicit MockInputRouter(InputRouterClient* client) | 56 explicit MockInputRouter(InputRouterClient* client) |
| 119 : send_event_called_(false), | 57 : send_event_called_(false), |
| 120 sent_mouse_event_(false), | 58 sent_mouse_event_(false), |
| 121 sent_wheel_event_(false), | 59 sent_wheel_event_(false), |
| 122 sent_keyboard_event_(false), | 60 sent_keyboard_event_(false), |
| 123 sent_gesture_event_(false), | 61 sent_gesture_event_(false), |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 139 } |
| 202 | 140 |
| 203 // Allow poking at a few private members. | 141 // Allow poking at a few private members. |
| 204 using RenderWidgetHostImpl::OnUpdateRect; | 142 using RenderWidgetHostImpl::OnUpdateRect; |
| 205 using RenderWidgetHostImpl::RendererExited; | 143 using RenderWidgetHostImpl::RendererExited; |
| 206 using RenderWidgetHostImpl::last_requested_size_; | 144 using RenderWidgetHostImpl::last_requested_size_; |
| 207 using RenderWidgetHostImpl::is_hidden_; | 145 using RenderWidgetHostImpl::is_hidden_; |
| 208 using RenderWidgetHostImpl::resize_ack_pending_; | 146 using RenderWidgetHostImpl::resize_ack_pending_; |
| 209 using RenderWidgetHostImpl::input_router_; | 147 using RenderWidgetHostImpl::input_router_; |
| 210 | 148 |
| 211 bool unresponsive_timer_fired() const { | |
| 212 return unresponsive_timer_fired_; | |
| 213 } | |
| 214 | |
| 215 void set_hung_renderer_delay_ms(int delay_ms) { | |
| 216 hung_renderer_delay_ms_ = delay_ms; | |
| 217 } | |
| 218 | |
| 219 unsigned GestureEventLastQueueEventSize() const { | |
| 220 return gesture_event_queue().coalesced_gesture_events_.size(); | |
| 221 } | |
| 222 | |
| 223 WebGestureEvent GestureEventSecondFromLastQueueEvent() const { | |
| 224 return gesture_event_queue().coalesced_gesture_events_.at( | |
| 225 GestureEventLastQueueEventSize() - 2).event; | |
| 226 } | |
| 227 | |
| 228 WebGestureEvent GestureEventLastQueueEvent() const { | |
| 229 return gesture_event_queue().coalesced_gesture_events_.back().event; | |
| 230 } | |
| 231 | |
| 232 unsigned GestureEventDebouncingQueueSize() const { | |
| 233 return gesture_event_queue().debouncing_deferral_queue_.size(); | |
| 234 } | |
| 235 | |
| 236 WebGestureEvent GestureEventQueueEventAt(int i) const { | |
| 237 return gesture_event_queue().coalesced_gesture_events_.at(i).event; | |
| 238 } | |
| 239 | |
| 240 bool ScrollingInProgress() const { | |
| 241 return gesture_event_queue().scrolling_in_progress_; | |
| 242 } | |
| 243 | |
| 244 void SetupForOverscrollControllerTest() { | |
| 245 SetOverscrollControllerEnabled(true); | |
| 246 overscroll_delegate_.reset(new TestOverscrollDelegate(GetView())); | |
| 247 overscroll_controller_->set_delegate(overscroll_delegate_.get()); | |
| 248 } | |
| 249 | |
| 250 void DisableGestureDebounce() { set_debounce_interval_time_ms(0); } | |
| 251 | |
| 252 void set_debounce_interval_time_ms(int delay_ms) { | |
| 253 gesture_event_queue().set_debounce_interval_time_ms_for_testing(delay_ms); | |
| 254 } | |
| 255 | |
| 256 bool TouchEventQueueEmpty() const { | |
| 257 return touch_event_queue().empty(); | |
| 258 } | |
| 259 | |
| 260 virtual void OnTouchEventAck( | 149 virtual void OnTouchEventAck( |
| 261 const TouchEventWithLatencyInfo& event, | 150 const TouchEventWithLatencyInfo& event, |
| 262 InputEventAckState ack_result) OVERRIDE { | 151 InputEventAckState ack_result) OVERRIDE { |
| 263 // Sniff touch acks. | 152 // Sniff touch acks. |
| 264 acked_touch_event_type_ = event.event.type; | 153 acked_touch_event_type_ = event.event.type; |
| 265 RenderWidgetHostImpl::OnTouchEventAck(event, ack_result); | 154 RenderWidgetHostImpl::OnTouchEventAck(event, ack_result); |
| 266 } | 155 } |
| 267 | 156 |
| 157 bool unresponsive_timer_fired() const { return unresponsive_timer_fired_; } |
| 158 |
| 159 void set_hung_renderer_delay_ms(int delay_ms) { |
| 160 hung_renderer_delay_ms_ = delay_ms; |
| 161 } |
| 162 |
| 163 void DisableGestureDebounce() { |
| 164 input_router_.reset(new InputRouterImpl( |
| 165 process_, this, this, routing_id_, InputRouterImpl::Config())); |
| 166 } |
| 167 |
| 268 WebInputEvent::Type acked_touch_event_type() const { | 168 WebInputEvent::Type acked_touch_event_type() const { |
| 269 return acked_touch_event_type_; | 169 return acked_touch_event_type_; |
| 270 } | 170 } |
| 271 | 171 |
| 272 bool ScrollStateIsContentScrolling() const { | |
| 273 return scroll_state() == OverscrollController::STATE_CONTENT_SCROLLING; | |
| 274 } | |
| 275 | |
| 276 bool ScrollStateIsOverscrolling() const { | |
| 277 return scroll_state() == OverscrollController::STATE_OVERSCROLLING; | |
| 278 } | |
| 279 | |
| 280 bool ScrollStateIsUnknown() const { | |
| 281 return scroll_state() == OverscrollController::STATE_UNKNOWN; | |
| 282 } | |
| 283 | |
| 284 OverscrollController::ScrollState scroll_state() const { | |
| 285 return overscroll_controller_->scroll_state_; | |
| 286 } | |
| 287 | |
| 288 OverscrollMode overscroll_mode() const { | |
| 289 return overscroll_controller_->overscroll_mode_; | |
| 290 } | |
| 291 | |
| 292 float overscroll_delta_x() const { | |
| 293 return overscroll_controller_->overscroll_delta_x_; | |
| 294 } | |
| 295 | |
| 296 float overscroll_delta_y() const { | |
| 297 return overscroll_controller_->overscroll_delta_y_; | |
| 298 } | |
| 299 | |
| 300 TestOverscrollDelegate* overscroll_delegate() { | |
| 301 return overscroll_delegate_.get(); | |
| 302 } | |
| 303 | |
| 304 void SetupForInputRouterTest() { | 172 void SetupForInputRouterTest() { |
| 305 input_router_.reset(new MockInputRouter(this)); | 173 input_router_.reset(new MockInputRouter(this)); |
| 306 } | 174 } |
| 307 | 175 |
| 308 MockInputRouter* mock_input_router() { | 176 MockInputRouter* mock_input_router() { |
| 309 return static_cast<MockInputRouter*>(input_router_.get()); | 177 return static_cast<MockInputRouter*>(input_router_.get()); |
| 310 } | 178 } |
| 311 | 179 |
| 312 protected: | 180 protected: |
| 313 virtual void NotifyRendererUnresponsive() OVERRIDE { | 181 virtual void NotifyRendererUnresponsive() OVERRIDE { |
| 314 unresponsive_timer_fired_ = true; | 182 unresponsive_timer_fired_ = true; |
| 315 } | 183 } |
| 316 | 184 |
| 317 const TouchEventQueue& touch_event_queue() const { | |
| 318 return input_router_impl()->touch_event_queue_; | |
| 319 } | |
| 320 | |
| 321 const GestureEventQueue& gesture_event_queue() const { | |
| 322 return input_router_impl()->gesture_event_queue_; | |
| 323 } | |
| 324 | |
| 325 GestureEventQueue& gesture_event_queue() { | |
| 326 return input_router_impl()->gesture_event_queue_; | |
| 327 } | |
| 328 | |
| 329 private: | |
| 330 const InputRouterImpl* input_router_impl() const { | |
| 331 return static_cast<InputRouterImpl*>(input_router_.get()); | |
| 332 } | |
| 333 | |
| 334 InputRouterImpl* input_router_impl() { | |
| 335 return static_cast<InputRouterImpl*>(input_router_.get()); | |
| 336 } | |
| 337 | |
| 338 bool unresponsive_timer_fired_; | 185 bool unresponsive_timer_fired_; |
| 339 WebInputEvent::Type acked_touch_event_type_; | 186 WebInputEvent::Type acked_touch_event_type_; |
| 340 | 187 |
| 341 scoped_ptr<TestOverscrollDelegate> overscroll_delegate_; | |
| 342 | |
| 343 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHost); | 188 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHost); |
| 344 }; | 189 }; |
| 345 | 190 |
| 346 namespace { | 191 namespace { |
| 347 | 192 |
| 348 // RenderWidgetHostProcess ----------------------------------------------------- | 193 // RenderWidgetHostProcess ----------------------------------------------------- |
| 349 | 194 |
| 350 class RenderWidgetHostProcess : public MockRenderProcessHost { | 195 class RenderWidgetHostProcess : public MockRenderProcessHost { |
| 351 public: | 196 public: |
| 352 explicit RenderWidgetHostProcess(BrowserContext* browser_context) | 197 explicit RenderWidgetHostProcess(BrowserContext* browser_context) |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 void SimulateMouseEvent( | 539 void SimulateMouseEvent( |
| 695 WebInputEvent::Type type, int x, int y, int modifiers, bool pressed) { | 540 WebInputEvent::Type type, int x, int y, int modifiers, bool pressed) { |
| 696 WebMouseEvent event = | 541 WebMouseEvent event = |
| 697 SyntheticWebMouseEventBuilder::Build(type, x, y, modifiers); | 542 SyntheticWebMouseEventBuilder::Build(type, x, y, modifiers); |
| 698 if (pressed) | 543 if (pressed) |
| 699 event.button = WebMouseEvent::ButtonLeft; | 544 event.button = WebMouseEvent::ButtonLeft; |
| 700 event.timeStampSeconds = GetNextSimulatedEventTimeSeconds(); | 545 event.timeStampSeconds = GetNextSimulatedEventTimeSeconds(); |
| 701 host_->ForwardMouseEvent(event); | 546 host_->ForwardMouseEvent(event); |
| 702 } | 547 } |
| 703 | 548 |
| 704 void SimulateWheelEventWithPhase(WebMouseWheelEvent::Phase phase) { | |
| 705 host_->ForwardWheelEvent(SyntheticWebMouseWheelEventBuilder::Build(phase)); | |
| 706 } | |
| 707 | |
| 708 // Inject provided synthetic WebGestureEvent instance. | |
| 709 void SimulateGestureEventCore(const WebGestureEvent& gesture_event) { | |
| 710 host_->ForwardGestureEvent(gesture_event); | |
| 711 } | |
| 712 | |
| 713 void SimulateGestureEventCoreWithLatencyInfo( | |
| 714 const WebGestureEvent& gesture_event, | |
| 715 const ui::LatencyInfo& ui_latency) { | |
| 716 host_->ForwardGestureEventWithLatencyInfo(gesture_event, ui_latency); | |
| 717 } | |
| 718 | |
| 719 // Inject simple synthetic WebGestureEvent instances. | 549 // Inject simple synthetic WebGestureEvent instances. |
| 720 void SimulateGestureEvent(WebInputEvent::Type type, | 550 void SimulateGestureEvent(WebInputEvent::Type type, |
| 721 WebGestureEvent::SourceDevice sourceDevice) { | 551 WebGestureEvent::SourceDevice sourceDevice) { |
| 722 SimulateGestureEventCore( | 552 host_->ForwardGestureEvent( |
| 723 SyntheticWebGestureEventBuilder::Build(type, sourceDevice)); | 553 SyntheticWebGestureEventBuilder::Build(type, sourceDevice)); |
| 724 } | 554 } |
| 725 | 555 |
| 726 void SimulateGestureEventWithLatencyInfo( | 556 void SimulateGestureEventWithLatencyInfo( |
| 727 WebInputEvent::Type type, | 557 WebInputEvent::Type type, |
| 728 WebGestureEvent::SourceDevice sourceDevice, | 558 WebGestureEvent::SourceDevice sourceDevice, |
| 729 const ui::LatencyInfo& ui_latency) { | 559 const ui::LatencyInfo& ui_latency) { |
| 730 SimulateGestureEventCoreWithLatencyInfo( | 560 host_->ForwardGestureEventWithLatencyInfo( |
| 731 SyntheticWebGestureEventBuilder::Build(type, sourceDevice), | 561 SyntheticWebGestureEventBuilder::Build(type, sourceDevice), ui_latency); |
| 732 ui_latency); | |
| 733 } | |
| 734 | |
| 735 void SimulateGestureScrollUpdateEvent(float dX, float dY, int modifiers) { | |
| 736 SimulateGestureEventCore( | |
| 737 SyntheticWebGestureEventBuilder::BuildScrollUpdate(dX, dY, modifiers)); | |
| 738 } | |
| 739 | |
| 740 void SimulateGesturePinchUpdateEvent(float scale, | |
| 741 float anchorX, | |
| 742 float anchorY, | |
| 743 int modifiers) { | |
| 744 SimulateGestureEventCore(SyntheticWebGestureEventBuilder::BuildPinchUpdate( | |
| 745 scale, anchorX, anchorY, modifiers, WebGestureEvent::Touchscreen)); | |
| 746 } | |
| 747 | |
| 748 // Inject synthetic GestureFlingStart events. | |
| 749 void SimulateGestureFlingStartEvent( | |
| 750 float velocityX, | |
| 751 float velocityY, | |
| 752 WebGestureEvent::SourceDevice sourceDevice) { | |
| 753 SimulateGestureEventCore( | |
| 754 SyntheticWebGestureEventBuilder::BuildFling(velocityX, | |
| 755 velocityY, | |
| 756 sourceDevice)); | |
| 757 } | 562 } |
| 758 | 563 |
| 759 // Set the timestamp for the touch-event. | 564 // Set the timestamp for the touch-event. |
| 760 void SetTouchTimestamp(base::TimeDelta timestamp) { | 565 void SetTouchTimestamp(base::TimeDelta timestamp) { |
| 761 touch_event_.SetTimestamp(timestamp); | 566 touch_event_.SetTimestamp(timestamp); |
| 762 } | 567 } |
| 763 | 568 |
| 764 // Sends a touch event (irrespective of whether the page has a touch-event | 569 // Sends a touch event (irrespective of whether the page has a touch-event |
| 765 // handler or not). | 570 // handler or not). |
| 766 void SendTouchEvent() { | 571 void SendTouchEvent() { |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 | 1007 |
| 1203 // Wait long enough for first timeout and see if it fired. | 1008 // Wait long enough for first timeout and see if it fired. |
| 1204 base::MessageLoop::current()->PostDelayedTask( | 1009 base::MessageLoop::current()->PostDelayedTask( |
| 1205 FROM_HERE, | 1010 FROM_HERE, |
| 1206 base::MessageLoop::QuitClosure(), | 1011 base::MessageLoop::QuitClosure(), |
| 1207 TimeDelta::FromMilliseconds(40)); | 1012 TimeDelta::FromMilliseconds(40)); |
| 1208 base::MessageLoop::current()->Run(); | 1013 base::MessageLoop::current()->Run(); |
| 1209 EXPECT_TRUE(host_->unresponsive_timer_fired()); | 1014 EXPECT_TRUE(host_->unresponsive_timer_fired()); |
| 1210 } | 1015 } |
| 1211 | 1016 |
| 1212 // Tests that scroll ACKs are correctly handled by the overscroll-navigation | |
| 1213 // controller. | |
| 1214 TEST_F(RenderWidgetHostTest, WheelScrollEventOverscrolls) { | |
| 1215 host_->SetupForOverscrollControllerTest(); | |
| 1216 process_->sink().ClearMessages(); | |
| 1217 | |
| 1218 // Simulate wheel events. | |
| 1219 SimulateWheelEvent(-5, 0, 0, true); // sent directly | |
| 1220 SimulateWheelEvent(-1, 1, 0, true); // enqueued | |
| 1221 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event | |
| 1222 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event | |
| 1223 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event | |
| 1224 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers | |
| 1225 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1226 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1227 process_->sink().ClearMessages(); | |
| 1228 | |
| 1229 // Receive ACK the first wheel event as not processed. | |
| 1230 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1231 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1232 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1233 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1234 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1235 process_->sink().ClearMessages(); | |
| 1236 | |
| 1237 // Receive ACK for the second (coalesced) event as not processed. This will | |
| 1238 // start a back navigation. However, this will also cause the queued next | |
| 1239 // event to be sent to the renderer. But since overscroll navigation has | |
| 1240 // started, that event will also be included in the overscroll computation | |
| 1241 // instead of being sent to the renderer. So the result will be an overscroll | |
| 1242 // back navigation, and no event will be sent to the renderer. | |
| 1243 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1244 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1245 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); | |
| 1246 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->current_mode()); | |
| 1247 EXPECT_EQ(-81.f, host_->overscroll_delta_x()); | |
| 1248 EXPECT_EQ(-31.f, host_->overscroll_delegate()->delta_x()); | |
| 1249 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | |
| 1250 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1251 | |
| 1252 // Send a mouse-move event. This should cancel the overscroll navigation. | |
| 1253 SimulateMouseMove(5, 10, 0); | |
| 1254 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1255 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1256 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1257 } | |
| 1258 | |
| 1259 // Tests that if some scroll events are consumed towards the start, then | |
| 1260 // subsequent scrolls do not horizontal overscroll. | |
| 1261 TEST_F(RenderWidgetHostTest, WheelScrollConsumedDoNotHorizOverscroll) { | |
| 1262 host_->SetupForOverscrollControllerTest(); | |
| 1263 process_->sink().ClearMessages(); | |
| 1264 | |
| 1265 // Simulate wheel events. | |
| 1266 SimulateWheelEvent(-5, 0, 0, true); // sent directly | |
| 1267 SimulateWheelEvent(-1, -1, 0, true); // enqueued | |
| 1268 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event | |
| 1269 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event | |
| 1270 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event | |
| 1271 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers | |
| 1272 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1273 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1274 process_->sink().ClearMessages(); | |
| 1275 | |
| 1276 // Receive ACK the first wheel event as processed. | |
| 1277 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1278 INPUT_EVENT_ACK_STATE_CONSUMED); | |
| 1279 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1280 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1281 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1282 process_->sink().ClearMessages(); | |
| 1283 | |
| 1284 // Receive ACK for the second (coalesced) event as not processed. This should | |
| 1285 // not initiate overscroll, since the beginning of the scroll has been | |
| 1286 // consumed. The queued event with different modifiers should be sent to the | |
| 1287 // renderer. | |
| 1288 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1289 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1290 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1291 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1292 | |
| 1293 process_->sink().ClearMessages(); | |
| 1294 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1295 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1296 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1297 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1298 | |
| 1299 // Indicate the end of the scrolling from the touchpad. | |
| 1300 SimulateGestureFlingStartEvent(-1200.f, 0.f, WebGestureEvent::Touchpad); | |
| 1301 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1302 | |
| 1303 // Start another scroll. This time, do not consume any scroll events. | |
| 1304 process_->sink().ClearMessages(); | |
| 1305 SimulateWheelEvent(0, -5, 0, true); // sent directly | |
| 1306 SimulateWheelEvent(0, -1, 0, true); // enqueued | |
| 1307 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event | |
| 1308 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event | |
| 1309 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event | |
| 1310 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers | |
| 1311 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1312 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1313 process_->sink().ClearMessages(); | |
| 1314 | |
| 1315 // Receive ACK for the first wheel and the subsequent coalesced event as not | |
| 1316 // processed. This should start a back-overscroll. | |
| 1317 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1318 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1319 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1320 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1321 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1322 process_->sink().ClearMessages(); | |
| 1323 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1324 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1325 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); | |
| 1326 } | |
| 1327 | |
| 1328 // Tests that wheel-scrolling correctly turns overscroll on and off. | |
| 1329 TEST_F(RenderWidgetHostTest, WheelScrollOverscrollToggle) { | |
| 1330 host_->SetupForOverscrollControllerTest(); | |
| 1331 process_->sink().ClearMessages(); | |
| 1332 | |
| 1333 // Send a wheel event. ACK the event as not processed. This should not | |
| 1334 // initiate an overscroll gesture since it doesn't cross the threshold yet. | |
| 1335 SimulateWheelEvent(10, 0, 0, true); | |
| 1336 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1337 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1338 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1339 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1340 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1341 process_->sink().ClearMessages(); | |
| 1342 | |
| 1343 // Scroll some more so as to not overscroll. | |
| 1344 SimulateWheelEvent(10, 0, 0, true); | |
| 1345 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1346 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1347 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1348 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1349 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1350 process_->sink().ClearMessages(); | |
| 1351 | |
| 1352 // Scroll some more to initiate an overscroll. | |
| 1353 SimulateWheelEvent(40, 0, 0, true); | |
| 1354 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1355 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1356 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1357 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1358 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1359 EXPECT_EQ(60.f, host_->overscroll_delta_x()); | |
| 1360 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); | |
| 1361 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | |
| 1362 process_->sink().ClearMessages(); | |
| 1363 | |
| 1364 // Scroll in the reverse direction enough to abort the overscroll. | |
| 1365 SimulateWheelEvent(-20, 0, 0, true); | |
| 1366 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1367 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1368 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1369 | |
| 1370 // Continue to scroll in the reverse direction. | |
| 1371 SimulateWheelEvent(-20, 0, 0, true); | |
| 1372 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1373 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1374 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1375 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1376 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1377 process_->sink().ClearMessages(); | |
| 1378 | |
| 1379 // Continue to scroll in the reverse direction enough to initiate overscroll | |
| 1380 // in that direction. | |
| 1381 SimulateWheelEvent(-55, 0, 0, true); | |
| 1382 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1383 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1384 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1385 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); | |
| 1386 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->current_mode()); | |
| 1387 EXPECT_EQ(-75.f, host_->overscroll_delta_x()); | |
| 1388 EXPECT_EQ(-25.f, host_->overscroll_delegate()->delta_x()); | |
| 1389 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | |
| 1390 } | |
| 1391 | |
| 1392 TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithFling) { | |
| 1393 host_->SetupForOverscrollControllerTest(); | |
| 1394 process_->sink().ClearMessages(); | |
| 1395 | |
| 1396 // Send a wheel event. ACK the event as not processed. This should not | |
| 1397 // initiate an overscroll gesture since it doesn't cross the threshold yet. | |
| 1398 SimulateWheelEvent(10, 0, 0, true); | |
| 1399 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1400 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1401 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1402 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1403 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1404 process_->sink().ClearMessages(); | |
| 1405 | |
| 1406 // Scroll some more so as to not overscroll. | |
| 1407 SimulateWheelEvent(20, 0, 0, true); | |
| 1408 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1409 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1410 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1411 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1412 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1413 process_->sink().ClearMessages(); | |
| 1414 | |
| 1415 // Scroll some more to initiate an overscroll. | |
| 1416 SimulateWheelEvent(30, 0, 0, true); | |
| 1417 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1418 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1419 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1420 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1421 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1422 EXPECT_EQ(60.f, host_->overscroll_delta_x()); | |
| 1423 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); | |
| 1424 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | |
| 1425 process_->sink().ClearMessages(); | |
| 1426 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1427 | |
| 1428 // Send a fling start, but with a small velocity, so that the overscroll is | |
| 1429 // aborted. The fling should proceed to the renderer, through the gesture | |
| 1430 // event filter. | |
| 1431 SimulateGestureFlingStartEvent(0.f, 0.1f, WebGestureEvent::Touchpad); | |
| 1432 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1433 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | |
| 1434 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1435 } | |
| 1436 | |
| 1437 // Same as ScrollEventsOverscrollWithFling, but with zero velocity. Checks that | |
| 1438 // the zero-velocity fling does not reach the renderer. | |
| 1439 TEST_F(RenderWidgetHostTest, ScrollEventsOverscrollWithZeroFling) { | |
| 1440 host_->SetupForOverscrollControllerTest(); | |
| 1441 process_->sink().ClearMessages(); | |
| 1442 | |
| 1443 // Send a wheel event. ACK the event as not processed. This should not | |
| 1444 // initiate an overscroll gesture since it doesn't cross the threshold yet. | |
| 1445 SimulateWheelEvent(10, 0, 0, true); | |
| 1446 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1447 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1448 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1449 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1450 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1451 process_->sink().ClearMessages(); | |
| 1452 | |
| 1453 // Scroll some more so as to not overscroll. | |
| 1454 SimulateWheelEvent(20, 0, 0, true); | |
| 1455 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1456 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1457 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1458 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1459 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1460 process_->sink().ClearMessages(); | |
| 1461 | |
| 1462 // Scroll some more to initiate an overscroll. | |
| 1463 SimulateWheelEvent(30, 0, 0, true); | |
| 1464 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1465 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 1466 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1467 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1468 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1469 EXPECT_EQ(60.f, host_->overscroll_delta_x()); | |
| 1470 EXPECT_EQ(10.f, host_->overscroll_delegate()->delta_x()); | |
| 1471 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | |
| 1472 process_->sink().ClearMessages(); | |
| 1473 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1474 | |
| 1475 // Send a fling start, but with a small velocity, so that the overscroll is | |
| 1476 // aborted. The fling should proceed to the renderer, through the gesture | |
| 1477 // event filter. | |
| 1478 SimulateGestureFlingStartEvent(10.f, 0.f, WebGestureEvent::Touchpad); | |
| 1479 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1480 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | |
| 1481 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1482 } | |
| 1483 | |
| 1484 // Tests that a fling in the opposite direction of the overscroll cancels the | |
| 1485 // overscroll nav instead of completing it. | |
| 1486 TEST_F(RenderWidgetHostTest, ReverseFlingCancelsOverscroll) { | |
| 1487 host_->SetupForOverscrollControllerTest(); | |
| 1488 process_->sink().ClearMessages(); | |
| 1489 view_->set_bounds(gfx::Rect(0, 0, 400, 200)); | |
| 1490 view_->Show(); | |
| 1491 | |
| 1492 { | |
| 1493 // Start and end a gesture in the same direction without processing the | |
| 1494 // gesture events in the renderer. This should initiate and complete an | |
| 1495 // overscroll navigation. | |
| 1496 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 1497 WebGestureEvent::Touchscreen); | |
| 1498 SimulateGestureScrollUpdateEvent(300, -5, 0); | |
| 1499 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 1500 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1501 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1502 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1503 process_->sink().ClearMessages(); | |
| 1504 | |
| 1505 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | |
| 1506 WebGestureEvent::Touchscreen); | |
| 1507 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); | |
| 1508 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1509 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1510 } | |
| 1511 | |
| 1512 { | |
| 1513 // Start over, except instead of ending the gesture with ScrollEnd, end it | |
| 1514 // with a FlingStart, with velocity in the reverse direction. This should | |
| 1515 // initiate an overscroll navigation, but it should be cancelled because of | |
| 1516 // the fling in the opposite direction. | |
| 1517 host_->overscroll_delegate()->Reset(); | |
| 1518 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 1519 WebGestureEvent::Touchscreen); | |
| 1520 SimulateGestureScrollUpdateEvent(-300, -5, 0); | |
| 1521 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 1522 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1523 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); | |
| 1524 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->current_mode()); | |
| 1525 process_->sink().ClearMessages(); | |
| 1526 | |
| 1527 SimulateGestureFlingStartEvent(100, 0, WebGestureEvent::Touchscreen); | |
| 1528 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->completed_mode()); | |
| 1529 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1530 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1531 } | |
| 1532 } | |
| 1533 | |
| 1534 // Tests that touch-scroll events are handled correctly by the overscroll | |
| 1535 // controller. This also tests that the overscroll controller and the | |
| 1536 // gesture-event filter play nice with each other. | |
| 1537 TEST_F(RenderWidgetHostTest, GestureScrollOverscrolls) { | |
| 1538 // Turn off debounce handling for test isolation. | |
| 1539 host_->SetupForOverscrollControllerTest(); | |
| 1540 process_->sink().ClearMessages(); | |
| 1541 | |
| 1542 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 1543 WebGestureEvent::Touchscreen); | |
| 1544 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1545 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1546 | |
| 1547 // Send another gesture event and ACK as not being processed. This should | |
| 1548 // initiate the navigation gesture. | |
| 1549 SimulateGestureScrollUpdateEvent(55, -5, 0); | |
| 1550 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 1551 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1552 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1553 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1554 EXPECT_EQ(55.f, host_->overscroll_delta_x()); | |
| 1555 EXPECT_EQ(-5.f, host_->overscroll_delta_y()); | |
| 1556 EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x()); | |
| 1557 EXPECT_EQ(-5.f, host_->overscroll_delegate()->delta_y()); | |
| 1558 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1559 process_->sink().ClearMessages(); | |
| 1560 | |
| 1561 // Send another gesture update event. This event should be consumed by the | |
| 1562 // controller, and not be forwarded to the renderer. The gesture-event filter | |
| 1563 // should not also receive this event. | |
| 1564 SimulateGestureScrollUpdateEvent(10, -5, 0); | |
| 1565 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1566 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1567 EXPECT_EQ(65.f, host_->overscroll_delta_x()); | |
| 1568 EXPECT_EQ(-10.f, host_->overscroll_delta_y()); | |
| 1569 EXPECT_EQ(15.f, host_->overscroll_delegate()->delta_x()); | |
| 1570 EXPECT_EQ(-10.f, host_->overscroll_delegate()->delta_y()); | |
| 1571 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1572 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1573 | |
| 1574 // Now send a scroll end. This should cancel the overscroll gesture, and send | |
| 1575 // the event to the renderer. The gesture-event filter should receive this | |
| 1576 // event. | |
| 1577 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | |
| 1578 WebGestureEvent::Touchscreen); | |
| 1579 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1580 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1581 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1582 // The scroll end event will have received a synthetic ack from the input | |
| 1583 // router. | |
| 1584 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1585 } | |
| 1586 | |
| 1587 // Tests that if the page is scrolled because of a scroll-gesture, then that | |
| 1588 // particular scroll sequence never generates overscroll if the scroll direction | |
| 1589 // is horizontal. | |
| 1590 TEST_F(RenderWidgetHostTest, GestureScrollConsumedHorizontal) { | |
| 1591 // Turn off debounce handling for test isolation. | |
| 1592 host_->SetupForOverscrollControllerTest(); | |
| 1593 process_->sink().ClearMessages(); | |
| 1594 | |
| 1595 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 1596 WebGestureEvent::Touchscreen); | |
| 1597 SimulateGestureScrollUpdateEvent(10, 0, 0); | |
| 1598 | |
| 1599 // Start scrolling on content. ACK both events as being processed. | |
| 1600 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 1601 INPUT_EVENT_ACK_STATE_CONSUMED); | |
| 1602 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1603 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1604 process_->sink().ClearMessages(); | |
| 1605 | |
| 1606 // Send another gesture event and ACK as not being processed. This should | |
| 1607 // not initiate overscroll because the beginning of the scroll event did | |
| 1608 // scroll some content on the page. Since there was no overscroll, the event | |
| 1609 // should reach the renderer. | |
| 1610 SimulateGestureScrollUpdateEvent(55, 0, 0); | |
| 1611 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1612 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 1613 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1614 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1615 } | |
| 1616 | |
| 1617 // Tests that the overscroll controller plays nice with touch-scrolls and the | |
| 1618 // gesture event filter with debounce filtering turned on. | |
| 1619 TEST_F(RenderWidgetHostTest, GestureScrollDebounceOverscrolls) { | |
| 1620 host_->SetupForOverscrollControllerTest(); | |
| 1621 host_->set_debounce_interval_time_ms(100); | |
| 1622 process_->sink().ClearMessages(); | |
| 1623 | |
| 1624 // Start scrolling. Receive ACK as it being processed. | |
| 1625 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 1626 WebGestureEvent::Touchscreen); | |
| 1627 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1628 process_->sink().ClearMessages(); | |
| 1629 | |
| 1630 // Send update events. | |
| 1631 SimulateGestureScrollUpdateEvent(25, 0, 0); | |
| 1632 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | |
| 1633 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | |
| 1634 EXPECT_TRUE(host_->ScrollingInProgress()); | |
| 1635 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1636 process_->sink().ClearMessages(); | |
| 1637 | |
| 1638 // Quickly end and restart the scroll gesture. These two events should get | |
| 1639 // discarded. | |
| 1640 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | |
| 1641 WebGestureEvent::Touchscreen); | |
| 1642 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1643 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | |
| 1644 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); | |
| 1645 | |
| 1646 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 1647 WebGestureEvent::Touchscreen); | |
| 1648 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1649 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | |
| 1650 EXPECT_EQ(2U, host_->GestureEventDebouncingQueueSize()); | |
| 1651 | |
| 1652 // Send another update event. This should get into the queue. | |
| 1653 SimulateGestureScrollUpdateEvent(30, 0, 0); | |
| 1654 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1655 EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize()); | |
| 1656 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | |
| 1657 EXPECT_TRUE(host_->ScrollingInProgress()); | |
| 1658 | |
| 1659 // Receive an ACK for the first scroll-update event as not being processed. | |
| 1660 // This will contribute to the overscroll gesture, but not enough for the | |
| 1661 // overscroll controller to start consuming gesture events. This also cause | |
| 1662 // the queued gesture event to be forwarded to the renderer. | |
| 1663 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 1664 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1665 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1666 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1667 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | |
| 1668 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | |
| 1669 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1670 process_->sink().ClearMessages(); | |
| 1671 | |
| 1672 // Send another update event. This should get into the queue. | |
| 1673 SimulateGestureScrollUpdateEvent(10, 0, 0); | |
| 1674 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1675 EXPECT_EQ(2U, host_->GestureEventLastQueueEventSize()); | |
| 1676 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | |
| 1677 EXPECT_TRUE(host_->ScrollingInProgress()); | |
| 1678 | |
| 1679 // Receive an ACK for the second scroll-update event as not being processed. | |
| 1680 // This will now initiate an overscroll. This will also cause the queued | |
| 1681 // gesture event to be released. But instead of going to the renderer, it will | |
| 1682 // be consumed by the overscroll controller. | |
| 1683 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 1684 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1685 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1686 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1687 EXPECT_EQ(65.f, host_->overscroll_delta_x()); | |
| 1688 EXPECT_EQ(15.f, host_->overscroll_delegate()->delta_x()); | |
| 1689 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | |
| 1690 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1691 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1692 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | |
| 1693 } | |
| 1694 | |
| 1695 // Tests that the gesture debounce timer plays nice with the overscroll | |
| 1696 // controller. | |
| 1697 TEST_F(RenderWidgetHostTest, GestureScrollDebounceTimerOverscroll) { | |
| 1698 host_->SetupForOverscrollControllerTest(); | |
| 1699 host_->set_debounce_interval_time_ms(10); | |
| 1700 process_->sink().ClearMessages(); | |
| 1701 | |
| 1702 // Start scrolling. Receive ACK as it being processed. | |
| 1703 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 1704 WebGestureEvent::Touchscreen); | |
| 1705 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1706 process_->sink().ClearMessages(); | |
| 1707 | |
| 1708 // Send update events. | |
| 1709 SimulateGestureScrollUpdateEvent(55, 0, 0); | |
| 1710 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | |
| 1711 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | |
| 1712 EXPECT_TRUE(host_->ScrollingInProgress()); | |
| 1713 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1714 process_->sink().ClearMessages(); | |
| 1715 | |
| 1716 // Send an end event. This should get in the debounce queue. | |
| 1717 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | |
| 1718 WebGestureEvent::Touchscreen); | |
| 1719 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1720 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | |
| 1721 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); | |
| 1722 | |
| 1723 // Receive ACK for the scroll-update event. | |
| 1724 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 1725 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1726 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1727 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1728 EXPECT_EQ(55.f, host_->overscroll_delta_x()); | |
| 1729 EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x()); | |
| 1730 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | |
| 1731 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1732 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); | |
| 1733 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1734 | |
| 1735 // Let the timer for the debounce queue fire. That should release the queued | |
| 1736 // scroll-end event. Since overscroll has started, but there hasn't been | |
| 1737 // enough overscroll to complete the gesture, the overscroll controller | |
| 1738 // will reset the state. The scroll-end should therefore be dispatched to the | |
| 1739 // renderer, and the gesture-event-filter should await an ACK for it. | |
| 1740 base::MessageLoop::current()->PostDelayedTask( | |
| 1741 FROM_HERE, | |
| 1742 base::MessageLoop::QuitClosure(), | |
| 1743 TimeDelta::FromMilliseconds(15)); | |
| 1744 base::MessageLoop::current()->Run(); | |
| 1745 | |
| 1746 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1747 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1748 // The scroll end event will have received a synthetic ack from the input | |
| 1749 // router. | |
| 1750 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1751 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | |
| 1752 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1753 } | |
| 1754 | |
| 1755 // Tests that when touch-events are dispatched to the renderer, the overscroll | |
| 1756 // gesture deals with them correctly. | |
| 1757 TEST_F(RenderWidgetHostTest, OverscrollWithTouchEvents) { | |
| 1758 host_->SetupForOverscrollControllerTest(); | |
| 1759 host_->set_debounce_interval_time_ms(10); | |
| 1760 host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); | |
| 1761 process_->sink().ClearMessages(); | |
| 1762 view_->set_bounds(gfx::Rect(0, 0, 400, 200)); | |
| 1763 view_->Show(); | |
| 1764 | |
| 1765 // The test sends an intermingled sequence of touch and gesture events. | |
| 1766 | |
| 1767 PressTouchPoint(0, 1); | |
| 1768 SendTouchEvent(); | |
| 1769 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1770 process_->sink().ClearMessages(); | |
| 1771 SendInputEventACK(WebInputEvent::TouchStart, | |
| 1772 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1773 | |
| 1774 MoveTouchPoint(0, 20, 5); | |
| 1775 SendTouchEvent(); | |
| 1776 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1777 process_->sink().ClearMessages(); | |
| 1778 SendInputEventACK(WebInputEvent::TouchMove, | |
| 1779 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1780 | |
| 1781 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1782 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1783 | |
| 1784 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 1785 WebGestureEvent::Touchscreen); | |
| 1786 SimulateGestureScrollUpdateEvent(20, 0, 0); | |
| 1787 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 1788 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1789 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1790 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1791 process_->sink().ClearMessages(); | |
| 1792 | |
| 1793 // Another touch move event should reach the renderer since overscroll hasn't | |
| 1794 // started yet. | |
| 1795 MoveTouchPoint(0, 65, 10); | |
| 1796 SendTouchEvent(); | |
| 1797 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1798 process_->sink().ClearMessages(); | |
| 1799 | |
| 1800 SendInputEventACK(WebInputEvent::TouchMove, | |
| 1801 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1802 SimulateGestureScrollUpdateEvent(45, 0, 0); | |
| 1803 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 1804 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1805 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1806 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1807 EXPECT_EQ(65.f, host_->overscroll_delta_x()); | |
| 1808 EXPECT_EQ(15.f, host_->overscroll_delegate()->delta_x()); | |
| 1809 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | |
| 1810 EXPECT_TRUE(host_->TouchEventQueueEmpty()); | |
| 1811 process_->sink().ClearMessages(); | |
| 1812 | |
| 1813 // Send another touch event. The page should get the touch-move event, even | |
| 1814 // though overscroll has started. | |
| 1815 MoveTouchPoint(0, 55, 5); | |
| 1816 SendTouchEvent(); | |
| 1817 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1818 EXPECT_FALSE(host_->TouchEventQueueEmpty()); | |
| 1819 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1820 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1821 EXPECT_EQ(65.f, host_->overscroll_delta_x()); | |
| 1822 EXPECT_EQ(15.f, host_->overscroll_delegate()->delta_x()); | |
| 1823 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | |
| 1824 | |
| 1825 SendInputEventACK(WebInputEvent::TouchMove, | |
| 1826 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1827 EXPECT_TRUE(host_->TouchEventQueueEmpty()); | |
| 1828 process_->sink().ClearMessages(); | |
| 1829 | |
| 1830 SimulateGestureScrollUpdateEvent(-10, 0, 0); | |
| 1831 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1832 EXPECT_TRUE(host_->TouchEventQueueEmpty()); | |
| 1833 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1834 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1835 EXPECT_EQ(55.f, host_->overscroll_delta_x()); | |
| 1836 EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x()); | |
| 1837 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | |
| 1838 | |
| 1839 MoveTouchPoint(0, 255, 5); | |
| 1840 SendTouchEvent(); | |
| 1841 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1842 EXPECT_FALSE(host_->TouchEventQueueEmpty()); | |
| 1843 process_->sink().ClearMessages(); | |
| 1844 SendInputEventACK(WebInputEvent::TouchMove, | |
| 1845 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1846 | |
| 1847 SimulateGestureScrollUpdateEvent(200, 0, 0); | |
| 1848 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1849 EXPECT_TRUE(host_->TouchEventQueueEmpty()); | |
| 1850 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1851 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1852 EXPECT_EQ(255.f, host_->overscroll_delta_x()); | |
| 1853 EXPECT_EQ(205.f, host_->overscroll_delegate()->delta_x()); | |
| 1854 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | |
| 1855 | |
| 1856 // The touch-end/cancel event should always reach the renderer if the page has | |
| 1857 // touch handlers. | |
| 1858 ReleaseTouchPoint(0); | |
| 1859 SendTouchEvent(); | |
| 1860 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1861 EXPECT_FALSE(host_->TouchEventQueueEmpty()); | |
| 1862 process_->sink().ClearMessages(); | |
| 1863 | |
| 1864 SendInputEventACK(WebInputEvent::TouchEnd, | |
| 1865 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1866 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1867 EXPECT_TRUE(host_->TouchEventQueueEmpty()); | |
| 1868 | |
| 1869 SimulateGestureEvent(blink::WebInputEvent::GestureScrollEnd, | |
| 1870 WebGestureEvent::Touchscreen); | |
| 1871 base::MessageLoop::current()->PostDelayedTask( | |
| 1872 FROM_HERE, | |
| 1873 base::MessageLoop::QuitClosure(), | |
| 1874 TimeDelta::FromMilliseconds(10)); | |
| 1875 base::MessageLoop::current()->Run(); | |
| 1876 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1877 EXPECT_TRUE(host_->TouchEventQueueEmpty()); | |
| 1878 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1879 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1880 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); | |
| 1881 } | |
| 1882 | |
| 1883 // Tests that touch-gesture end is dispatched to the renderer at the end of a | |
| 1884 // touch-gesture initiated overscroll. | |
| 1885 TEST_F(RenderWidgetHostTest, TouchGestureEndDispatchedAfterOverscrollComplete) { | |
| 1886 host_->SetupForOverscrollControllerTest(); | |
| 1887 host_->set_debounce_interval_time_ms(10); | |
| 1888 host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); | |
| 1889 process_->sink().ClearMessages(); | |
| 1890 view_->set_bounds(gfx::Rect(0, 0, 400, 200)); | |
| 1891 view_->Show(); | |
| 1892 | |
| 1893 // Start scrolling. Receive ACK as it being processed. | |
| 1894 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 1895 WebGestureEvent::Touchscreen); | |
| 1896 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1897 // The scroll begin event will have received a synthetic ack from the input | |
| 1898 // router. | |
| 1899 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1900 process_->sink().ClearMessages(); | |
| 1901 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1902 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1903 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1904 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1905 | |
| 1906 // Send update events. | |
| 1907 SimulateGestureScrollUpdateEvent(55, -5, 0); | |
| 1908 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | |
| 1909 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | |
| 1910 EXPECT_TRUE(host_->ScrollingInProgress()); | |
| 1911 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1912 process_->sink().ClearMessages(); | |
| 1913 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1914 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1915 | |
| 1916 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 1917 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1918 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1919 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1920 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1921 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1922 EXPECT_EQ(55.f, host_->overscroll_delta_x()); | |
| 1923 EXPECT_EQ(5.f, host_->overscroll_delegate()->delta_x()); | |
| 1924 EXPECT_EQ(-5.f, host_->overscroll_delegate()->delta_y()); | |
| 1925 | |
| 1926 // Send end event. | |
| 1927 SimulateGestureEvent(blink::WebInputEvent::GestureScrollEnd, | |
| 1928 WebGestureEvent::Touchscreen); | |
| 1929 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1930 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1931 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1932 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->completed_mode()); | |
| 1933 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1934 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); | |
| 1935 base::MessageLoop::current()->PostDelayedTask( | |
| 1936 FROM_HERE, | |
| 1937 base::MessageLoop::QuitClosure(), | |
| 1938 TimeDelta::FromMilliseconds(10)); | |
| 1939 base::MessageLoop::current()->Run(); | |
| 1940 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1941 process_->sink().ClearMessages(); | |
| 1942 // The scroll end event will have received a synthetic ack from the input | |
| 1943 // router. | |
| 1944 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1945 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | |
| 1946 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1947 | |
| 1948 // Start scrolling. Receive ACK as it being processed. | |
| 1949 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 1950 WebGestureEvent::Touchscreen); | |
| 1951 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1952 // The scroll begin event will have received a synthetic ack from the input | |
| 1953 // router. | |
| 1954 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1955 process_->sink().ClearMessages(); | |
| 1956 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1957 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1958 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1959 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1960 | |
| 1961 // Send update events. | |
| 1962 SimulateGestureScrollUpdateEvent(235, -5, 0); | |
| 1963 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | |
| 1964 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | |
| 1965 EXPECT_TRUE(host_->ScrollingInProgress()); | |
| 1966 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1967 process_->sink().ClearMessages(); | |
| 1968 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1969 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1970 | |
| 1971 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 1972 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 1973 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1974 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1975 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 1976 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 1977 EXPECT_EQ(235.f, host_->overscroll_delta_x()); | |
| 1978 EXPECT_EQ(185.f, host_->overscroll_delegate()->delta_x()); | |
| 1979 EXPECT_EQ(-5.f, host_->overscroll_delegate()->delta_y()); | |
| 1980 | |
| 1981 // Send end event. | |
| 1982 SimulateGestureEvent(blink::WebInputEvent::GestureScrollEnd, | |
| 1983 WebGestureEvent::Touchscreen); | |
| 1984 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 1985 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 1986 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 1987 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); | |
| 1988 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 1989 EXPECT_EQ(1U, host_->GestureEventDebouncingQueueSize()); | |
| 1990 | |
| 1991 base::MessageLoop::current()->PostDelayedTask( | |
| 1992 FROM_HERE, | |
| 1993 base::MessageLoop::QuitClosure(), | |
| 1994 TimeDelta::FromMilliseconds(10)); | |
| 1995 base::MessageLoop::current()->Run(); | |
| 1996 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 1997 process_->sink().ClearMessages(); | |
| 1998 // The scroll end event will have received a synthetic ack from the input | |
| 1999 // router. | |
| 2000 EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); | |
| 2001 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | |
| 2002 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 2003 } | |
| 2004 | |
| 2005 TEST_F(RenderWidgetHostTest, OverscrollDirectionChange) { | |
| 2006 host_->SetupForOverscrollControllerTest(); | |
| 2007 host_->set_debounce_interval_time_ms(100); | |
| 2008 process_->sink().ClearMessages(); | |
| 2009 | |
| 2010 // Start scrolling. Receive ACK as it being processed. | |
| 2011 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 2012 WebGestureEvent::Touchscreen); | |
| 2013 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2014 process_->sink().ClearMessages(); | |
| 2015 | |
| 2016 // Send update events and receive ack as not consumed. | |
| 2017 SimulateGestureScrollUpdateEvent(125, -5, 0); | |
| 2018 EXPECT_EQ(1U, host_->GestureEventLastQueueEventSize()); | |
| 2019 EXPECT_EQ(0U, host_->GestureEventDebouncingQueueSize()); | |
| 2020 EXPECT_TRUE(host_->ScrollingInProgress()); | |
| 2021 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2022 process_->sink().ClearMessages(); | |
| 2023 | |
| 2024 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 2025 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 2026 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 2027 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 2028 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 2029 | |
| 2030 // Send another update event, but in the reverse direction. The overscroll | |
| 2031 // controller will consume the event, and reset the overscroll mode. | |
| 2032 SimulateGestureScrollUpdateEvent(-260, 0, 0); | |
| 2033 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 2034 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 2035 | |
| 2036 // Since the overscroll mode has been reset, the next scroll update events | |
| 2037 // should reach the renderer. | |
| 2038 SimulateGestureScrollUpdateEvent(-20, 0, 0); | |
| 2039 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2040 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 2041 } | |
| 2042 | |
| 2043 // Tests that if a mouse-move event completes the overscroll gesture, future | |
| 2044 // move events do reach the renderer. | |
| 2045 TEST_F(RenderWidgetHostTest, OverscrollMouseMoveCompletion) { | |
| 2046 host_->SetupForOverscrollControllerTest(); | |
| 2047 process_->sink().ClearMessages(); | |
| 2048 view_->set_bounds(gfx::Rect(0, 0, 400, 200)); | |
| 2049 view_->Show(); | |
| 2050 | |
| 2051 SimulateWheelEvent(5, 0, 0, true); // sent directly | |
| 2052 SimulateWheelEvent(-1, 0, 0, true); // enqueued | |
| 2053 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event | |
| 2054 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event | |
| 2055 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event | |
| 2056 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 2057 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2058 process_->sink().ClearMessages(); | |
| 2059 | |
| 2060 // Receive ACK the first wheel event as not processed. | |
| 2061 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 2062 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 2063 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 2064 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 2065 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2066 process_->sink().ClearMessages(); | |
| 2067 | |
| 2068 // Receive ACK for the second (coalesced) event as not processed. This will | |
| 2069 // start an overcroll gesture. | |
| 2070 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 2071 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 2072 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); | |
| 2073 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->current_mode()); | |
| 2074 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 2075 | |
| 2076 // Send a mouse-move event. This should cancel the overscroll navigation | |
| 2077 // (since the amount overscrolled is not above the threshold), and so the | |
| 2078 // mouse-move should reach the renderer. | |
| 2079 SimulateMouseMove(5, 10, 0); | |
| 2080 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 2081 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->completed_mode()); | |
| 2082 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 2083 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2084 process_->sink().ClearMessages(); | |
| 2085 | |
| 2086 SendInputEventACK(WebInputEvent::MouseMove, | |
| 2087 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 2088 | |
| 2089 // Moving the mouse more should continue to send the events to the renderer. | |
| 2090 SimulateMouseMove(5, 10, 0); | |
| 2091 SendInputEventACK(WebInputEvent::MouseMove, | |
| 2092 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 2093 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2094 process_->sink().ClearMessages(); | |
| 2095 | |
| 2096 // Now try with gestures. | |
| 2097 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 2098 WebGestureEvent::Touchscreen); | |
| 2099 SimulateGestureScrollUpdateEvent(300, -5, 0); | |
| 2100 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 2101 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 2102 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 2103 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 2104 process_->sink().ClearMessages(); | |
| 2105 | |
| 2106 // Overscroll gesture is in progress. Send a mouse-move now. This should | |
| 2107 // complete the gesture (because the amount overscrolled is above the | |
| 2108 // threshold). | |
| 2109 SimulateMouseMove(5, 10, 0); | |
| 2110 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); | |
| 2111 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 2112 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 2113 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2114 process_->sink().ClearMessages(); | |
| 2115 SendInputEventACK(WebInputEvent::MouseMove, | |
| 2116 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 2117 | |
| 2118 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | |
| 2119 WebGestureEvent::Touchscreen); | |
| 2120 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 2121 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2122 process_->sink().ClearMessages(); | |
| 2123 | |
| 2124 // Move mouse some more. The mouse-move events should reach the renderer. | |
| 2125 SimulateMouseMove(5, 10, 0); | |
| 2126 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2127 | |
| 2128 SendInputEventACK(WebInputEvent::MouseMove, | |
| 2129 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 2130 process_->sink().ClearMessages(); | |
| 2131 } | |
| 2132 | |
| 2133 // Tests that if a page scrolled, then the overscroll controller's states are | |
| 2134 // reset after the end of the scroll. | |
| 2135 TEST_F(RenderWidgetHostTest, OverscrollStateResetsAfterScroll) { | |
| 2136 host_->SetupForOverscrollControllerTest(); | |
| 2137 process_->sink().ClearMessages(); | |
| 2138 view_->set_bounds(gfx::Rect(0, 0, 400, 200)); | |
| 2139 view_->Show(); | |
| 2140 | |
| 2141 SimulateWheelEvent(0, 5, 0, true); // sent directly | |
| 2142 SimulateWheelEvent(0, 30, 0, true); // enqueued | |
| 2143 SimulateWheelEvent(0, 40, 0, true); // coalesced into previous event | |
| 2144 SimulateWheelEvent(0, 10, 0, true); // coalesced into previous event | |
| 2145 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 2146 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2147 process_->sink().ClearMessages(); | |
| 2148 | |
| 2149 // The first wheel event is consumed. Dispatches the queued wheel event. | |
| 2150 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 2151 INPUT_EVENT_ACK_STATE_CONSUMED); | |
| 2152 EXPECT_TRUE(host_->ScrollStateIsContentScrolling()); | |
| 2153 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2154 process_->sink().ClearMessages(); | |
| 2155 | |
| 2156 // The second wheel event is consumed. | |
| 2157 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 2158 INPUT_EVENT_ACK_STATE_CONSUMED); | |
| 2159 EXPECT_TRUE(host_->ScrollStateIsContentScrolling()); | |
| 2160 | |
| 2161 // Touchpad scroll can end with a zero-velocity fling. But it is not | |
| 2162 // dispatched, but it should still reset the overscroll controller state. | |
| 2163 SimulateGestureFlingStartEvent(0.f, 0.f, WebGestureEvent::Touchpad); | |
| 2164 EXPECT_TRUE(host_->ScrollStateIsUnknown()); | |
| 2165 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 2166 | |
| 2167 SimulateWheelEvent(-5, 0, 0, true); // sent directly | |
| 2168 SimulateWheelEvent(-60, 0, 0, true); // enqueued | |
| 2169 SimulateWheelEvent(-100, 0, 0, true); // coalesced into previous event | |
| 2170 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2171 EXPECT_TRUE(host_->ScrollStateIsUnknown()); | |
| 2172 process_->sink().ClearMessages(); | |
| 2173 | |
| 2174 // The first wheel scroll did not scroll content. Overscroll should not start | |
| 2175 // yet, since enough hasn't been scrolled. | |
| 2176 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 2177 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 2178 EXPECT_TRUE(host_->ScrollStateIsUnknown()); | |
| 2179 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2180 process_->sink().ClearMessages(); | |
| 2181 | |
| 2182 SendInputEventACK(WebInputEvent::MouseWheel, | |
| 2183 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 2184 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_mode()); | |
| 2185 EXPECT_TRUE(host_->ScrollStateIsOverscrolling()); | |
| 2186 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 2187 | |
| 2188 SimulateGestureFlingStartEvent(0.f, 0.f, WebGestureEvent::Touchpad); | |
| 2189 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 2190 EXPECT_EQ(OVERSCROLL_WEST, host_->overscroll_delegate()->completed_mode()); | |
| 2191 EXPECT_TRUE(host_->ScrollStateIsUnknown()); | |
| 2192 EXPECT_EQ(0U, process_->sink().message_count()); | |
| 2193 process_->sink().ClearMessages(); | |
| 2194 } | |
| 2195 | |
| 2196 TEST_F(RenderWidgetHostTest, OverscrollResetsOnBlur) { | |
| 2197 host_->SetupForOverscrollControllerTest(); | |
| 2198 process_->sink().ClearMessages(); | |
| 2199 view_->set_bounds(gfx::Rect(0, 0, 400, 200)); | |
| 2200 view_->Show(); | |
| 2201 | |
| 2202 // Start an overscroll with gesture scroll. In the middle of the scroll, blur | |
| 2203 // the host. | |
| 2204 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 2205 WebGestureEvent::Touchscreen); | |
| 2206 SimulateGestureScrollUpdateEvent(300, -5, 0); | |
| 2207 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 2208 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 2209 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 2210 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 2211 EXPECT_EQ(2U, process_->sink().message_count()); | |
| 2212 | |
| 2213 host_->Blur(); | |
| 2214 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode()); | |
| 2215 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 2216 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->completed_mode()); | |
| 2217 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_x()); | |
| 2218 EXPECT_EQ(0.f, host_->overscroll_delegate()->delta_y()); | |
| 2219 process_->sink().ClearMessages(); | |
| 2220 | |
| 2221 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | |
| 2222 WebGestureEvent::Touchscreen); | |
| 2223 EXPECT_EQ(1U, process_->sink().message_count()); | |
| 2224 process_->sink().ClearMessages(); | |
| 2225 | |
| 2226 // Start a scroll gesture again. This should correctly start the overscroll | |
| 2227 // after the threshold. | |
| 2228 SimulateGestureEvent(WebInputEvent::GestureScrollBegin, | |
| 2229 WebGestureEvent::Touchscreen); | |
| 2230 SimulateGestureScrollUpdateEvent(300, -5, 0); | |
| 2231 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | |
| 2232 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | |
| 2233 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_mode()); | |
| 2234 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->current_mode()); | |
| 2235 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->completed_mode()); | |
| 2236 | |
| 2237 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | |
| 2238 WebGestureEvent::Touchscreen); | |
| 2239 EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode()); | |
| 2240 EXPECT_EQ(OVERSCROLL_EAST, host_->overscroll_delegate()->completed_mode()); | |
| 2241 EXPECT_EQ(3U, process_->sink().message_count()); | |
| 2242 } | |
| 2243 | |
| 2244 std::string GetInputMessageTypes(RenderWidgetHostProcess* process) { | 1017 std::string GetInputMessageTypes(RenderWidgetHostProcess* process) { |
| 2245 std::string result; | 1018 std::string result; |
| 2246 for (size_t i = 0; i < process->sink().message_count(); ++i) { | 1019 for (size_t i = 0; i < process->sink().message_count(); ++i) { |
| 2247 const IPC::Message *message = process->sink().GetMessageAt(i); | 1020 const IPC::Message *message = process->sink().GetMessageAt(i); |
| 2248 EXPECT_EQ(InputMsg_HandleInputEvent::ID, message->type()); | 1021 EXPECT_EQ(InputMsg_HandleInputEvent::ID, message->type()); |
| 2249 InputMsg_HandleInputEvent::Param params; | 1022 InputMsg_HandleInputEvent::Param params; |
| 2250 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(message, ¶ms)); | 1023 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(message, ¶ms)); |
| 2251 const WebInputEvent* event = params.a; | 1024 const WebInputEvent* event = params.a; |
| 2252 if (i != 0) | 1025 if (i != 0) |
| 2253 result += " "; | 1026 result += " "; |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2634 | 1407 |
| 2635 // Tests RWHI::ForwardTouchEventWithLatencyInfo(). | 1408 // Tests RWHI::ForwardTouchEventWithLatencyInfo(). |
| 2636 PressTouchPoint(0, 1); | 1409 PressTouchPoint(0, 1); |
| 2637 SendTouchEvent(); | 1410 SendTouchEvent(); |
| 2638 CheckLatencyInfoComponentInMessage( | 1411 CheckLatencyInfoComponentInMessage( |
| 2639 process_, GetLatencyComponentId(), WebInputEvent::TouchStart); | 1412 process_, GetLatencyComponentId(), WebInputEvent::TouchStart); |
| 2640 SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); | 1413 SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); |
| 2641 } | 1414 } |
| 2642 | 1415 |
| 2643 } // namespace content | 1416 } // namespace content |
| OLD | NEW |