Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Unified Diff: content/browser/renderer_host/input/input_router_unittest.cc

Issue 78263003: Ignore TouchCancel ack dispositions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Speculative fix... Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698