Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp

Issue 2542693002: Use WTF::TimeTicks to represent timestamp in Platform/Core event types (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 document, p1.id, p1.screenPosition, p1.position, 142 document, p1.id, p1.screenPosition, p1.position,
143 FloatSize(p1.radiusX, p1.radiusY), 143 FloatSize(p1.radiusX, p1.radiusY),
144 p1.rotationAngle, p1.force, String()); 144 p1.rotationAngle, p1.force, String());
145 145
146 // Test touchstart. 146 // Test touchstart.
147 { 147 {
148 TouchList* touchList = TouchList::create(); 148 TouchList* touchList = TouchList::create();
149 touchList->append(touch0); 149 touchList->append(touch0);
150 TouchEvent* touchEvent = TouchEvent::create( 150 TouchEvent* touchEvent = TouchEvent::create(
151 touchList, touchList, touchList, EventTypeNames::touchstart, domWindow, 151 touchList, touchList, touchList, EventTypeNames::touchstart, domWindow,
152 PlatformEvent::NoModifiers, false, false, true, 0, TouchActionAuto, 152 PlatformEvent::NoModifiers, false, false, true, TimeTicks(),
153 WebPointerProperties::PointerType::Touch); 153 TouchActionAuto, WebPointerProperties::PointerType::Touch);
154 154
155 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); 155 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent);
156 ASSERT_EQ(1u, webTouchBuilder.touchesLength); 156 ASSERT_EQ(1u, webTouchBuilder.touchesLength);
157 EXPECT_EQ(WebInputEvent::TouchStart, webTouchBuilder.type); 157 EXPECT_EQ(WebInputEvent::TouchStart, webTouchBuilder.type);
158 EXPECT_EQ(WebTouchPoint::StatePressed, webTouchBuilder.touches[0].state); 158 EXPECT_EQ(WebTouchPoint::StatePressed, webTouchBuilder.touches[0].state);
159 EXPECT_FLOAT_EQ(p0.screenPosition.x, 159 EXPECT_FLOAT_EQ(p0.screenPosition.x,
160 webTouchBuilder.touches[0].screenPosition.x); 160 webTouchBuilder.touches[0].screenPosition.x);
161 EXPECT_FLOAT_EQ(p0.screenPosition.y, 161 EXPECT_FLOAT_EQ(p0.screenPosition.y,
162 webTouchBuilder.touches[0].screenPosition.y); 162 webTouchBuilder.touches[0].screenPosition.y);
163 EXPECT_FLOAT_EQ(p0.position.x, webTouchBuilder.touches[0].position.x); 163 EXPECT_FLOAT_EQ(p0.position.x, webTouchBuilder.touches[0].position.x);
164 EXPECT_FLOAT_EQ(p0.position.y, webTouchBuilder.touches[0].position.y); 164 EXPECT_FLOAT_EQ(p0.position.y, webTouchBuilder.touches[0].position.y);
165 EXPECT_FLOAT_EQ(p0.radiusX, webTouchBuilder.touches[0].radiusX); 165 EXPECT_FLOAT_EQ(p0.radiusX, webTouchBuilder.touches[0].radiusX);
166 EXPECT_FLOAT_EQ(p0.radiusY, webTouchBuilder.touches[0].radiusY); 166 EXPECT_FLOAT_EQ(p0.radiusY, webTouchBuilder.touches[0].radiusY);
167 EXPECT_FLOAT_EQ(p0.rotationAngle, webTouchBuilder.touches[0].rotationAngle); 167 EXPECT_FLOAT_EQ(p0.rotationAngle, webTouchBuilder.touches[0].rotationAngle);
168 EXPECT_FLOAT_EQ(p0.force, webTouchBuilder.touches[0].force); 168 EXPECT_FLOAT_EQ(p0.force, webTouchBuilder.touches[0].force);
169 EXPECT_EQ(WebPointerProperties::PointerType::Touch, 169 EXPECT_EQ(WebPointerProperties::PointerType::Touch,
170 webTouchBuilder.touches[0].pointerType); 170 webTouchBuilder.touches[0].pointerType);
171 EXPECT_EQ(WebInputEvent::EventNonBlocking, webTouchBuilder.dispatchType); 171 EXPECT_EQ(WebInputEvent::EventNonBlocking, webTouchBuilder.dispatchType);
172 } 172 }
173 173
174 // Test cancelable touchstart. 174 // Test cancelable touchstart.
175 { 175 {
176 TouchList* touchList = TouchList::create(); 176 TouchList* touchList = TouchList::create();
177 touchList->append(touch0); 177 touchList->append(touch0);
178 TouchEvent* touchEvent = TouchEvent::create( 178 TouchEvent* touchEvent = TouchEvent::create(
179 touchList, touchList, touchList, EventTypeNames::touchstart, domWindow, 179 touchList, touchList, touchList, EventTypeNames::touchstart, domWindow,
180 PlatformEvent::NoModifiers, true, false, true, 0, TouchActionAuto, 180 PlatformEvent::NoModifiers, true, false, true, TimeTicks(),
181 WebPointerProperties::PointerType::Touch); 181 TouchActionAuto, WebPointerProperties::PointerType::Touch);
182 182
183 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); 183 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent);
184 EXPECT_EQ(WebInputEvent::Blocking, webTouchBuilder.dispatchType); 184 EXPECT_EQ(WebInputEvent::Blocking, webTouchBuilder.dispatchType);
185 } 185 }
186 186
187 // Test touchmove. 187 // Test touchmove.
188 { 188 {
189 TouchList* activeTouchList = TouchList::create(); 189 TouchList* activeTouchList = TouchList::create();
190 TouchList* movedTouchList = TouchList::create(); 190 TouchList* movedTouchList = TouchList::create();
191 activeTouchList->append(touch0); 191 activeTouchList->append(touch0);
192 activeTouchList->append(touch1); 192 activeTouchList->append(touch1);
193 movedTouchList->append(touch0); 193 movedTouchList->append(touch0);
194 TouchEvent* touchEvent = TouchEvent::create( 194 TouchEvent* touchEvent = TouchEvent::create(
195 activeTouchList, activeTouchList, movedTouchList, 195 activeTouchList, activeTouchList, movedTouchList,
196 EventTypeNames::touchmove, domWindow, PlatformEvent::NoModifiers, false, 196 EventTypeNames::touchmove, domWindow, PlatformEvent::NoModifiers, false,
197 false, true, 0, TouchActionAuto, 197 false, true, TimeTicks(), TouchActionAuto,
198 WebPointerProperties::PointerType::Touch); 198 WebPointerProperties::PointerType::Touch);
199 199
200 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); 200 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent);
201 ASSERT_EQ(2u, webTouchBuilder.touchesLength); 201 ASSERT_EQ(2u, webTouchBuilder.touchesLength);
202 EXPECT_EQ(WebInputEvent::TouchMove, webTouchBuilder.type); 202 EXPECT_EQ(WebInputEvent::TouchMove, webTouchBuilder.type);
203 EXPECT_EQ(WebTouchPoint::StateMoved, webTouchBuilder.touches[0].state); 203 EXPECT_EQ(WebTouchPoint::StateMoved, webTouchBuilder.touches[0].state);
204 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[1].state); 204 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[1].state);
205 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); 205 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id);
206 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); 206 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id);
207 EXPECT_EQ(WebInputEvent::EventNonBlocking, webTouchBuilder.dispatchType); 207 EXPECT_EQ(WebInputEvent::EventNonBlocking, webTouchBuilder.dispatchType);
208 } 208 }
209 209
210 // Test touchmove, different point yields same ordering. 210 // Test touchmove, different point yields same ordering.
211 { 211 {
212 TouchList* activeTouchList = TouchList::create(); 212 TouchList* activeTouchList = TouchList::create();
213 TouchList* movedTouchList = TouchList::create(); 213 TouchList* movedTouchList = TouchList::create();
214 activeTouchList->append(touch0); 214 activeTouchList->append(touch0);
215 activeTouchList->append(touch1); 215 activeTouchList->append(touch1);
216 movedTouchList->append(touch1); 216 movedTouchList->append(touch1);
217 TouchEvent* touchEvent = TouchEvent::create( 217 TouchEvent* touchEvent = TouchEvent::create(
218 activeTouchList, activeTouchList, movedTouchList, 218 activeTouchList, activeTouchList, movedTouchList,
219 EventTypeNames::touchmove, domWindow, PlatformEvent::NoModifiers, false, 219 EventTypeNames::touchmove, domWindow, PlatformEvent::NoModifiers, false,
220 false, true, 0, TouchActionAuto, 220 false, true, TimeTicks(), TouchActionAuto,
221 WebPointerProperties::PointerType::Touch); 221 WebPointerProperties::PointerType::Touch);
222 222
223 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); 223 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent);
224 ASSERT_EQ(2u, webTouchBuilder.touchesLength); 224 ASSERT_EQ(2u, webTouchBuilder.touchesLength);
225 EXPECT_EQ(WebInputEvent::TouchMove, webTouchBuilder.type); 225 EXPECT_EQ(WebInputEvent::TouchMove, webTouchBuilder.type);
226 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[0].state); 226 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[0].state);
227 EXPECT_EQ(WebTouchPoint::StateMoved, webTouchBuilder.touches[1].state); 227 EXPECT_EQ(WebTouchPoint::StateMoved, webTouchBuilder.touches[1].state);
228 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); 228 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id);
229 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); 229 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id);
230 EXPECT_EQ(WebInputEvent::EventNonBlocking, webTouchBuilder.dispatchType); 230 EXPECT_EQ(WebInputEvent::EventNonBlocking, webTouchBuilder.dispatchType);
231 } 231 }
232 232
233 // Test touchend. 233 // Test touchend.
234 { 234 {
235 TouchList* activeTouchList = TouchList::create(); 235 TouchList* activeTouchList = TouchList::create();
236 TouchList* releasedTouchList = TouchList::create(); 236 TouchList* releasedTouchList = TouchList::create();
237 activeTouchList->append(touch0); 237 activeTouchList->append(touch0);
238 releasedTouchList->append(touch1); 238 releasedTouchList->append(touch1);
239 TouchEvent* touchEvent = TouchEvent::create( 239 TouchEvent* touchEvent = TouchEvent::create(
240 activeTouchList, activeTouchList, releasedTouchList, 240 activeTouchList, activeTouchList, releasedTouchList,
241 EventTypeNames::touchend, domWindow, PlatformEvent::NoModifiers, false, 241 EventTypeNames::touchend, domWindow, PlatformEvent::NoModifiers, false,
242 false, false, 0, TouchActionAuto, 242 false, false, TimeTicks(), TouchActionAuto,
243 WebPointerProperties::PointerType::Touch); 243 WebPointerProperties::PointerType::Touch);
244 244
245 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); 245 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent);
246 ASSERT_EQ(2u, webTouchBuilder.touchesLength); 246 ASSERT_EQ(2u, webTouchBuilder.touchesLength);
247 EXPECT_EQ(WebInputEvent::TouchEnd, webTouchBuilder.type); 247 EXPECT_EQ(WebInputEvent::TouchEnd, webTouchBuilder.type);
248 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[0].state); 248 EXPECT_EQ(WebTouchPoint::StateStationary, webTouchBuilder.touches[0].state);
249 EXPECT_EQ(WebTouchPoint::StateReleased, webTouchBuilder.touches[1].state); 249 EXPECT_EQ(WebTouchPoint::StateReleased, webTouchBuilder.touches[1].state);
250 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); 250 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id);
251 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); 251 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id);
252 EXPECT_EQ(WebInputEvent::EventNonBlocking, webTouchBuilder.dispatchType); 252 EXPECT_EQ(WebInputEvent::EventNonBlocking, webTouchBuilder.dispatchType);
253 } 253 }
254 254
255 // Test touchcancel. 255 // Test touchcancel.
256 { 256 {
257 TouchList* activeTouchList = TouchList::create(); 257 TouchList* activeTouchList = TouchList::create();
258 TouchList* cancelledTouchList = TouchList::create(); 258 TouchList* cancelledTouchList = TouchList::create();
259 cancelledTouchList->append(touch0); 259 cancelledTouchList->append(touch0);
260 cancelledTouchList->append(touch1); 260 cancelledTouchList->append(touch1);
261 TouchEvent* touchEvent = TouchEvent::create( 261 TouchEvent* touchEvent = TouchEvent::create(
262 activeTouchList, activeTouchList, cancelledTouchList, 262 activeTouchList, activeTouchList, cancelledTouchList,
263 EventTypeNames::touchcancel, domWindow, PlatformEvent::NoModifiers, 263 EventTypeNames::touchcancel, domWindow, PlatformEvent::NoModifiers,
264 false, false, false, 0, TouchActionAuto, 264 false, false, false, TimeTicks(), TouchActionAuto,
265 WebPointerProperties::PointerType::Touch); 265 WebPointerProperties::PointerType::Touch);
266 266
267 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); 267 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent);
268 ASSERT_EQ(2u, webTouchBuilder.touchesLength); 268 ASSERT_EQ(2u, webTouchBuilder.touchesLength);
269 EXPECT_EQ(WebInputEvent::TouchCancel, webTouchBuilder.type); 269 EXPECT_EQ(WebInputEvent::TouchCancel, webTouchBuilder.type);
270 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[0].state); 270 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[0].state);
271 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[1].state); 271 EXPECT_EQ(WebTouchPoint::StateCancelled, webTouchBuilder.touches[1].state);
272 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id); 272 EXPECT_EQ(p0.id, webTouchBuilder.touches[0].id);
273 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id); 273 EXPECT_EQ(p1.id, webTouchBuilder.touches[1].id);
274 EXPECT_EQ(WebInputEvent::EventNonBlocking, webTouchBuilder.dispatchType); 274 EXPECT_EQ(WebInputEvent::EventNonBlocking, webTouchBuilder.dispatchType);
275 } 275 }
276 276
277 // Test max point limit. 277 // Test max point limit.
278 { 278 {
279 TouchList* touchList = TouchList::create(); 279 TouchList* touchList = TouchList::create();
280 TouchList* changedTouchList = TouchList::create(); 280 TouchList* changedTouchList = TouchList::create();
281 for (int i = 0; i <= static_cast<int>(WebTouchEvent::kTouchesLengthCap) * 2; 281 for (int i = 0; i <= static_cast<int>(WebTouchEvent::kTouchesLengthCap) * 2;
282 ++i) { 282 ++i) {
283 Touch* touch = Touch::create( 283 Touch* touch = Touch::create(
284 toLocalFrame(webViewImpl->page()->mainFrame()), document, i, 284 toLocalFrame(webViewImpl->page()->mainFrame()), document, i,
285 p0.screenPosition, p0.position, FloatSize(p0.radiusX, p0.radiusY), 285 p0.screenPosition, p0.position, FloatSize(p0.radiusX, p0.radiusY),
286 p0.rotationAngle, p0.force, String()); 286 p0.rotationAngle, p0.force, String());
287 touchList->append(touch); 287 touchList->append(touch);
288 changedTouchList->append(touch); 288 changedTouchList->append(touch);
289 } 289 }
290 TouchEvent* touchEvent = TouchEvent::create( 290 TouchEvent* touchEvent = TouchEvent::create(
291 touchList, touchList, touchList, EventTypeNames::touchstart, domWindow, 291 touchList, touchList, touchList, EventTypeNames::touchstart, domWindow,
292 PlatformEvent::NoModifiers, false, false, true, 0, TouchActionAuto, 292 PlatformEvent::NoModifiers, false, false, true, TimeTicks(),
293 WebPointerProperties::PointerType::Touch); 293 TouchActionAuto, WebPointerProperties::PointerType::Touch);
294 294
295 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); 295 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent);
296 ASSERT_EQ(static_cast<unsigned>(WebTouchEvent::kTouchesLengthCap), 296 ASSERT_EQ(static_cast<unsigned>(WebTouchEvent::kTouchesLengthCap),
297 webTouchBuilder.touchesLength); 297 webTouchBuilder.touchesLength);
298 } 298 }
299 } 299 }
300 300
301 TEST(WebInputEventConversionTest, InputEventsScaling) { 301 TEST(WebInputEventConversionTest, InputEventsScaling) {
302 const std::string baseURL("http://www.test1.com/"); 302 const std::string baseURL("http://www.test1.com/");
303 const std::string fileName("fixed_layout.html"); 303 const std::string fileName("fixed_layout.html");
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 EXPECT_FLOAT_EQ(5.2f, 496 EXPECT_FLOAT_EQ(5.2f,
497 platformTouchBuilder.touchPoints()[0].radius().height()); 497 platformTouchBuilder.touchPoints()[0].radius().height());
498 } 498 }
499 499
500 // Reverse builders should *not* go back to physical pixels, as they are used 500 // Reverse builders should *not* go back to physical pixels, as they are used
501 // for plugins which expect CSS pixel coordinates. 501 // for plugins which expect CSS pixel coordinates.
502 { 502 {
503 PlatformMouseEvent platformMouseEvent( 503 PlatformMouseEvent platformMouseEvent(
504 IntPoint(10, 10), IntPoint(10, 10), WebPointerProperties::Button::Left, 504 IntPoint(10, 10), IntPoint(10, 10), WebPointerProperties::Button::Left,
505 PlatformEvent::MouseMoved, 1, PlatformEvent::NoModifiers, 505 PlatformEvent::MouseMoved, 1, PlatformEvent::NoModifiers,
506 PlatformMouseEvent::RealOrIndistinguishable, 0); 506 PlatformMouseEvent::RealOrIndistinguishable, TimeTicks());
507 MouseEvent* mouseEvent = MouseEvent::create( 507 MouseEvent* mouseEvent = MouseEvent::create(
508 EventTypeNames::mousemove, domWindow, platformMouseEvent, 0, document); 508 EventTypeNames::mousemove, domWindow, platformMouseEvent, 0, document);
509 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEvent); 509 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEvent);
510 510
511 EXPECT_EQ(10, webMouseBuilder.x); 511 EXPECT_EQ(10, webMouseBuilder.x);
512 EXPECT_EQ(10, webMouseBuilder.y); 512 EXPECT_EQ(10, webMouseBuilder.y);
513 EXPECT_EQ(10, webMouseBuilder.globalX); 513 EXPECT_EQ(10, webMouseBuilder.globalX);
514 EXPECT_EQ(10, webMouseBuilder.globalY); 514 EXPECT_EQ(10, webMouseBuilder.globalY);
515 EXPECT_EQ(10, webMouseBuilder.windowX); 515 EXPECT_EQ(10, webMouseBuilder.windowX);
516 EXPECT_EQ(10, webMouseBuilder.windowY); 516 EXPECT_EQ(10, webMouseBuilder.windowY);
517 } 517 }
518 518
519 { 519 {
520 PlatformMouseEvent platformMouseEvent( 520 PlatformMouseEvent platformMouseEvent(
521 IntPoint(10, 10), IntPoint(10, 10), 521 IntPoint(10, 10), IntPoint(10, 10),
522 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 1, 522 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 1,
523 PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishable, 523 PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishable,
524 0); 524 TimeTicks());
525 MouseEvent* mouseEvent = MouseEvent::create( 525 MouseEvent* mouseEvent = MouseEvent::create(
526 EventTypeNames::mousemove, domWindow, platformMouseEvent, 0, document); 526 EventTypeNames::mousemove, domWindow, platformMouseEvent, 0, document);
527 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEvent); 527 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEvent);
528 EXPECT_EQ(WebMouseEvent::Button::NoButton, webMouseBuilder.button); 528 EXPECT_EQ(WebMouseEvent::Button::NoButton, webMouseBuilder.button);
529 } 529 }
530 530
531 { 531 {
532 PlatformGestureEvent platformGestureEvent( 532 PlatformGestureEvent platformGestureEvent(
533 PlatformEvent::GestureScrollUpdate, IntPoint(10, 12), IntPoint(20, 22), 533 PlatformEvent::GestureScrollUpdate, IntPoint(10, 12), IntPoint(20, 22),
534 IntSize(25, 27), 0, PlatformEvent::NoModifiers, 534 IntSize(25, 27), TimeTicks(), PlatformEvent::NoModifiers,
535 PlatformGestureSourceTouchscreen); 535 PlatformGestureSourceTouchscreen);
536 platformGestureEvent.setScrollGestureData(30, 32, ScrollByPrecisePixel, 40, 536 platformGestureEvent.setScrollGestureData(30, 32, ScrollByPrecisePixel, 40,
537 42, ScrollInertialPhaseMomentum, 537 42, ScrollInertialPhaseMomentum,
538 true, -1 /* null plugin id */); 538 true, -1 /* null plugin id */);
539 // FIXME: GestureEvent does not preserve velocityX, velocityY, 539 // FIXME: GestureEvent does not preserve velocityX, velocityY,
540 // or preventPropagation. It also fails to scale 540 // or preventPropagation. It also fails to scale
541 // coordinates (x, y, deltaX, deltaY) to the page scale. This 541 // coordinates (x, y, deltaX, deltaY) to the page scale. This
542 // may lead to unexpected bugs if a PlatformGestureEvent is 542 // may lead to unexpected bugs if a PlatformGestureEvent is
543 // transformed into WebGestureEvent and back. 543 // transformed into WebGestureEvent and back.
544 GestureEvent* gestureEvent = 544 GestureEvent* gestureEvent =
(...skipping 16 matching lines...) Expand all
561 561
562 { 562 {
563 Touch* touch = 563 Touch* touch =
564 Touch::create(toLocalFrame(webViewImpl->page()->mainFrame()), document, 564 Touch::create(toLocalFrame(webViewImpl->page()->mainFrame()), document,
565 0, FloatPoint(10, 9.5), FloatPoint(3.5, 2), 565 0, FloatPoint(10, 9.5), FloatPoint(3.5, 2),
566 FloatSize(4, 4.5), 0, 0, String()); 566 FloatSize(4, 4.5), 0, 0, String());
567 TouchList* touchList = TouchList::create(); 567 TouchList* touchList = TouchList::create();
568 touchList->append(touch); 568 touchList->append(touch);
569 TouchEvent* touchEvent = TouchEvent::create( 569 TouchEvent* touchEvent = TouchEvent::create(
570 touchList, touchList, touchList, EventTypeNames::touchmove, domWindow, 570 touchList, touchList, touchList, EventTypeNames::touchmove, domWindow,
571 PlatformEvent::NoModifiers, false, false, true, 0, TouchActionAuto, 571 PlatformEvent::NoModifiers, false, false, true, TimeTicks(),
572 WebPointerProperties::PointerType::Touch); 572 TouchActionAuto, WebPointerProperties::PointerType::Touch);
573 573
574 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); 574 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent);
575 ASSERT_EQ(1u, webTouchBuilder.touchesLength); 575 ASSERT_EQ(1u, webTouchBuilder.touchesLength);
576 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); 576 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x);
577 EXPECT_FLOAT_EQ(9.5, webTouchBuilder.touches[0].screenPosition.y); 577 EXPECT_FLOAT_EQ(9.5, webTouchBuilder.touches[0].screenPosition.y);
578 EXPECT_FLOAT_EQ(3.5, webTouchBuilder.touches[0].position.x); 578 EXPECT_FLOAT_EQ(3.5, webTouchBuilder.touches[0].position.x);
579 EXPECT_FLOAT_EQ(2, webTouchBuilder.touches[0].position.y); 579 EXPECT_FLOAT_EQ(2, webTouchBuilder.touches[0].position.y);
580 EXPECT_FLOAT_EQ(4, webTouchBuilder.touches[0].radiusX); 580 EXPECT_FLOAT_EQ(4, webTouchBuilder.touches[0].radiusX);
581 EXPECT_FLOAT_EQ(4.5, webTouchBuilder.touches[0].radiusY); 581 EXPECT_FLOAT_EQ(4.5, webTouchBuilder.touches[0].radiusY);
582 EXPECT_EQ(WebInputEvent::EventNonBlocking, webTouchBuilder.dispatchType); 582 EXPECT_EQ(WebInputEvent::EventNonBlocking, webTouchBuilder.dispatchType);
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 int pageHeight = 480; 1102 int pageHeight = 480;
1103 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 1103 webViewImpl->resize(WebSize(pageWidth, pageHeight));
1104 webViewImpl->updateAllLifecyclePhases(); 1104 webViewImpl->updateAllLifecyclePhases();
1105 1105
1106 Document* document = 1106 Document* document =
1107 toLocalFrame(webViewImpl->page()->mainFrame())->document(); 1107 toLocalFrame(webViewImpl->page()->mainFrame())->document();
1108 { 1108 {
1109 WheelEvent* event = WheelEvent::create( 1109 WheelEvent* event = WheelEvent::create(
1110 FloatPoint(1, 3), FloatPoint(5, 10), WheelEvent::kDomDeltaPage, 1110 FloatPoint(1, 3), FloatPoint(5, 10), WheelEvent::kDomDeltaPage,
1111 document->domWindow(), IntPoint(2, 6), IntPoint(10, 30), 1111 document->domWindow(), IntPoint(2, 6), IntPoint(10, 30),
1112 PlatformEvent::CtrlKey, 0, 0, -1 /* null plugin id */, 1112 PlatformEvent::CtrlKey, 0, TimeTicks(), -1 /* null plugin id */,
1113 true /* hasPreciseScrollingDeltas */, Event::RailsModeHorizontal, 1113 true /* hasPreciseScrollingDeltas */, Event::RailsModeHorizontal,
1114 true /*cancelable*/ 1114 true /*cancelable*/
1115 #if OS(MACOSX) 1115 #if OS(MACOSX)
1116 , 1116 ,
1117 WheelEventPhaseBegan, WheelEventPhaseChanged 1117 WheelEventPhaseBegan, WheelEventPhaseChanged
1118 #endif 1118 #endif
1119 ); 1119 );
1120 WebMouseWheelEventBuilder webMouseWheel( 1120 WebMouseWheelEventBuilder webMouseWheel(
1121 toLocalFrame(webViewImpl->page()->mainFrame())->view(), 1121 toLocalFrame(webViewImpl->page()->mainFrame())->view(),
1122 document->layoutViewItem(), *event); 1122 document->layoutViewItem(), *event);
(...skipping 13 matching lines...) Expand all
1136 #if OS(MACOSX) 1136 #if OS(MACOSX)
1137 EXPECT_EQ(WebMouseWheelEvent::PhaseBegan, webMouseWheel.phase); 1137 EXPECT_EQ(WebMouseWheelEvent::PhaseBegan, webMouseWheel.phase);
1138 EXPECT_EQ(WebMouseWheelEvent::PhaseChanged, webMouseWheel.momentumPhase); 1138 EXPECT_EQ(WebMouseWheelEvent::PhaseChanged, webMouseWheel.momentumPhase);
1139 #endif 1139 #endif
1140 } 1140 }
1141 1141
1142 { 1142 {
1143 WheelEvent* event = WheelEvent::create( 1143 WheelEvent* event = WheelEvent::create(
1144 FloatPoint(1, 3), FloatPoint(5, 10), WheelEvent::kDomDeltaPage, 1144 FloatPoint(1, 3), FloatPoint(5, 10), WheelEvent::kDomDeltaPage,
1145 document->domWindow(), IntPoint(2, 6), IntPoint(10, 30), 1145 document->domWindow(), IntPoint(2, 6), IntPoint(10, 30),
1146 PlatformEvent::CtrlKey, 0, 0, -1 /* null plugin id */, 1146 PlatformEvent::CtrlKey, 0, TimeTicks(), -1 /* null plugin id */,
1147 true /* hasPreciseScrollingDeltas */, Event::RailsModeHorizontal, false 1147 true /* hasPreciseScrollingDeltas */, Event::RailsModeHorizontal, false
1148 #if OS(MACOSX) 1148 #if OS(MACOSX)
1149 , 1149 ,
1150 WheelEventPhaseNone, WheelEventPhaseNone 1150 WheelEventPhaseNone, WheelEventPhaseNone
1151 #endif 1151 #endif
1152 ); 1152 );
1153 WebMouseWheelEventBuilder webMouseWheel( 1153 WebMouseWheelEventBuilder webMouseWheel(
1154 toLocalFrame(webViewImpl->page()->mainFrame())->view(), 1154 toLocalFrame(webViewImpl->page()->mainFrame())->view(),
1155 document->layoutViewItem(), *event); 1155 document->layoutViewItem(), *event);
1156 EXPECT_EQ(WebInputEvent::EventNonBlocking, webMouseWheel.dispatchType); 1156 EXPECT_EQ(WebInputEvent::EventNonBlocking, webMouseWheel.dispatchType);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 EXPECT_EQ(ScrollInertialPhaseNonMomentum, 1338 EXPECT_EQ(ScrollInertialPhaseNonMomentum,
1339 platformGestureBuilder.inertialPhase()); 1339 platformGestureBuilder.inertialPhase());
1340 EXPECT_TRUE(platformGestureBuilder.synthetic()); 1340 EXPECT_TRUE(platformGestureBuilder.synthetic());
1341 EXPECT_EQ(ScrollGranularity::ScrollByPage, 1341 EXPECT_EQ(ScrollGranularity::ScrollByPage,
1342 platformGestureBuilder.deltaUnits()); 1342 platformGestureBuilder.deltaUnits());
1343 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId()); 1343 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId());
1344 } 1344 }
1345 } 1345 }
1346 1346
1347 } // namespace blink 1347 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebFrameTest.cpp ('k') | third_party/WebKit/Source/wtf/Time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698