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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "core/page/Page.h" | 44 #include "core/page/Page.h" |
45 #include "platform/testing/URLTestHelpers.h" | 45 #include "platform/testing/URLTestHelpers.h" |
46 #include "public/web/WebFrame.h" | 46 #include "public/web/WebFrame.h" |
47 #include "public/web/WebSettings.h" | 47 #include "public/web/WebSettings.h" |
48 #include "testing/gtest/include/gtest/gtest.h" | 48 #include "testing/gtest/include/gtest/gtest.h" |
49 #include "web/WebViewImpl.h" | 49 #include "web/WebViewImpl.h" |
50 #include "web/tests/FrameTestHelpers.h" | 50 #include "web/tests/FrameTestHelpers.h" |
51 | 51 |
52 namespace blink { | 52 namespace blink { |
53 | 53 |
54 RawPtr<KeyboardEvent> createKeyboardEventWithLocation(KeyboardEvent::KeyLocation
Code location) | 54 KeyboardEvent* createKeyboardEventWithLocation(KeyboardEvent::KeyLocationCode lo
cation) |
55 { | 55 { |
56 return KeyboardEvent::create("keydown", true, true, 0, "", "", "", location,
PlatformEvent::NoModifiers, 0); | 56 return KeyboardEvent::create("keydown", true, true, 0, "", "", "", location,
PlatformEvent::NoModifiers, 0); |
57 } | 57 } |
58 | 58 |
59 int getModifiersForKeyLocationCode(KeyboardEvent::KeyLocationCode location) | 59 int getModifiersForKeyLocationCode(KeyboardEvent::KeyLocationCode location) |
60 { | 60 { |
61 RawPtr<KeyboardEvent> event = createKeyboardEventWithLocation(location); | 61 KeyboardEvent* event = createKeyboardEventWithLocation(location); |
62 WebKeyboardEventBuilder convertedEvent(*event); | 62 WebKeyboardEventBuilder convertedEvent(*event); |
63 return convertedEvent.modifiers; | 63 return convertedEvent.modifiers; |
64 } | 64 } |
65 | 65 |
66 TEST(WebInputEventConversionTest, WebKeyboardEventBuilder) | 66 TEST(WebInputEventConversionTest, WebKeyboardEventBuilder) |
67 { | 67 { |
68 // Test key location conversion. | 68 // Test key location conversion. |
69 int modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATI
ON_STANDARD); | 69 int modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATI
ON_STANDARD); |
70 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven
t::IsLeft || modifiers & WebInputEvent::IsRight); | 70 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven
t::IsLeft || modifiers & WebInputEvent::IsRight); |
71 | 71 |
72 modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_L
EFT); | 72 modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_L
EFT); |
73 EXPECT_TRUE(modifiers & WebInputEvent::IsLeft); | 73 EXPECT_TRUE(modifiers & WebInputEvent::IsLeft); |
74 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven
t::IsRight); | 74 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven
t::IsRight); |
75 | 75 |
76 modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_R
IGHT); | 76 modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_R
IGHT); |
77 EXPECT_TRUE(modifiers & WebInputEvent::IsRight); | 77 EXPECT_TRUE(modifiers & WebInputEvent::IsRight); |
78 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven
t::IsLeft); | 78 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven
t::IsLeft); |
79 | 79 |
80 modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_N
UMPAD); | 80 modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_N
UMPAD); |
81 EXPECT_TRUE(modifiers & WebInputEvent::IsKeyPad); | 81 EXPECT_TRUE(modifiers & WebInputEvent::IsKeyPad); |
82 EXPECT_FALSE(modifiers & WebInputEvent::IsLeft || modifiers & WebInputEvent:
:IsRight); | 82 EXPECT_FALSE(modifiers & WebInputEvent::IsLeft || modifiers & WebInputEvent:
:IsRight); |
83 } | 83 } |
84 | 84 |
85 TEST(WebInputEventConversionTest, WebMouseEventBuilder) | 85 TEST(WebInputEventConversionTest, WebMouseEventBuilder) |
86 { | 86 { |
87 RawPtr<TouchEvent> event = TouchEvent::create(); | 87 TouchEvent* event = TouchEvent::create(); |
88 WebMouseEventBuilder mouse(0, 0, *event); | 88 WebMouseEventBuilder mouse(0, 0, *event); |
89 EXPECT_EQ(WebInputEvent::Undefined, mouse.type); | 89 EXPECT_EQ(WebInputEvent::Undefined, mouse.type); |
90 } | 90 } |
91 | 91 |
92 TEST(WebInputEventConversionTest, WebTouchEventBuilder) | 92 TEST(WebInputEventConversionTest, WebTouchEventBuilder) |
93 { | 93 { |
94 const std::string baseURL("http://www.test0.com/"); | 94 const std::string baseURL("http://www.test0.com/"); |
95 const std::string fileName("fixed_layout.html"); | 95 const std::string fileName("fixed_layout.html"); |
96 | 96 |
97 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); | 97 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); |
98 FrameTestHelpers::WebViewHelper webViewHelper; | 98 FrameTestHelpers::WebViewHelper webViewHelper; |
99 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true); | 99 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true); |
100 int pageWidth = 640; | 100 int pageWidth = 640; |
101 int pageHeight = 480; | 101 int pageHeight = 480; |
102 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 102 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
103 webViewImpl->updateAllLifecyclePhases(); | 103 webViewImpl->updateAllLifecyclePhases(); |
104 | 104 |
105 RawPtr<Document> document = toLocalFrame(webViewImpl->page()->mainFrame())->
document(); | 105 Document* document = toLocalFrame(webViewImpl->page()->mainFrame())->documen
t(); |
106 LocalDOMWindow* domWindow = document->domWindow(); | 106 LocalDOMWindow* domWindow = document->domWindow(); |
107 LayoutView* documentLayoutView = document->layoutView(); | 107 LayoutView* documentLayoutView = document->layoutView(); |
108 | 108 |
109 WebTouchPoint p0, p1; | 109 WebTouchPoint p0, p1; |
110 p0.id = 1; | 110 p0.id = 1; |
111 p1.id = 2; | 111 p1.id = 2; |
112 p0.screenPosition = WebFloatPoint(100.f, 50.f); | 112 p0.screenPosition = WebFloatPoint(100.f, 50.f); |
113 p1.screenPosition = WebFloatPoint(150.f, 25.f); | 113 p1.screenPosition = WebFloatPoint(150.f, 25.f); |
114 p0.position = WebFloatPoint(10.f, 10.f); | 114 p0.position = WebFloatPoint(10.f, 10.f); |
115 p1.position = WebFloatPoint(5.f, 5.f); | 115 p1.position = WebFloatPoint(5.f, 5.f); |
116 p0.radiusX = p1.radiusY = 10.f; | 116 p0.radiusX = p1.radiusY = 10.f; |
117 p0.radiusY = p1.radiusX = 5.f; | 117 p0.radiusY = p1.radiusX = 5.f; |
118 p0.rotationAngle = p1.rotationAngle = 1.f; | 118 p0.rotationAngle = p1.rotationAngle = 1.f; |
119 p0.force = p1.force = 25.f; | 119 p0.force = p1.force = 25.f; |
120 | 120 |
121 RawPtr<Touch> touch0 = Touch::create(toLocalFrame(webViewImpl->page()->mainF
rame()), document.get(), p0.id, p0.screenPosition, p0.position, FloatSize(p0.rad
iusX, p0.radiusY), p0.rotationAngle, p0.force, String()); | 121 Touch* touch0 = Touch::create(toLocalFrame(webViewImpl->page()->mainFrame())
, document, p0.id, p0.screenPosition, p0.position, FloatSize(p0.radiusX, p0.radi
usY), p0.rotationAngle, p0.force, String()); |
122 RawPtr<Touch> touch1 = Touch::create(toLocalFrame(webViewImpl->page()->mainF
rame()), document.get(), p1.id, p1.screenPosition, p1.position, FloatSize(p1.rad
iusX, p1.radiusY), p1.rotationAngle, p1.force, String()); | 122 Touch* touch1 = Touch::create(toLocalFrame(webViewImpl->page()->mainFrame())
, document, p1.id, p1.screenPosition, p1.position, FloatSize(p1.radiusX, p1.radi
usY), p1.rotationAngle, p1.force, String()); |
123 | 123 |
124 // Test touchstart. | 124 // Test touchstart. |
125 { | 125 { |
126 RawPtr<TouchList> touchList = TouchList::create(); | 126 TouchList* touchList = TouchList::create(); |
127 touchList->append(touch0); | 127 touchList->append(touch0); |
128 RawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList.get(), touc
hList.get(), touchList.get(), EventTypeNames::touchstart, domWindow, PlatformEve
nt::NoModifiers, false, false, 0); | 128 TouchEvent* touchEvent = TouchEvent::create(touchList, touchList, touchL
ist, EventTypeNames::touchstart, domWindow, PlatformEvent::NoModifiers, false, f
alse, 0); |
129 | 129 |
130 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 130 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
131 ASSERT_EQ(1u, webTouchBuilder.touchesLength); | 131 ASSERT_EQ(1u, webTouchBuilder.touchesLength); |
132 EXPECT_EQ(WebInputEvent::TouchStart, webTouchBuilder.type); | 132 EXPECT_EQ(WebInputEvent::TouchStart, webTouchBuilder.type); |
133 EXPECT_EQ(WebTouchPoint::StatePressed, webTouchBuilder.touches[0].state)
; | 133 EXPECT_EQ(WebTouchPoint::StatePressed, webTouchBuilder.touches[0].state)
; |
134 EXPECT_FLOAT_EQ(p0.screenPosition.x, webTouchBuilder.touches[0].screenPo
sition.x); | 134 EXPECT_FLOAT_EQ(p0.screenPosition.x, webTouchBuilder.touches[0].screenPo
sition.x); |
135 EXPECT_FLOAT_EQ(p0.screenPosition.y, webTouchBuilder.touches[0].screenPo
sition.y); | 135 EXPECT_FLOAT_EQ(p0.screenPosition.y, webTouchBuilder.touches[0].screenPo
sition.y); |
136 EXPECT_FLOAT_EQ(p0.position.x, webTouchBuilder.touches[0].position.x); | 136 EXPECT_FLOAT_EQ(p0.position.x, webTouchBuilder.touches[0].position.x); |
137 EXPECT_FLOAT_EQ(p0.position.y, webTouchBuilder.touches[0].position.y); | 137 EXPECT_FLOAT_EQ(p0.position.y, webTouchBuilder.touches[0].position.y); |
138 EXPECT_FLOAT_EQ(p0.radiusX, webTouchBuilder.touches[0].radiusX); | 138 EXPECT_FLOAT_EQ(p0.radiusX, webTouchBuilder.touches[0].radiusX); |
139 EXPECT_FLOAT_EQ(p0.radiusY, webTouchBuilder.touches[0].radiusY); | 139 EXPECT_FLOAT_EQ(p0.radiusY, webTouchBuilder.touches[0].radiusY); |
140 EXPECT_FLOAT_EQ(p0.rotationAngle, webTouchBuilder.touches[0].rotationAng
le); | 140 EXPECT_FLOAT_EQ(p0.rotationAngle, webTouchBuilder.touches[0].rotationAng
le); |
141 EXPECT_FLOAT_EQ(p0.force, webTouchBuilder.touches[0].force); | 141 EXPECT_FLOAT_EQ(p0.force, webTouchBuilder.touches[0].force); |
142 } | 142 } |
143 | 143 |
144 // Test touchmove. | 144 // Test touchmove. |
145 { | 145 { |
146 RawPtr<TouchList> activeTouchList = TouchList::create(); | 146 TouchList* activeTouchList = TouchList::create(); |
147 RawPtr<TouchList> movedTouchList = TouchList::create(); | 147 TouchList* movedTouchList = TouchList::create(); |
148 activeTouchList->append(touch0); | 148 activeTouchList->append(touch0); |
149 activeTouchList->append(touch1); | 149 activeTouchList->append(touch1); |
150 movedTouchList->append(touch0); | 150 movedTouchList->append(touch0); |
151 RawPtr<TouchEvent> touchEvent = TouchEvent::create(activeTouchList.get()
, activeTouchList.get(), movedTouchList.get(), EventTypeNames::touchmove, domWin
dow, PlatformEvent::NoModifiers, false, false, 0); | 151 TouchEvent* touchEvent = TouchEvent::create(activeTouchList, activeTouch
List, movedTouchList, EventTypeNames::touchmove, domWindow, PlatformEvent::NoMod
ifiers, false, false, 0); |
152 | 152 |
153 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 153 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
154 ASSERT_EQ(2u, webTouchBuilder.touchesLength); | 154 ASSERT_EQ(2u, webTouchBuilder.touchesLength); |
155 EXPECT_EQ(WebInputEvent::TouchMove, webTouchBuilder.type); | 155 EXPECT_EQ(WebInputEvent::TouchMove, webTouchBuilder.type); |
156 EXPECT_EQ(WebTouchPoint::StateMoved, webTouchBuilder.touches[0].state); | 156 EXPECT_EQ(WebTouchPoint::StateMoved, webTouchBuilder.touches[0].state); |
157 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[1].sta
te); | 157 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[1].sta
te); |
158 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); | 158 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); |
159 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); | 159 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); |
160 } | 160 } |
161 | 161 |
162 // Test touchmove, different point yields same ordering. | 162 // Test touchmove, different point yields same ordering. |
163 { | 163 { |
164 RawPtr<TouchList> activeTouchList = TouchList::create(); | 164 TouchList* activeTouchList = TouchList::create(); |
165 RawPtr<TouchList> movedTouchList = TouchList::create(); | 165 TouchList* movedTouchList = TouchList::create(); |
166 activeTouchList->append(touch0); | 166 activeTouchList->append(touch0); |
167 activeTouchList->append(touch1); | 167 activeTouchList->append(touch1); |
168 movedTouchList->append(touch1); | 168 movedTouchList->append(touch1); |
169 RawPtr<TouchEvent> touchEvent = TouchEvent::create(activeTouchList.get()
, activeTouchList.get(), movedTouchList.get(), EventTypeNames::touchmove, domWin
dow, PlatformEvent::NoModifiers, false, false, 0); | 169 TouchEvent* touchEvent = TouchEvent::create(activeTouchList, activeTouch
List, movedTouchList, EventTypeNames::touchmove, domWindow, PlatformEvent::NoMod
ifiers, false, false, 0); |
170 | 170 |
171 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 171 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
172 ASSERT_EQ(2u, webTouchBuilder.touchesLength); | 172 ASSERT_EQ(2u, webTouchBuilder.touchesLength); |
173 EXPECT_EQ(WebInputEvent::TouchMove, webTouchBuilder.type); | 173 EXPECT_EQ(WebInputEvent::TouchMove, webTouchBuilder.type); |
174 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[0].sta
te); | 174 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[0].sta
te); |
175 EXPECT_EQ(WebTouchPoint::StateMoved, webTouchBuilder.touches[1].state); | 175 EXPECT_EQ(WebTouchPoint::StateMoved, webTouchBuilder.touches[1].state); |
176 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); | 176 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); |
177 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); | 177 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); |
178 } | 178 } |
179 | 179 |
180 // Test touchend. | 180 // Test touchend. |
181 { | 181 { |
182 RawPtr<TouchList> activeTouchList = TouchList::create(); | 182 TouchList* activeTouchList = TouchList::create(); |
183 RawPtr<TouchList> releasedTouchList = TouchList::create(); | 183 TouchList* releasedTouchList = TouchList::create(); |
184 activeTouchList->append(touch0); | 184 activeTouchList->append(touch0); |
185 releasedTouchList->append(touch1); | 185 releasedTouchList->append(touch1); |
186 RawPtr<TouchEvent> touchEvent = TouchEvent::create(activeTouchList.get()
, activeTouchList.get(), releasedTouchList.get(), EventTypeNames::touchend, domW
indow, PlatformEvent::NoModifiers, false, false, 0); | 186 TouchEvent* touchEvent = TouchEvent::create(activeTouchList, activeTouch
List, releasedTouchList, EventTypeNames::touchend, domWindow, PlatformEvent::NoM
odifiers, false, false, 0); |
187 | 187 |
188 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 188 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
189 ASSERT_EQ(2u, webTouchBuilder.touchesLength); | 189 ASSERT_EQ(2u, webTouchBuilder.touchesLength); |
190 EXPECT_EQ(WebInputEvent::TouchEnd, webTouchBuilder.type); | 190 EXPECT_EQ(WebInputEvent::TouchEnd, webTouchBuilder.type); |
191 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[0].sta
te); | 191 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[0].sta
te); |
192 EXPECT_EQ(WebTouchPoint::StateReleased, webTouchBuilder.touches[1].state
); | 192 EXPECT_EQ(WebTouchPoint::StateReleased, webTouchBuilder.touches[1].state
); |
193 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); | 193 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); |
194 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); | 194 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); |
195 } | 195 } |
196 | 196 |
197 // Test touchcancel. | 197 // Test touchcancel. |
198 { | 198 { |
199 RawPtr<TouchList> activeTouchList = TouchList::create(); | 199 TouchList* activeTouchList = TouchList::create(); |
200 RawPtr<TouchList> cancelledTouchList = TouchList::create(); | 200 TouchList* cancelledTouchList = TouchList::create(); |
201 cancelledTouchList->append(touch0); | 201 cancelledTouchList->append(touch0); |
202 cancelledTouchList->append(touch1); | 202 cancelledTouchList->append(touch1); |
203 RawPtr<TouchEvent> touchEvent = TouchEvent::create(activeTouchList.get()
, activeTouchList.get(), cancelledTouchList.get(), EventTypeNames::touchcancel,
domWindow, PlatformEvent::NoModifiers, false, false, 0); | 203 TouchEvent* touchEvent = TouchEvent::create(activeTouchList, activeTouch
List, cancelledTouchList, EventTypeNames::touchcancel, domWindow, PlatformEvent:
:NoModifiers, false, false, 0); |
204 | 204 |
205 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 205 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
206 ASSERT_EQ(2u, webTouchBuilder.touchesLength); | 206 ASSERT_EQ(2u, webTouchBuilder.touchesLength); |
207 EXPECT_EQ(WebInputEvent::TouchCancel, webTouchBuilder.type); | 207 EXPECT_EQ(WebInputEvent::TouchCancel, webTouchBuilder.type); |
208 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[0].stat
e); | 208 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[0].stat
e); |
209 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[1].stat
e); | 209 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[1].stat
e); |
210 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); | 210 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); |
211 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); | 211 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); |
212 } | 212 } |
213 | 213 |
214 // Test max point limit. | 214 // Test max point limit. |
215 { | 215 { |
216 RawPtr<TouchList> touchList = TouchList::create(); | 216 TouchList* touchList = TouchList::create(); |
217 RawPtr<TouchList> changedTouchList = TouchList::create(); | 217 TouchList* changedTouchList = TouchList::create(); |
218 for (int i = 0; i <= static_cast<int>(WebTouchEvent::touchesLengthCap) *
2; ++i) { | 218 for (int i = 0; i <= static_cast<int>(WebTouchEvent::touchesLengthCap) *
2; ++i) { |
219 RawPtr<Touch> touch = Touch::create(toLocalFrame(webViewImpl->page()
->mainFrame()), document.get(), i, p0.screenPosition, p0.position, FloatSize(p0.
radiusX, p0.radiusY), p0.rotationAngle, p0.force, String()); | 219 Touch* touch = Touch::create(toLocalFrame(webViewImpl->page()->mainF
rame()), document, i, p0.screenPosition, p0.position, FloatSize(p0.radiusX, p0.r
adiusY), p0.rotationAngle, p0.force, String()); |
220 touchList->append(touch); | 220 touchList->append(touch); |
221 changedTouchList->append(touch); | 221 changedTouchList->append(touch); |
222 } | 222 } |
223 RawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList.get(), touc
hList.get(), touchList.get(), EventTypeNames::touchstart, domWindow, PlatformEve
nt::NoModifiers, false, false, 0); | 223 TouchEvent* touchEvent = TouchEvent::create(touchList, touchList, touchL
ist, EventTypeNames::touchstart, domWindow, PlatformEvent::NoModifiers, false, f
alse, 0); |
224 | 224 |
225 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 225 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
226 ASSERT_EQ(static_cast<unsigned>(WebTouchEvent::touchesLengthCap), webTou
chBuilder.touchesLength); | 226 ASSERT_EQ(static_cast<unsigned>(WebTouchEvent::touchesLengthCap), webTou
chBuilder.touchesLength); |
227 } | 227 } |
228 } | 228 } |
229 | 229 |
230 TEST(WebInputEventConversionTest, InputEventsScaling) | 230 TEST(WebInputEventConversionTest, InputEventsScaling) |
231 { | 231 { |
232 const std::string baseURL("http://www.test1.com/"); | 232 const std::string baseURL("http://www.test1.com/"); |
233 const std::string fileName("fixed_layout.html"); | 233 const std::string fileName("fixed_layout.html"); |
234 | 234 |
235 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); | 235 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); |
236 FrameTestHelpers::WebViewHelper webViewHelper; | 236 FrameTestHelpers::WebViewHelper webViewHelper; |
237 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true); | 237 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true); |
238 webViewImpl->settings()->setViewportEnabled(true); | 238 webViewImpl->settings()->setViewportEnabled(true); |
239 int pageWidth = 640; | 239 int pageWidth = 640; |
240 int pageHeight = 480; | 240 int pageHeight = 480; |
241 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 241 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
242 webViewImpl->updateAllLifecyclePhases(); | 242 webViewImpl->updateAllLifecyclePhases(); |
243 | 243 |
244 webViewImpl->setPageScaleFactor(2); | 244 webViewImpl->setPageScaleFactor(2); |
245 | 245 |
246 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 246 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
247 RawPtr<Document> document = toLocalFrame(webViewImpl->page()->mainFrame())->
document(); | 247 Document* document = toLocalFrame(webViewImpl->page()->mainFrame())->documen
t(); |
248 LocalDOMWindow* domWindow = document->domWindow(); | 248 LocalDOMWindow* domWindow = document->domWindow(); |
249 LayoutView* documentLayoutView = document->layoutView(); | 249 LayoutView* documentLayoutView = document->layoutView(); |
250 | 250 |
251 { | 251 { |
252 WebMouseEvent webMouseEvent; | 252 WebMouseEvent webMouseEvent; |
253 webMouseEvent.type = WebInputEvent::MouseMove; | 253 webMouseEvent.type = WebInputEvent::MouseMove; |
254 webMouseEvent.x = 10; | 254 webMouseEvent.x = 10; |
255 webMouseEvent.y = 10; | 255 webMouseEvent.y = 10; |
256 webMouseEvent.windowX = 10; | 256 webMouseEvent.windowX = 10; |
257 webMouseEvent.windowY = 10; | 257 webMouseEvent.windowY = 10; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 EXPECT_FLOAT_EQ(5.3f, platformTouchBuilder.touchPoints()[0].pos().x()); | 413 EXPECT_FLOAT_EQ(5.3f, platformTouchBuilder.touchPoints()[0].pos().x()); |
414 EXPECT_FLOAT_EQ(5.2f, platformTouchBuilder.touchPoints()[0].pos().y()); | 414 EXPECT_FLOAT_EQ(5.2f, platformTouchBuilder.touchPoints()[0].pos().y()); |
415 EXPECT_FLOAT_EQ(5.3f, platformTouchBuilder.touchPoints()[0].radius().wid
th()); | 415 EXPECT_FLOAT_EQ(5.3f, platformTouchBuilder.touchPoints()[0].radius().wid
th()); |
416 EXPECT_FLOAT_EQ(5.2f, platformTouchBuilder.touchPoints()[0].radius().hei
ght()); | 416 EXPECT_FLOAT_EQ(5.2f, platformTouchBuilder.touchPoints()[0].radius().hei
ght()); |
417 } | 417 } |
418 | 418 |
419 // Reverse builders should *not* go back to physical pixels, as they are use
d for plugins | 419 // Reverse builders should *not* go back to physical pixels, as they are use
d for plugins |
420 // which expect CSS pixel coordinates. | 420 // which expect CSS pixel coordinates. |
421 { | 421 { |
422 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, LeftButton, PlatformEvent::MouseMoved, 1, PlatformEvent::NoModifiers, Platform
MouseEvent::RealOrIndistinguishable, 0); | 422 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, LeftButton, PlatformEvent::MouseMoved, 1, PlatformEvent::NoModifiers, Platform
MouseEvent::RealOrIndistinguishable, 0); |
423 RawPtr<MouseEvent> mouseEvent = MouseEvent::create(EventTypeNames::mouse
move, domWindow, platformMouseEvent, 0, document); | 423 MouseEvent* mouseEvent = MouseEvent::create(EventTypeNames::mousemove, d
omWindow, platformMouseEvent, 0, document); |
424 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve
nt); | 424 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve
nt); |
425 | 425 |
426 EXPECT_EQ(10, webMouseBuilder.x); | 426 EXPECT_EQ(10, webMouseBuilder.x); |
427 EXPECT_EQ(10, webMouseBuilder.y); | 427 EXPECT_EQ(10, webMouseBuilder.y); |
428 EXPECT_EQ(10, webMouseBuilder.globalX); | 428 EXPECT_EQ(10, webMouseBuilder.globalX); |
429 EXPECT_EQ(10, webMouseBuilder.globalY); | 429 EXPECT_EQ(10, webMouseBuilder.globalY); |
430 EXPECT_EQ(10, webMouseBuilder.windowX); | 430 EXPECT_EQ(10, webMouseBuilder.windowX); |
431 EXPECT_EQ(10, webMouseBuilder.windowY); | 431 EXPECT_EQ(10, webMouseBuilder.windowY); |
432 } | 432 } |
433 | 433 |
434 { | 434 { |
435 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, NoButton, PlatformEvent::MouseMoved, 1, PlatformEvent::NoModifiers, PlatformMo
useEvent::RealOrIndistinguishable, 0); | 435 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, NoButton, PlatformEvent::MouseMoved, 1, PlatformEvent::NoModifiers, PlatformMo
useEvent::RealOrIndistinguishable, 0); |
436 RawPtr<MouseEvent> mouseEvent = MouseEvent::create(EventTypeNames::mouse
move, domWindow, platformMouseEvent, 0, document); | 436 MouseEvent* mouseEvent = MouseEvent::create(EventTypeNames::mousemove, d
omWindow, platformMouseEvent, 0, document); |
437 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve
nt); | 437 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve
nt); |
438 EXPECT_EQ(WebMouseEvent::ButtonNone, webMouseBuilder.button); | 438 EXPECT_EQ(WebMouseEvent::ButtonNone, webMouseBuilder.button); |
439 } | 439 } |
440 | 440 |
441 { | 441 { |
442 PlatformGestureEvent platformGestureEvent(PlatformEvent::GestureScrollUp
date, IntPoint(10, 12), IntPoint(20, 22), IntSize(25, 27), 0, | 442 PlatformGestureEvent platformGestureEvent(PlatformEvent::GestureScrollUp
date, IntPoint(10, 12), IntPoint(20, 22), IntSize(25, 27), 0, |
443 PlatformEvent::NoModifiers, PlatformGestureSourceTouchscreen); | 443 PlatformEvent::NoModifiers, PlatformGestureSourceTouchscreen); |
444 platformGestureEvent.setScrollGestureData(30, 32, ScrollByPrecisePixel,
40, 42, true, true, -1 /* null plugin id */); | 444 platformGestureEvent.setScrollGestureData(30, 32, ScrollByPrecisePixel,
40, 42, true, true, -1 /* null plugin id */); |
445 // FIXME: GestureEvent does not preserve velocityX, velocityY, | 445 // FIXME: GestureEvent does not preserve velocityX, velocityY, |
446 // or preventPropagation. It also fails to scale | 446 // or preventPropagation. It also fails to scale |
447 // coordinates (x, y, deltaX, deltaY) to the page scale. This | 447 // coordinates (x, y, deltaX, deltaY) to the page scale. This |
448 // may lead to unexpected bugs if a PlatformGestureEvent is | 448 // may lead to unexpected bugs if a PlatformGestureEvent is |
449 // transformed into WebGestureEvent and back. | 449 // transformed into WebGestureEvent and back. |
450 RawPtr<GestureEvent> gestureEvent = GestureEvent::create(domWindow, plat
formGestureEvent); | 450 GestureEvent* gestureEvent = GestureEvent::create(domWindow, platformGes
tureEvent); |
451 WebGestureEventBuilder webGestureBuilder(documentLayoutView, *gestureEve
nt); | 451 WebGestureEventBuilder webGestureBuilder(documentLayoutView, *gestureEve
nt); |
452 | 452 |
453 EXPECT_EQ(10, webGestureBuilder.x); | 453 EXPECT_EQ(10, webGestureBuilder.x); |
454 EXPECT_EQ(12, webGestureBuilder.y); | 454 EXPECT_EQ(12, webGestureBuilder.y); |
455 EXPECT_EQ(20, webGestureBuilder.globalX); | 455 EXPECT_EQ(20, webGestureBuilder.globalX); |
456 EXPECT_EQ(22, webGestureBuilder.globalY); | 456 EXPECT_EQ(22, webGestureBuilder.globalY); |
457 EXPECT_EQ(30, webGestureBuilder.data.scrollUpdate.deltaX); | 457 EXPECT_EQ(30, webGestureBuilder.data.scrollUpdate.deltaX); |
458 EXPECT_EQ(32, webGestureBuilder.data.scrollUpdate.deltaY); | 458 EXPECT_EQ(32, webGestureBuilder.data.scrollUpdate.deltaY); |
459 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityX); | 459 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityX); |
460 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityY); | 460 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityY); |
461 EXPECT_TRUE(webGestureBuilder.data.scrollUpdate.inertial); | 461 EXPECT_TRUE(webGestureBuilder.data.scrollUpdate.inertial); |
462 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.preventPropagation); | 462 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.preventPropagation); |
463 EXPECT_EQ(WebGestureDeviceTouchscreen, webGestureBuilder.sourceDevice); | 463 EXPECT_EQ(WebGestureDeviceTouchscreen, webGestureBuilder.sourceDevice); |
464 } | 464 } |
465 | 465 |
466 { | 466 { |
467 RawPtr<Touch> touch = Touch::create(toLocalFrame(webViewImpl->page()->ma
inFrame()), document.get(), 0, FloatPoint(10, 9.5), FloatPoint(3.5, 2), FloatSiz
e(4, 4.5), 0, 0, String()); | 467 Touch* touch = Touch::create(toLocalFrame(webViewImpl->page()->mainFrame
()), document, 0, FloatPoint(10, 9.5), FloatPoint(3.5, 2), FloatSize(4, 4.5), 0,
0, String()); |
468 RawPtr<TouchList> touchList = TouchList::create(); | 468 TouchList* touchList = TouchList::create(); |
469 touchList->append(touch); | 469 touchList->append(touch); |
470 RawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList.get(), touc
hList.get(), touchList.get(), EventTypeNames::touchmove, domWindow, PlatformEven
t::NoModifiers, false, false, 0); | 470 TouchEvent* touchEvent = TouchEvent::create(touchList, touchList, touchL
ist, EventTypeNames::touchmove, domWindow, PlatformEvent::NoModifiers, false, fa
lse, 0); |
471 | 471 |
472 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); | 472 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); |
473 ASSERT_EQ(1u, webTouchBuilder.touchesLength); | 473 ASSERT_EQ(1u, webTouchBuilder.touchesLength); |
474 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); | 474 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); |
475 EXPECT_FLOAT_EQ(9.5, webTouchBuilder.touches[0].screenPosition.y); | 475 EXPECT_FLOAT_EQ(9.5, webTouchBuilder.touches[0].screenPosition.y); |
476 EXPECT_FLOAT_EQ(3.5, webTouchBuilder.touches[0].position.x); | 476 EXPECT_FLOAT_EQ(3.5, webTouchBuilder.touches[0].position.x); |
477 EXPECT_FLOAT_EQ(2, webTouchBuilder.touches[0].position.y); | 477 EXPECT_FLOAT_EQ(2, webTouchBuilder.touches[0].position.y); |
478 EXPECT_FLOAT_EQ(4, webTouchBuilder.touches[0].radiusX); | 478 EXPECT_FLOAT_EQ(4, webTouchBuilder.touches[0].radiusX); |
479 EXPECT_FLOAT_EQ(4.5, webTouchBuilder.touches[0].radiusY); | 479 EXPECT_FLOAT_EQ(4.5, webTouchBuilder.touches[0].radiusY); |
480 EXPECT_FALSE(webTouchBuilder.cancelable); | 480 EXPECT_FALSE(webTouchBuilder.cancelable); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 | 642 |
643 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); | 643 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); |
644 FrameTestHelpers::WebViewHelper webViewHelper; | 644 FrameTestHelpers::WebViewHelper webViewHelper; |
645 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true); | 645 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true); |
646 int pageWidth = 640; | 646 int pageWidth = 640; |
647 int pageHeight = 480; | 647 int pageHeight = 480; |
648 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 648 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
649 webViewImpl->updateAllLifecyclePhases(); | 649 webViewImpl->updateAllLifecyclePhases(); |
650 | 650 |
651 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); | 651 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
652 RawPtr<Document> document = toLocalFrame(webViewImpl->page()->mainFrame())->
document(); | 652 Document* document = toLocalFrame(webViewImpl->page()->mainFrame())->documen
t(); |
653 LocalDOMWindow* domWindow = document->domWindow(); | 653 LocalDOMWindow* domWindow = document->domWindow(); |
654 LayoutView* documentLayoutView = document->layoutView(); | 654 LayoutView* documentLayoutView = document->layoutView(); |
655 | 655 |
656 { | 656 { |
657 WebGestureEvent webGestureEvent; | 657 WebGestureEvent webGestureEvent; |
658 webGestureEvent.type = WebInputEvent::GestureTap; | 658 webGestureEvent.type = WebInputEvent::GestureTap; |
659 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 659 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
660 webGestureEvent.x = 10; | 660 webGestureEvent.x = 10; |
661 webGestureEvent.y = 10; | 661 webGestureEvent.y = 10; |
662 webGestureEvent.globalX = 10; | 662 webGestureEvent.globalX = 10; |
663 webGestureEvent.globalY = 10; | 663 webGestureEvent.globalY = 10; |
664 webGestureEvent.data.tap.tapCount = 1; | 664 webGestureEvent.data.tap.tapCount = 1; |
665 webGestureEvent.data.tap.width = 10; | 665 webGestureEvent.data.tap.width = 10; |
666 webGestureEvent.data.tap.height = 10; | 666 webGestureEvent.data.tap.height = 10; |
667 | 667 |
668 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent
); | 668 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent
); |
669 EXPECT_EQ(10.f, platformGestureBuilder.position().x()); | 669 EXPECT_EQ(10.f, platformGestureBuilder.position().x()); |
670 EXPECT_EQ(10.f, platformGestureBuilder.position().y()); | 670 EXPECT_EQ(10.f, platformGestureBuilder.position().y()); |
671 EXPECT_EQ(10.f, platformGestureBuilder.globalPosition().x()); | 671 EXPECT_EQ(10.f, platformGestureBuilder.globalPosition().x()); |
672 EXPECT_EQ(10.f, platformGestureBuilder.globalPosition().y()); | 672 EXPECT_EQ(10.f, platformGestureBuilder.globalPosition().y()); |
673 EXPECT_EQ(1, platformGestureBuilder.tapCount()); | 673 EXPECT_EQ(1, platformGestureBuilder.tapCount()); |
674 | 674 |
675 RawPtr<GestureEvent> coreGestureEvent = GestureEvent::create(domWindow,
platformGestureBuilder); | 675 GestureEvent* coreGestureEvent = GestureEvent::create(domWindow, platfor
mGestureBuilder); |
676 WebGestureEventBuilder recreatedWebGestureEvent(documentLayoutView, *cor
eGestureEvent); | 676 WebGestureEventBuilder recreatedWebGestureEvent(documentLayoutView, *cor
eGestureEvent); |
677 EXPECT_EQ(webGestureEvent.type, recreatedWebGestureEvent.type); | 677 EXPECT_EQ(webGestureEvent.type, recreatedWebGestureEvent.type); |
678 EXPECT_EQ(webGestureEvent.x, recreatedWebGestureEvent.x); | 678 EXPECT_EQ(webGestureEvent.x, recreatedWebGestureEvent.x); |
679 EXPECT_EQ(webGestureEvent.y, recreatedWebGestureEvent.y); | 679 EXPECT_EQ(webGestureEvent.y, recreatedWebGestureEvent.y); |
680 EXPECT_EQ(webGestureEvent.globalX, recreatedWebGestureEvent.globalX); | 680 EXPECT_EQ(webGestureEvent.globalX, recreatedWebGestureEvent.globalX); |
681 EXPECT_EQ(webGestureEvent.globalY, recreatedWebGestureEvent.globalY); | 681 EXPECT_EQ(webGestureEvent.globalY, recreatedWebGestureEvent.globalY); |
682 EXPECT_EQ(webGestureEvent.data.tap.tapCount, recreatedWebGestureEvent.da
ta.tap.tapCount); | 682 EXPECT_EQ(webGestureEvent.data.tap.tapCount, recreatedWebGestureEvent.da
ta.tap.tapCount); |
683 } | 683 } |
684 } | 684 } |
685 | 685 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 const std::string fileName("fixed_layout.html"); | 881 const std::string fileName("fixed_layout.html"); |
882 | 882 |
883 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); | 883 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); |
884 FrameTestHelpers::WebViewHelper webViewHelper; | 884 FrameTestHelpers::WebViewHelper webViewHelper; |
885 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true); | 885 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true); |
886 int pageWidth = 640; | 886 int pageWidth = 640; |
887 int pageHeight = 480; | 887 int pageHeight = 480; |
888 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 888 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
889 webViewImpl->updateAllLifecyclePhases(); | 889 webViewImpl->updateAllLifecyclePhases(); |
890 | 890 |
891 RawPtr<Document> document = toLocalFrame(webViewImpl->page()->mainFrame())->
document(); | 891 Document* document = toLocalFrame(webViewImpl->page()->mainFrame())->documen
t(); |
892 RawPtr<WheelEvent> event = WheelEvent::create(FloatPoint(1, 3), FloatPoint(5
, 10), | 892 WheelEvent* event = WheelEvent::create(FloatPoint(1, 3), FloatPoint(5, 10), |
893 WheelEvent::DOM_DELTA_PAGE, document.get()->domWindow(), IntPoint(2, 6),
IntPoint(10, 30), | 893 WheelEvent::DOM_DELTA_PAGE, document->domWindow(), IntPoint(2, 6), IntPo
int(10, 30), |
894 PlatformEvent::CtrlKey, 0, 0, true, -1 /* null plugin id */, true /* has
PreciseScrollingDeltas */, Event::RailsModeHorizontal); | 894 PlatformEvent::CtrlKey, 0, 0, true, -1 /* null plugin id */, true /* has
PreciseScrollingDeltas */, Event::RailsModeHorizontal); |
895 WebMouseWheelEventBuilder webMouseWheel(toLocalFrame(webViewImpl->page()->ma
inFrame())->view(), document.get()->layoutView(), *event); | 895 WebMouseWheelEventBuilder webMouseWheel(toLocalFrame(webViewImpl->page()->ma
inFrame())->view(), document->layoutView(), *event); |
896 EXPECT_EQ(1, webMouseWheel.wheelTicksX); | 896 EXPECT_EQ(1, webMouseWheel.wheelTicksX); |
897 EXPECT_EQ(3, webMouseWheel.wheelTicksY); | 897 EXPECT_EQ(3, webMouseWheel.wheelTicksY); |
898 EXPECT_EQ(5, webMouseWheel.deltaX); | 898 EXPECT_EQ(5, webMouseWheel.deltaX); |
899 EXPECT_EQ(10, webMouseWheel.deltaY); | 899 EXPECT_EQ(10, webMouseWheel.deltaY); |
900 EXPECT_EQ(2, webMouseWheel.globalX); | 900 EXPECT_EQ(2, webMouseWheel.globalX); |
901 EXPECT_EQ(6, webMouseWheel.globalY); | 901 EXPECT_EQ(6, webMouseWheel.globalY); |
902 EXPECT_EQ(10, webMouseWheel.windowX); | 902 EXPECT_EQ(10, webMouseWheel.windowX); |
903 EXPECT_EQ(30, webMouseWheel.windowY); | 903 EXPECT_EQ(30, webMouseWheel.windowY); |
904 EXPECT_TRUE(webMouseWheel.scrollByPage); | 904 EXPECT_TRUE(webMouseWheel.scrollByPage); |
905 EXPECT_EQ(WebInputEvent::ControlKey, webMouseWheel.modifiers); | 905 EXPECT_EQ(WebInputEvent::ControlKey, webMouseWheel.modifiers); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 EXPECT_EQ(5, platformGestureBuilder.position().y()); | 1057 EXPECT_EQ(5, platformGestureBuilder.position().y()); |
1058 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); | 1058 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); |
1059 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); | 1059 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); |
1060 EXPECT_FALSE(platformGestureBuilder.inertial()); | 1060 EXPECT_FALSE(platformGestureBuilder.inertial()); |
1061 EXPECT_TRUE(platformGestureBuilder.synthetic()); | 1061 EXPECT_TRUE(platformGestureBuilder.synthetic()); |
1062 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU
nits()); | 1062 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU
nits()); |
1063 } | 1063 } |
1064 } | 1064 } |
1065 | 1065 |
1066 } // namespace blink | 1066 } // namespace blink |
OLD | NEW |