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

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

Issue 2884953002: Fix Mouse Event Tracing (requires making some events blocking.) (Closed)
Patch Set: Disable test on Android, as mouse input isn't supported. Created 3 years, 7 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/input_router_impl_unittest.cc
diff --git a/content/browser/renderer_host/input/input_router_impl_unittest.cc b/content/browser/renderer_host/input/input_router_impl_unittest.cc
index 6719ef1ed6464966e69d509bf222f403abeeab52..eb76c7b1414e7223d9bad8f4a6ee863a0c76616a 100644
--- a/content/browser/renderer_host/input/input_router_impl_unittest.cc
+++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
@@ -1189,19 +1189,22 @@ TEST_F(InputRouterImplTest, MouseTypesIgnoringAck) {
ASSERT_LT(start_type, end_type);
for (int i = start_type; i <= end_type; ++i) {
WebInputEvent::Type type = static_cast<WebInputEvent::Type>(i);
- int expected_in_flight_event_count =
- !ShouldBlockEventStream(GetEventWithType(type)) ? 0 : 1;
- // Note: Only MouseMove ack is forwarded to the ack handler.
SimulateMouseEvent(type, 0, 0);
EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
- EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount());
- EXPECT_EQ(expected_in_flight_event_count, client_->in_flight_event_count());
- if (expected_in_flight_event_count) {
+
+ if (ShouldBlockEventStream(GetEventWithType(type))) {
+ EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount());
+ EXPECT_EQ(1, client_->in_flight_event_count());
+
SendInputEventACK(type, INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
EXPECT_EQ(0U, GetSentMessageCountAndResetSink());
- uint32_t expected_ack_count = type == WebInputEvent::kMouseMove ? 1 : 0;
- EXPECT_EQ(expected_ack_count, ack_handler_->GetAndResetAckCount());
+ EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
+ EXPECT_EQ(0, client_->in_flight_event_count());
+ } else {
+ // Note: events which don't block the event stream immediately receive
+ // synthetic ACKs.
+ EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
EXPECT_EQ(0, client_->in_flight_event_count());
}
}

Powered by Google App Engine
This is Rietveld 408576698