OLD | NEW |
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 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 PressTouchPoint(1, 1); | 1260 PressTouchPoint(1, 1); |
1261 SendTouchEvent(); | 1261 SendTouchEvent(); |
1262 | 1262 |
1263 // First tap. | 1263 // First tap. |
1264 EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); | 1264 EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); |
1265 SimulateGestureEvent(WebInputEvent::GestureTapDown, | 1265 SimulateGestureEvent(WebInputEvent::GestureTapDown, |
1266 WebGestureEvent::Touchscreen); | 1266 WebGestureEvent::Touchscreen); |
1267 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 1267 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
1268 | 1268 |
1269 // The GestureTapUnconfirmed is converted into a tap, as the touch action is | 1269 // The GestureTapUnconfirmed is converted into a tap, as the touch action is |
1270 // none. | 1270 // auto. |
1271 SimulateGestureEvent(WebInputEvent::GestureTapUnconfirmed, | 1271 SimulateGestureEvent(WebInputEvent::GestureTapUnconfirmed, |
1272 WebGestureEvent::Touchscreen); | 1272 WebGestureEvent::Touchscreen); |
1273 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | |
1274 // This test will become invalid if GestureTap stops requiring an ack. | |
1275 ASSERT_TRUE(!WebInputEventTraits::IgnoresAckDisposition( | |
1276 WebInputEvent::GestureTap)); | |
1277 EXPECT_EQ(2, client_->in_flight_event_count()); | |
1278 SendInputEventACK(WebInputEvent::GestureTap, | 1273 SendInputEventACK(WebInputEvent::GestureTap, |
1279 INPUT_EVENT_ACK_STATE_CONSUMED); | 1274 INPUT_EVENT_ACK_STATE_CONSUMED); |
1280 EXPECT_EQ(1, client_->in_flight_event_count()); | 1275 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
1281 | 1276 |
1282 // This tap gesture is dropped, since the GestureTapUnconfirmed was turned | 1277 // This tap gesture is dropped, since the GestureTapUnconfirmed was turned |
1283 // into a tap. | 1278 // into a tap. |
1284 SimulateGestureEvent(WebInputEvent::GestureTap, WebGestureEvent::Touchscreen); | 1279 SimulateGestureEvent(WebInputEvent::GestureTap, WebGestureEvent::Touchscreen); |
1285 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); | 1280 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
1286 | 1281 |
1287 SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED); | 1282 SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED); |
1288 SendInputEventACK(WebInputEvent::TouchStart, | 1283 SendInputEventACK(WebInputEvent::TouchStart, |
1289 INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); | 1284 INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); |
1290 | 1285 |
1291 // Second Tap. | 1286 // Second Tap. |
1292 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 1287 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
1293 SimulateGestureEvent(WebInputEvent::GestureTapDown, | 1288 SimulateGestureEvent(WebInputEvent::GestureTapDown, |
1294 WebGestureEvent::Touchscreen); | 1289 WebGestureEvent::Touchscreen); |
1295 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 1290 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
1296 | 1291 |
1297 // Although the touch-action is now auto, the double tap still won't be | 1292 // Although the touch-action is now auto, the double tap still won't be |
1298 // dispatched, because the first tap occured when the touch-action was none. | 1293 // dispatched, because the first tap occured when the touch-action was none. |
1299 SimulateGestureEvent(WebInputEvent::GestureDoubleTap, | 1294 SimulateGestureEvent(WebInputEvent::GestureDoubleTap, |
1300 WebGestureEvent::Touchscreen); | 1295 WebGestureEvent::Touchscreen); |
1301 // This test will become invalid if GestureDoubleTap stops requiring an ack. | 1296 // This test will become invalid if GestureDoubleTap stops requiring an ack. |
1302 ASSERT_TRUE(!WebInputEventTraits::IgnoresAckDisposition( | 1297 DCHECK(!WebInputEventTraits::IgnoresAckDisposition( |
1303 WebInputEvent::GestureDoubleTap)); | 1298 WebInputEvent::GestureDoubleTap)); |
1304 EXPECT_EQ(1, client_->in_flight_event_count()); | |
1305 SendInputEventACK(WebInputEvent::GestureTap, INPUT_EVENT_ACK_STATE_CONSUMED); | |
1306 EXPECT_EQ(0, client_->in_flight_event_count()); | 1299 EXPECT_EQ(0, client_->in_flight_event_count()); |
1307 } | 1300 } |
1308 | 1301 |
1309 // Test that GesturePinchUpdate is handled specially for trackpad | 1302 // Test that GesturePinchUpdate is handled specially for trackpad |
1310 TEST_F(InputRouterImplTest, TrackpadPinchUpdate) { | 1303 TEST_F(InputRouterImplTest, TrackpadPinchUpdate) { |
1311 // For now Trackpad PinchUpdate events are just immediately ACKed | 1304 // For now Trackpad PinchUpdate events are just immediately ACKed |
1312 // as unconsumed without going to the renderer. | 1305 // as unconsumed without going to the renderer. |
1313 // TODO(rbyers): Update for wheel event behavior - crbug.com/289887. | 1306 // TODO(rbyers): Update for wheel event behavior - crbug.com/289887. |
1314 // Note that the Touchscreen case is verified as NOT doing this as | 1307 // Note that the Touchscreen case is verified as NOT doing this as |
1315 // part of the ShowPressIsInOrder test. | 1308 // part of the ShowPressIsInOrder test. |
1316 SimulateGestureEvent(WebInputEvent::GesturePinchUpdate, | 1309 SimulateGestureEvent(WebInputEvent::GesturePinchUpdate, |
1317 WebGestureEvent::Touchpad); | 1310 WebGestureEvent::Touchpad); |
1318 ASSERT_EQ(0U, GetSentMessageCountAndResetSink()); | 1311 ASSERT_EQ(0U, GetSentMessageCountAndResetSink()); |
1319 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); | 1312 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
1320 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, ack_handler_->ack_state()); | 1313 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, ack_handler_->ack_state()); |
1321 EXPECT_EQ(0, client_->in_flight_event_count()); | 1314 EXPECT_EQ(0, client_->in_flight_event_count()); |
1322 } | 1315 } |
1323 | 1316 |
1324 } // namespace content | 1317 } // namespace content |
OLD | NEW |