| 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 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); | 958 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
| 959 | 959 |
| 960 | 960 |
| 961 // GesturePinchBegin ignores its ack. | 961 // GesturePinchBegin ignores its ack. |
| 962 SimulateGestureEvent(WebInputEvent::GesturePinchBegin, | 962 SimulateGestureEvent(WebInputEvent::GesturePinchBegin, |
| 963 WebGestureEvent::Touchscreen); | 963 WebGestureEvent::Touchscreen); |
| 964 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 964 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 965 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); | 965 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
| 966 | 966 |
| 967 // GesturePinchUpdate waits for an ack. | 967 // GesturePinchUpdate waits for an ack. |
| 968 // This also verifies that GesturePinchUpdates for touchscreen are sent |
| 969 // to the renderer (in contrast to the TrackpadPinchUpdate test). |
| 968 SimulateGestureEvent(WebInputEvent::GesturePinchUpdate, | 970 SimulateGestureEvent(WebInputEvent::GesturePinchUpdate, |
| 969 WebGestureEvent::Touchscreen); | 971 WebGestureEvent::Touchscreen); |
| 970 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 972 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 971 EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); | 973 EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); |
| 972 | 974 |
| 973 SimulateGestureEvent(WebInputEvent::GestureShowPress, | 975 SimulateGestureEvent(WebInputEvent::GestureShowPress, |
| 974 WebGestureEvent::Touchscreen); | 976 WebGestureEvent::Touchscreen); |
| 975 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); | 977 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 976 // The ShowPress, though it ignores ack, is still stuck in the queue | 978 // The ShowPress, though it ignores ack, is still stuck in the queue |
| 977 // behind the PinchUpdate which requires an ack. | 979 // behind the PinchUpdate which requires an ack. |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 // 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 |
| 1291 // 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. |
| 1292 SimulateGestureEvent(WebInputEvent::GestureDoubleTap, | 1294 SimulateGestureEvent(WebInputEvent::GestureDoubleTap, |
| 1293 WebGestureEvent::Touchscreen); | 1295 WebGestureEvent::Touchscreen); |
| 1294 // This test will become invalid if GestureDoubleTap stops requiring an ack. | 1296 // This test will become invalid if GestureDoubleTap stops requiring an ack. |
| 1295 DCHECK(!WebInputEventTraits::IgnoresAckDisposition( | 1297 DCHECK(!WebInputEventTraits::IgnoresAckDisposition( |
| 1296 WebInputEvent::GestureDoubleTap)); | 1298 WebInputEvent::GestureDoubleTap)); |
| 1297 EXPECT_EQ(0, client_->in_flight_event_count()); | 1299 EXPECT_EQ(0, client_->in_flight_event_count()); |
| 1298 } | 1300 } |
| 1299 | 1301 |
| 1302 // Test that GesturePinchUpdate is handled specially for trackpad |
| 1303 TEST_F(InputRouterImplTest, TrackpadPinchUpdate) { |
| 1304 // For now Trackpad PinchUpdate events are just immediately ACKed |
| 1305 // as unconsumed without going to the renderer. |
| 1306 // TODO(rbyers): Update for wheel event behavior - crbug.com/289887. |
| 1307 // Note that the Touchscreen case is verified as NOT doing this as |
| 1308 // part of the ShowPressIsInOrder test. |
| 1309 SimulateGestureEvent(WebInputEvent::GesturePinchUpdate, |
| 1310 WebGestureEvent::Touchpad); |
| 1311 ASSERT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 1312 EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
| 1313 EXPECT_EQ(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, ack_handler_->ack_state()); |
| 1314 EXPECT_EQ(0, client_->in_flight_event_count()); |
| 1315 } |
| 1316 |
| 1300 } // namespace content | 1317 } // namespace content |
| OLD | NEW |