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

Side by Side Diff: content/browser/renderer_host/input/input_router_impl_unittest.cc

Issue 229373002: Revert of [Android] Provide unhandled tap event notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/browser/renderer_host/input/gesture_event_queue.h" 9 #include "content/browser/renderer_host/input/gesture_event_queue.h"
10 #include "content/browser/renderer_host/input/input_router_client.h" 10 #include "content/browser/renderer_host/input/input_router_client.h"
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 PressTouchPoint(1, 1); 1278 PressTouchPoint(1, 1);
1279 SendTouchEvent(); 1279 SendTouchEvent();
1280 1280
1281 // First tap. 1281 // First tap.
1282 EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); 1282 EXPECT_EQ(2U, GetSentMessageCountAndResetSink());
1283 SimulateGestureEvent(WebInputEvent::GestureTapDown, 1283 SimulateGestureEvent(WebInputEvent::GestureTapDown,
1284 WebGestureEvent::Touchscreen); 1284 WebGestureEvent::Touchscreen);
1285 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); 1285 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1286 1286
1287 // The GestureTapUnconfirmed is converted into a tap, as the touch action is 1287 // The GestureTapUnconfirmed is converted into a tap, as the touch action is
1288 // none. 1288 // auto.
1289 SimulateGestureEvent(WebInputEvent::GestureTapUnconfirmed, 1289 SimulateGestureEvent(WebInputEvent::GestureTapUnconfirmed,
1290 WebGestureEvent::Touchscreen); 1290 WebGestureEvent::Touchscreen);
1291 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1292 // This test will become invalid if GestureTap stops requiring an ack.
1293 ASSERT_TRUE(!WebInputEventTraits::IgnoresAckDisposition(
1294 WebInputEvent::GestureTap));
1295 EXPECT_EQ(2, client_->in_flight_event_count());
1296 SendInputEventACK(WebInputEvent::GestureTap, 1291 SendInputEventACK(WebInputEvent::GestureTap,
1297 INPUT_EVENT_ACK_STATE_CONSUMED); 1292 INPUT_EVENT_ACK_STATE_CONSUMED);
1298 EXPECT_EQ(1, client_->in_flight_event_count()); 1293 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1299 1294
1300 // This tap gesture is dropped, since the GestureTapUnconfirmed was turned 1295 // This tap gesture is dropped, since the GestureTapUnconfirmed was turned
1301 // into a tap. 1296 // into a tap.
1302 SimulateGestureEvent(WebInputEvent::GestureTap, WebGestureEvent::Touchscreen); 1297 SimulateGestureEvent(WebInputEvent::GestureTap, WebGestureEvent::Touchscreen);
1303 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); 1298 EXPECT_EQ(0U, GetSentMessageCountAndResetSink());
1304 1299
1305 SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED); 1300 SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED);
1306 SendInputEventACK(WebInputEvent::TouchStart, 1301 SendInputEventACK(WebInputEvent::TouchStart,
1307 INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); 1302 INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS);
1308 1303
1309 // Second Tap. 1304 // Second Tap.
1310 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); 1305 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1311 SimulateGestureEvent(WebInputEvent::GestureTapDown, 1306 SimulateGestureEvent(WebInputEvent::GestureTapDown,
1312 WebGestureEvent::Touchscreen); 1307 WebGestureEvent::Touchscreen);
1313 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); 1308 EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
1314 1309
1315 // Although the touch-action is now auto, the double tap still won't be 1310 // Although the touch-action is now auto, the double tap still won't be
1316 // dispatched, because the first tap occured when the touch-action was none. 1311 // dispatched, because the first tap occured when the touch-action was none.
1317 SimulateGestureEvent(WebInputEvent::GestureDoubleTap, 1312 SimulateGestureEvent(WebInputEvent::GestureDoubleTap,
1318 WebGestureEvent::Touchscreen); 1313 WebGestureEvent::Touchscreen);
1319 // This test will become invalid if GestureDoubleTap stops requiring an ack. 1314 // This test will become invalid if GestureDoubleTap stops requiring an ack.
1320 ASSERT_TRUE(!WebInputEventTraits::IgnoresAckDisposition( 1315 DCHECK(!WebInputEventTraits::IgnoresAckDisposition(
1321 WebInputEvent::GestureDoubleTap)); 1316 WebInputEvent::GestureDoubleTap));
1322 EXPECT_EQ(1, client_->in_flight_event_count());
1323 SendInputEventACK(WebInputEvent::GestureTap, INPUT_EVENT_ACK_STATE_CONSUMED);
1324 EXPECT_EQ(0, client_->in_flight_event_count()); 1317 EXPECT_EQ(0, client_->in_flight_event_count());
1325 } 1318 }
1326 1319
1327 // Test that the router will call the client's |DidFlush| after all events have 1320 // Test that the router will call the client's |DidFlush| after all events have
1328 // been dispatched following a call to |Flush|. 1321 // been dispatched following a call to |Flush|.
1329 TEST_F(InputRouterImplTest, InputFlush) { 1322 TEST_F(InputRouterImplTest, InputFlush) {
1330 EXPECT_FALSE(HasPendingEvents()); 1323 EXPECT_FALSE(HasPendingEvents());
1331 1324
1332 // Flushing an empty router should immediately trigger DidFlush. 1325 // Flushing an empty router should immediately trigger DidFlush.
1333 Flush(); 1326 Flush();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 1432
1440 // Ack the second scroll. 1433 // Ack the second scroll.
1441 SendInputEventACK(WebInputEvent::GestureScrollUpdate, 1434 SendInputEventACK(WebInputEvent::GestureScrollUpdate,
1442 INPUT_EVENT_ACK_STATE_CONSUMED); 1435 INPUT_EVENT_ACK_STATE_CONSUMED);
1443 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); 1436 EXPECT_EQ(0U, GetSentMessageCountAndResetSink());
1444 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); 1437 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
1445 EXPECT_EQ(0, client_->in_flight_event_count()); 1438 EXPECT_EQ(0, client_->in_flight_event_count());
1446 } 1439 }
1447 1440
1448 } // namespace content 1441 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698