OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 webGestureEvent.y = 5; | 1043 webGestureEvent.y = 5; |
1044 webGestureEvent.globalX = 10; | 1044 webGestureEvent.globalX = 10; |
1045 webGestureEvent.globalY = 15; | 1045 webGestureEvent.globalY = 15; |
1046 webGestureEvent.sourceDevice = WebGestureDeviceTouchpad; | 1046 webGestureEvent.sourceDevice = WebGestureDeviceTouchpad; |
1047 webGestureEvent.resendingPluginId = 2; | 1047 webGestureEvent.resendingPluginId = 2; |
1048 webGestureEvent.data.scrollBegin.inertialPhase = WebGestureEvent::Moment
umPhase; | 1048 webGestureEvent.data.scrollBegin.inertialPhase = WebGestureEvent::Moment
umPhase; |
1049 webGestureEvent.data.scrollBegin.synthetic = true; | 1049 webGestureEvent.data.scrollBegin.synthetic = true; |
1050 webGestureEvent.data.scrollBegin.deltaXHint = 100; | 1050 webGestureEvent.data.scrollBegin.deltaXHint = 100; |
1051 webGestureEvent.data.scrollBegin.deltaYHint = 10; | 1051 webGestureEvent.data.scrollBegin.deltaYHint = 10; |
1052 webGestureEvent.data.scrollBegin.deltaHintUnits = WebGestureEvent::Pixel
s; | 1052 webGestureEvent.data.scrollBegin.deltaHintUnits = WebGestureEvent::Pixel
s; |
| 1053 webGestureEvent.uniqueTouchEventId = 12345U; |
1053 | 1054 |
1054 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent
); | 1055 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent
); |
1055 EXPECT_EQ(PlatformGestureSourceTouchpad, platformGestureBuilder.source()
); | 1056 EXPECT_EQ(PlatformGestureSourceTouchpad, platformGestureBuilder.source()
); |
1056 EXPECT_EQ(2, platformGestureBuilder.resendingPluginId()); | 1057 EXPECT_EQ(2, platformGestureBuilder.resendingPluginId()); |
1057 EXPECT_EQ(0, platformGestureBuilder.position().x()); | 1058 EXPECT_EQ(0, platformGestureBuilder.position().x()); |
1058 EXPECT_EQ(5, platformGestureBuilder.position().y()); | 1059 EXPECT_EQ(5, platformGestureBuilder.position().y()); |
1059 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); | 1060 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); |
1060 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); | 1061 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); |
1061 EXPECT_EQ(ScrollInertialPhaseMomentum, platformGestureBuilder.inertialPh
ase()); | 1062 EXPECT_EQ(ScrollInertialPhaseMomentum, platformGestureBuilder.inertialPh
ase()); |
1062 EXPECT_TRUE(platformGestureBuilder.synthetic()); | 1063 EXPECT_TRUE(platformGestureBuilder.synthetic()); |
1063 EXPECT_EQ(100, platformGestureBuilder.deltaX()); | 1064 EXPECT_EQ(100, platformGestureBuilder.deltaX()); |
1064 EXPECT_EQ(10, platformGestureBuilder.deltaY()); | 1065 EXPECT_EQ(10, platformGestureBuilder.deltaY()); |
1065 EXPECT_EQ(ScrollGranularity::ScrollByPixel, platformGestureBuilder.delta
Units()); | 1066 EXPECT_EQ(ScrollGranularity::ScrollByPixel, platformGestureBuilder.delta
Units()); |
| 1067 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId()); |
1066 } | 1068 } |
1067 | 1069 |
1068 { | 1070 { |
1069 WebGestureEvent webGestureEvent; | 1071 WebGestureEvent webGestureEvent; |
1070 webGestureEvent.type = WebInputEvent::GestureScrollEnd; | 1072 webGestureEvent.type = WebInputEvent::GestureScrollEnd; |
1071 webGestureEvent.x = 0; | 1073 webGestureEvent.x = 0; |
1072 webGestureEvent.y = 5; | 1074 webGestureEvent.y = 5; |
1073 webGestureEvent.globalX = 10; | 1075 webGestureEvent.globalX = 10; |
1074 webGestureEvent.globalY = 15; | 1076 webGestureEvent.globalY = 15; |
1075 webGestureEvent.sourceDevice = WebGestureDeviceTouchpad; | 1077 webGestureEvent.sourceDevice = WebGestureDeviceTouchpad; |
1076 webGestureEvent.resendingPluginId = 2; | 1078 webGestureEvent.resendingPluginId = 2; |
1077 webGestureEvent.data.scrollEnd.inertialPhase = WebGestureEvent::NonMomen
tumPhase; | 1079 webGestureEvent.data.scrollEnd.inertialPhase = WebGestureEvent::NonMomen
tumPhase; |
1078 webGestureEvent.data.scrollEnd.synthetic = true; | 1080 webGestureEvent.data.scrollEnd.synthetic = true; |
1079 webGestureEvent.data.scrollEnd.deltaUnits = WebGestureEvent::Page; | 1081 webGestureEvent.data.scrollEnd.deltaUnits = WebGestureEvent::Page; |
| 1082 webGestureEvent.uniqueTouchEventId = 12345U; |
1080 | 1083 |
1081 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent
); | 1084 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent
); |
1082 EXPECT_EQ(PlatformGestureSourceTouchpad, platformGestureBuilder.source()
); | 1085 EXPECT_EQ(PlatformGestureSourceTouchpad, platformGestureBuilder.source()
); |
1083 EXPECT_EQ(2, platformGestureBuilder.resendingPluginId()); | 1086 EXPECT_EQ(2, platformGestureBuilder.resendingPluginId()); |
1084 EXPECT_EQ(0, platformGestureBuilder.position().x()); | 1087 EXPECT_EQ(0, platformGestureBuilder.position().x()); |
1085 EXPECT_EQ(5, platformGestureBuilder.position().y()); | 1088 EXPECT_EQ(5, platformGestureBuilder.position().y()); |
1086 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); | 1089 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); |
1087 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); | 1090 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); |
1088 EXPECT_EQ(ScrollInertialPhaseNonMomentum, platformGestureBuilder.inertia
lPhase()); | 1091 EXPECT_EQ(ScrollInertialPhaseNonMomentum, platformGestureBuilder.inertia
lPhase()); |
1089 EXPECT_TRUE(platformGestureBuilder.synthetic()); | 1092 EXPECT_TRUE(platformGestureBuilder.synthetic()); |
1090 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU
nits()); | 1093 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU
nits()); |
| 1094 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId()); |
1091 } | 1095 } |
1092 } | 1096 } |
1093 | 1097 |
1094 } // namespace blink | 1098 } // namespace blink |
OLD | NEW |