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

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

Issue 2801043002: Fix RenderWidgetHostLatencyTracker handling of multi-finger touch. (Closed)
Patch Set: Created 3 years, 8 months 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/render_widget_host_latency_tracker_unittest.cc
diff --git a/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc b/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
index a161e2f0938b8dffdf03742c0d3906c14458f076..7dd741d6fa3b2d6e622727bd8e5a7eae256566dc 100644
--- a/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
+++ b/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
@@ -966,4 +966,122 @@ TEST_F(RenderWidgetHostLatencyTrackerTest, TouchBlockingAndQueueingTime) {
touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1)));
}
+// Some touch input histograms aren't reported for multi-finger touch.
mfomitchev 2017/04/06 15:27:04 aren't -> should not be? Or maybe just say that Ev
tdresser 2017/04/06 20:50:09 Done.
+TEST_F(RenderWidgetHostLatencyTrackerTest, MultiFingerTouchIgnored) {
+ SyntheticWebTouchEvent event;
+ InputEventAckState ack_state = INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
+
+ {
+ // First touch start.
+ ui::LatencyInfo latency;
+ event.PressPoint(1, 1);
+ tracker()->OnInputEvent(event, &latency);
+ tracker()->OnInputEventAck(event, &latency, ack_state);
+ }
+
+ {
+ // Additional touch start will be ignored.
mfomitchev 2017/04/06 15:27:04 It't not completely ignored, right? We are still l
tdresser 2017/04/06 20:50:09 Done.
+ int touchstart_timestamps_ms[] = {11, 25, 35};
+ ui::LatencyInfo latency;
+ event.PressPoint(1, 1);
+ tracker()->OnInputEvent(event, &latency);
+
+ ui::LatencyInfo fake_latency;
+ fake_latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
+ tracker()->latency_component_id(), 0,
+ base::TimeTicks() +
+ base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[0]),
+ 1);
+
+ fake_latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT, 0, 0,
+ base::TimeTicks() +
+ base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[1]),
+ 1);
+
+ fake_latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0,
+ base::TimeTicks() +
+ base::TimeDelta::FromMilliseconds(touchstart_timestamps_ms[2]),
+ 1);
+
+ // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
+ // overwriting components.
+ tracker()->ComputeInputLatencyHistograms(event.type(),
+ tracker()->latency_component_id(),
+ fake_latency, ack_state);
+
+ tracker()->OnInputEventAck(event, &latency, ack_state);
+ }
+
+ // Touch start.
mfomitchev 2017/04/06 15:27:04 I am not sure if this comment is helpful (maybe I
tdresser 2017/04/06 20:50:09 Copy/paste fail, thanks.
+ EXPECT_THAT(histogram_tester().GetAllSamples(
+ "Event.Latency.QueueingTime.TouchStartDefaultAllowed"),
+ ElementsAre());
+}
+
+// Some touch input histograms aren't reported for multi-finger touch. Other
+// input modalities shouldn't be impacted by there being an active multi-finger
+// touch gesture.
+TEST_F(RenderWidgetHostLatencyTrackerTest, WheelDuringMultiFingerTouch) {
+ SyntheticWebTouchEvent touch_event;
+ InputEventAckState ack_state = INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
+
+ {
+ // First touch start.
+ ui::LatencyInfo latency;
+ touch_event.PressPoint(1, 1);
+ tracker()->OnInputEvent(touch_event, &latency);
+ tracker()->OnInputEventAck(touch_event, &latency, ack_state);
+ }
+
+ {
+ // Second touch start.
+ ui::LatencyInfo latency;
+ touch_event.PressPoint(1, 1);
+ tracker()->OnInputEvent(touch_event, &latency);
+ tracker()->OnInputEventAck(touch_event, &latency, ack_state);
+ }
+
+ {
+ // Wheel event.
+ ui::LatencyInfo latency;
+ // These numbers are sensitive to where the histogram buckets are.
+ int timestamps_ms[] = {11, 25, 35};
+ auto wheel_event = SyntheticWebMouseWheelEventBuilder::Build(
+ blink::WebMouseWheelEvent::PhaseChanged);
+ tracker()->OnInputEvent(touch_event, &latency);
+
+ ui::LatencyInfo fake_latency;
+ fake_latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
+ tracker()->latency_component_id(), 0,
+ base::TimeTicks() + base::TimeDelta::FromMilliseconds(timestamps_ms[0]),
+ 1);
+
+ fake_latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_RENDERER_MAIN_COMPONENT, 0, 0,
+ base::TimeTicks() + base::TimeDelta::FromMilliseconds(timestamps_ms[1]),
+ 1);
+
+ fake_latency.AddLatencyNumberWithTimestamp(
+ ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0,
+ base::TimeTicks() + base::TimeDelta::FromMilliseconds(timestamps_ms[2]),
+ 1);
+
+ // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck
+ // overwriting components.
+ tracker()->ComputeInputLatencyHistograms(wheel_event.type(),
+ tracker()->latency_component_id(),
+ fake_latency, ack_state);
+
+ tracker()->OnInputEventAck(wheel_event, &latency, ack_state);
+ }
+
+ EXPECT_THAT(histogram_tester().GetAllSamples(
+ "Event.Latency.QueueingTime.MouseWheelDefaultAllowed"),
+ ElementsAre(Bucket(14, 1)));
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698