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 <math.h> | 5 #include <math.h> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
985 EXPECT_FALSE(HasPendingEvents()); | 985 EXPECT_FALSE(HasPendingEvents()); |
986 SendInputEventACK(WebInputEvent::TouchCancel, | 986 SendInputEventACK(WebInputEvent::TouchCancel, |
987 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 987 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
988 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); | 988 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
989 EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); | 989 EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); |
990 EXPECT_FALSE(HasPendingEvents()); | 990 EXPECT_FALSE(HasPendingEvents()); |
991 } | 991 } |
992 | 992 |
993 TEST_F(InputRouterImplTest, GestureTypesIgnoringAck) { | 993 TEST_F(InputRouterImplTest, GestureTypesIgnoringAck) { |
994 // We test every gesture type, ensuring that the stream of gestures is valid. | 994 // We test every gesture type, ensuring that the stream of gestures is valid. |
995 const int kEventTypesLength = 29; | 995 const int kEventTypesLength = 28; |
996 WebInputEvent::Type eventTypes[kEventTypesLength] = { | 996 WebInputEvent::Type eventTypes[kEventTypesLength] = { |
jdduke (slow)
2014/11/26 19:26:03
Could we ditch the hard count and just use |eventT
majidvp
2014/11/27 15:47:55
Done.
| |
997 WebInputEvent::GestureTapDown, | 997 WebInputEvent::GestureTapDown, |
998 WebInputEvent::GestureShowPress, | 998 WebInputEvent::GestureShowPress, |
999 WebInputEvent::GestureTapCancel, | 999 WebInputEvent::GestureTapCancel, |
1000 WebInputEvent::GestureScrollBegin, | 1000 WebInputEvent::GestureScrollBegin, |
1001 WebInputEvent::GestureFlingStart, | 1001 WebInputEvent::GestureFlingStart, |
1002 WebInputEvent::GestureFlingCancel, | 1002 WebInputEvent::GestureFlingCancel, |
1003 WebInputEvent::GestureTapDown, | 1003 WebInputEvent::GestureTapDown, |
1004 WebInputEvent::GestureTap, | 1004 WebInputEvent::GestureTap, |
1005 WebInputEvent::GestureTapDown, | 1005 WebInputEvent::GestureTapDown, |
1006 WebInputEvent::GestureLongPress, | 1006 WebInputEvent::GestureLongPress, |
1007 WebInputEvent::GestureTapCancel, | 1007 WebInputEvent::GestureTapCancel, |
1008 WebInputEvent::GestureLongTap, | 1008 WebInputEvent::GestureLongTap, |
1009 WebInputEvent::GestureTapDown, | 1009 WebInputEvent::GestureTapDown, |
1010 WebInputEvent::GestureTapUnconfirmed, | 1010 WebInputEvent::GestureTapUnconfirmed, |
1011 WebInputEvent::GestureTapCancel, | 1011 WebInputEvent::GestureTapCancel, |
1012 WebInputEvent::GestureTapDown, | 1012 WebInputEvent::GestureTapDown, |
1013 WebInputEvent::GestureDoubleTap, | 1013 WebInputEvent::GestureDoubleTap, |
1014 WebInputEvent::GestureTapDown, | 1014 WebInputEvent::GestureTapDown, |
1015 WebInputEvent::GestureTapCancel, | 1015 WebInputEvent::GestureTapCancel, |
1016 WebInputEvent::GestureTwoFingerTap, | 1016 WebInputEvent::GestureTwoFingerTap, |
1017 WebInputEvent::GestureTapDown, | 1017 WebInputEvent::GestureTapDown, |
1018 WebInputEvent::GestureTapCancel, | 1018 WebInputEvent::GestureTapCancel, |
1019 WebInputEvent::GestureScrollBegin, | 1019 WebInputEvent::GestureScrollBegin, |
1020 WebInputEvent::GestureScrollUpdate, | 1020 WebInputEvent::GestureScrollUpdate, |
1021 WebInputEvent::GestureScrollUpdateWithoutPropagation, | |
1022 WebInputEvent::GesturePinchBegin, | 1021 WebInputEvent::GesturePinchBegin, |
1023 WebInputEvent::GesturePinchUpdate, | 1022 WebInputEvent::GesturePinchUpdate, |
1024 WebInputEvent::GesturePinchEnd, | 1023 WebInputEvent::GesturePinchEnd, |
1025 WebInputEvent::GestureScrollEnd}; | 1024 WebInputEvent::GestureScrollEnd}; |
1026 for (int i = 0; i < kEventTypesLength; ++i) { | 1025 for (int i = 0; i < kEventTypesLength; ++i) { |
1027 WebInputEvent::Type type = eventTypes[i]; | 1026 WebInputEvent::Type type = eventTypes[i]; |
1028 if (!WebInputEventTraits::IgnoresAckDisposition(GetEventWithType(type))) { | 1027 if (!WebInputEventTraits::IgnoresAckDisposition(GetEventWithType(type))) { |
1029 SimulateGestureEvent(type, blink::WebGestureDeviceTouchscreen); | 1028 SimulateGestureEvent(type, blink::WebGestureDeviceTouchscreen); |
1030 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); | 1029 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
1031 EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); | 1030 EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1901 client_overscroll = client_->GetAndResetOverscroll(); | 1900 client_overscroll = client_->GetAndResetOverscroll(); |
1902 EXPECT_EQ(wheel_overscroll.accumulated_overscroll, | 1901 EXPECT_EQ(wheel_overscroll.accumulated_overscroll, |
1903 client_overscroll.accumulated_overscroll); | 1902 client_overscroll.accumulated_overscroll); |
1904 EXPECT_EQ(wheel_overscroll.latest_overscroll_delta, | 1903 EXPECT_EQ(wheel_overscroll.latest_overscroll_delta, |
1905 client_overscroll.latest_overscroll_delta); | 1904 client_overscroll.latest_overscroll_delta); |
1906 EXPECT_EQ(wheel_overscroll.current_fling_velocity, | 1905 EXPECT_EQ(wheel_overscroll.current_fling_velocity, |
1907 client_overscroll.current_fling_velocity); | 1906 client_overscroll.current_fling_velocity); |
1908 } | 1907 } |
1909 | 1908 |
1910 } // namespace content | 1909 } // namespace content |
OLD | NEW |