Chromium Code Reviews| Index: content/browser/renderer_host/input/input_router_unittest.cc |
| diff --git a/content/browser/renderer_host/input/input_router_unittest.cc b/content/browser/renderer_host/input/input_router_unittest.cc |
| index 55ee320500c833f99107cfcdd6409f0e844b96a1..4944e01339c0319c6dc9705c9ba83552ad22026f 100644 |
| --- a/content/browser/renderer_host/input/input_router_unittest.cc |
| +++ b/content/browser/renderer_host/input/input_router_unittest.cc |
| @@ -74,14 +74,12 @@ void InputRouterTest::SimulateWheelEventWithPhase( |
| SyntheticWebMouseWheelEventBuilder::Build(phase), ui::LatencyInfo())); |
| } |
| -// Inject provided synthetic WebGestureEvent instance. |
| void InputRouterTest::SimulateGestureEvent( |
| const WebGestureEvent& gesture) { |
| GestureEventWithLatencyInfo gesture_with_latency(gesture, ui::LatencyInfo()); |
| input_router_->SendGestureEvent(gesture_with_latency); |
| } |
| -// Inject simple synthetic WebGestureEvent instances. |
| void InputRouterTest::SimulateGestureEvent( |
| WebInputEvent::Type type, |
| WebGestureEvent::SourceDevice sourceDevice) { |
| @@ -107,7 +105,6 @@ void InputRouterTest::SimulateGesturePinchUpdateEvent(float scale, |
| modifiers)); |
| } |
| -// Inject synthetic GestureFlingStart events. |
| void InputRouterTest::SimulateGestureFlingStartEvent( |
| float velocityX, |
| float velocityY, |
| @@ -118,18 +115,30 @@ void InputRouterTest::SimulateGestureFlingStartEvent( |
| sourceDevice)); |
| } |
| -void InputRouterTest::SimulateTouchEvent(int x, int y) { |
| - PressTouchPoint(x, y); |
| +void InputRouterTest::SimulateTouchEvent(WebInputEvent::Type type) { |
| + ASSERT_TRUE(WebInputEvent::isTouchEventType(type)); |
| + touch_event_.ResetPoints(); |
| + int index = PressTouchPoint(0, 0); |
| + switch (type) { |
| + case WebInputEvent::TouchMove: |
| + MoveTouchPoint(index, 5, 5); |
| + break; |
| + case WebInputEvent::TouchEnd: |
| + ReleaseTouchPoint(index); |
| + break; |
| + case WebInputEvent::TouchCancel: |
| + CancelTouchPoint(index); |
| + break; |
| + default: |
|
tdresser
2013/11/21 13:54:31
nit - add a NOTREACHED() here.
jdduke (slow)
2013/11/21 16:55:29
Hmm, I have the assert above for type being a vali
tdresser
2013/11/21 17:02:48
Ah, good point. I do like this somewhat better tho
|
| + break; |
| + } |
| SendTouchEvent(); |
| } |
| -// Set the timestamp for the touch-event. |
| void InputRouterTest::SetTouchTimestamp(base::TimeDelta timestamp) { |
| touch_event_.SetTimestamp(timestamp); |
| } |
| -// Sends a touch event (irrespective of whether the page has a touch-event |
| -// handler or not). |
| void InputRouterTest::SendTouchEvent() { |
| input_router_->SendTouchEvent( |
| TouchEventWithLatencyInfo(touch_event_, ui::LatencyInfo())); |
| @@ -148,4 +157,8 @@ void InputRouterTest::ReleaseTouchPoint(int index) { |
| touch_event_.ReleasePoint(index); |
| } |
| +void InputRouterTest::CancelTouchPoint(int index) { |
| + touch_event_.CancelPoint(index); |
| +} |
| + |
| } // namespace content |