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

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

Issue 1403893003: Plumb gesture source value through Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Convert more tests (related to CL) to use Touchscreen. Created 5 years, 2 months 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 EXPECT_EQ(5, platformMouseBuilder.position().y()); 266 EXPECT_EQ(5, platformMouseBuilder.position().y());
267 EXPECT_EQ(10, platformMouseBuilder.globalPosition().x()); 267 EXPECT_EQ(10, platformMouseBuilder.globalPosition().x());
268 EXPECT_EQ(10, platformMouseBuilder.globalPosition().y()); 268 EXPECT_EQ(10, platformMouseBuilder.globalPosition().y());
269 EXPECT_EQ(5, platformMouseBuilder.movementDelta().x()); 269 EXPECT_EQ(5, platformMouseBuilder.movementDelta().x());
270 EXPECT_EQ(5, platformMouseBuilder.movementDelta().y()); 270 EXPECT_EQ(5, platformMouseBuilder.movementDelta().y());
271 } 271 }
272 272
273 { 273 {
274 WebGestureEvent webGestureEvent; 274 WebGestureEvent webGestureEvent;
275 webGestureEvent.type = WebInputEvent::GestureScrollUpdate; 275 webGestureEvent.type = WebInputEvent::GestureScrollUpdate;
276 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
276 webGestureEvent.x = 10; 277 webGestureEvent.x = 10;
277 webGestureEvent.y = 12; 278 webGestureEvent.y = 12;
278 webGestureEvent.globalX = 20; 279 webGestureEvent.globalX = 20;
279 webGestureEvent.globalY = 22; 280 webGestureEvent.globalY = 22;
280 webGestureEvent.data.scrollUpdate.deltaX = 30; 281 webGestureEvent.data.scrollUpdate.deltaX = 30;
281 webGestureEvent.data.scrollUpdate.deltaY = 32; 282 webGestureEvent.data.scrollUpdate.deltaY = 32;
282 webGestureEvent.data.scrollUpdate.velocityX = 40; 283 webGestureEvent.data.scrollUpdate.velocityX = 40;
283 webGestureEvent.data.scrollUpdate.velocityY = 42; 284 webGestureEvent.data.scrollUpdate.velocityY = 42;
284 webGestureEvent.data.scrollUpdate.inertial = true; 285 webGestureEvent.data.scrollUpdate.inertial = true;
285 webGestureEvent.data.scrollUpdate.preventPropagation = true; 286 webGestureEvent.data.scrollUpdate.preventPropagation = true;
286 287
287 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 288 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
288 EXPECT_EQ(5, platformGestureBuilder.position().x()); 289 EXPECT_EQ(5, platformGestureBuilder.position().x());
289 EXPECT_EQ(6, platformGestureBuilder.position().y()); 290 EXPECT_EQ(6, platformGestureBuilder.position().y());
290 EXPECT_EQ(20, platformGestureBuilder.globalPosition().x()); 291 EXPECT_EQ(20, platformGestureBuilder.globalPosition().x());
291 EXPECT_EQ(22, platformGestureBuilder.globalPosition().y()); 292 EXPECT_EQ(22, platformGestureBuilder.globalPosition().y());
292 EXPECT_EQ(15, platformGestureBuilder.deltaX()); 293 EXPECT_EQ(15, platformGestureBuilder.deltaX());
293 EXPECT_EQ(16, platformGestureBuilder.deltaY()); 294 EXPECT_EQ(16, platformGestureBuilder.deltaY());
294 // TODO: The velocity values may need to be scaled to page scale in 295 // TODO: The velocity values may need to be scaled to page scale in
295 // order to remain consist with delta values. 296 // order to remain consist with delta values.
296 EXPECT_EQ(40, platformGestureBuilder.velocityX()); 297 EXPECT_EQ(40, platformGestureBuilder.velocityX());
297 EXPECT_EQ(42, platformGestureBuilder.velocityY()); 298 EXPECT_EQ(42, platformGestureBuilder.velocityY());
298 EXPECT_TRUE(platformGestureBuilder.inertial()); 299 EXPECT_TRUE(platformGestureBuilder.inertial());
299 EXPECT_TRUE(platformGestureBuilder.preventPropagation()); 300 EXPECT_TRUE(platformGestureBuilder.preventPropagation());
300 } 301 }
301 302
302 { 303 {
303 WebGestureEvent webGestureEvent; 304 WebGestureEvent webGestureEvent;
304 webGestureEvent.type = WebInputEvent::GestureScrollEnd; 305 webGestureEvent.type = WebInputEvent::GestureScrollEnd;
306 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
305 webGestureEvent.x = 10; 307 webGestureEvent.x = 10;
306 webGestureEvent.y = 12; 308 webGestureEvent.y = 12;
307 webGestureEvent.globalX = 20; 309 webGestureEvent.globalX = 20;
308 webGestureEvent.globalY = 22; 310 webGestureEvent.globalY = 22;
309 311
310 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 312 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
311 EXPECT_EQ(5, platformGestureBuilder.position().x()); 313 EXPECT_EQ(5, platformGestureBuilder.position().x());
312 EXPECT_EQ(6, platformGestureBuilder.position().y()); 314 EXPECT_EQ(6, platformGestureBuilder.position().y());
313 EXPECT_EQ(20, platformGestureBuilder.globalPosition().x()); 315 EXPECT_EQ(20, platformGestureBuilder.globalPosition().x());
314 EXPECT_EQ(22, platformGestureBuilder.globalPosition().y()); 316 EXPECT_EQ(22, platformGestureBuilder.globalPosition().y());
315 EXPECT_FALSE(platformGestureBuilder.inertial()); 317 EXPECT_FALSE(platformGestureBuilder.inertial());
316 } 318 }
317 319
318 { 320 {
319 WebGestureEvent webGestureEvent; 321 WebGestureEvent webGestureEvent;
320 webGestureEvent.type = WebInputEvent::GestureTap; 322 webGestureEvent.type = WebInputEvent::GestureTap;
323 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
321 webGestureEvent.data.tap.width = 10; 324 webGestureEvent.data.tap.width = 10;
322 webGestureEvent.data.tap.height = 10; 325 webGestureEvent.data.tap.height = 10;
323 326
324 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 327 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
325 EXPECT_EQ(5, platformGestureBuilder.area().width()); 328 EXPECT_EQ(5, platformGestureBuilder.area().width());
326 EXPECT_EQ(5, platformGestureBuilder.area().height()); 329 EXPECT_EQ(5, platformGestureBuilder.area().height());
327 } 330 }
328 331
329 { 332 {
330 WebGestureEvent webGestureEvent; 333 WebGestureEvent webGestureEvent;
331 webGestureEvent.type = WebInputEvent::GestureTapUnconfirmed; 334 webGestureEvent.type = WebInputEvent::GestureTapUnconfirmed;
335 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
332 webGestureEvent.data.tap.width = 10; 336 webGestureEvent.data.tap.width = 10;
333 webGestureEvent.data.tap.height = 10; 337 webGestureEvent.data.tap.height = 10;
334 338
335 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 339 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
336 EXPECT_EQ(5, platformGestureBuilder.area().width()); 340 EXPECT_EQ(5, platformGestureBuilder.area().width());
337 EXPECT_EQ(5, platformGestureBuilder.area().height()); 341 EXPECT_EQ(5, platformGestureBuilder.area().height());
338 } 342 }
339 343
340 { 344 {
341 WebGestureEvent webGestureEvent; 345 WebGestureEvent webGestureEvent;
342 webGestureEvent.type = WebInputEvent::GestureTapDown; 346 webGestureEvent.type = WebInputEvent::GestureTapDown;
347 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
343 webGestureEvent.data.tapDown.width = 10; 348 webGestureEvent.data.tapDown.width = 10;
344 webGestureEvent.data.tapDown.height = 10; 349 webGestureEvent.data.tapDown.height = 10;
345 350
346 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 351 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
347 EXPECT_EQ(5, platformGestureBuilder.area().width()); 352 EXPECT_EQ(5, platformGestureBuilder.area().width());
348 EXPECT_EQ(5, platformGestureBuilder.area().height()); 353 EXPECT_EQ(5, platformGestureBuilder.area().height());
349 } 354 }
350 355
351 { 356 {
352 WebGestureEvent webGestureEvent; 357 WebGestureEvent webGestureEvent;
353 webGestureEvent.type = WebInputEvent::GestureShowPress; 358 webGestureEvent.type = WebInputEvent::GestureShowPress;
359 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
354 webGestureEvent.data.showPress.width = 10; 360 webGestureEvent.data.showPress.width = 10;
355 webGestureEvent.data.showPress.height = 10; 361 webGestureEvent.data.showPress.height = 10;
356 362
357 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 363 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
358 EXPECT_EQ(5, platformGestureBuilder.area().width()); 364 EXPECT_EQ(5, platformGestureBuilder.area().width());
359 EXPECT_EQ(5, platformGestureBuilder.area().height()); 365 EXPECT_EQ(5, platformGestureBuilder.area().height());
360 } 366 }
361 367
362 { 368 {
363 WebGestureEvent webGestureEvent; 369 WebGestureEvent webGestureEvent;
364 webGestureEvent.type = WebInputEvent::GestureLongPress; 370 webGestureEvent.type = WebInputEvent::GestureLongPress;
371 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
365 webGestureEvent.data.longPress.width = 10; 372 webGestureEvent.data.longPress.width = 10;
366 webGestureEvent.data.longPress.height = 10; 373 webGestureEvent.data.longPress.height = 10;
367 374
368 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 375 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
369 EXPECT_EQ(5, platformGestureBuilder.area().width()); 376 EXPECT_EQ(5, platformGestureBuilder.area().width());
370 EXPECT_EQ(5, platformGestureBuilder.area().height()); 377 EXPECT_EQ(5, platformGestureBuilder.area().height());
371 } 378 }
372 379
373 { 380 {
374 WebGestureEvent webGestureEvent; 381 WebGestureEvent webGestureEvent;
375 webGestureEvent.type = WebInputEvent::GestureTwoFingerTap; 382 webGestureEvent.type = WebInputEvent::GestureTwoFingerTap;
383 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
376 webGestureEvent.data.twoFingerTap.firstFingerWidth = 10; 384 webGestureEvent.data.twoFingerTap.firstFingerWidth = 10;
377 webGestureEvent.data.twoFingerTap.firstFingerHeight = 10; 385 webGestureEvent.data.twoFingerTap.firstFingerHeight = 10;
378 386
379 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 387 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
380 EXPECT_EQ(5, platformGestureBuilder.area().width()); 388 EXPECT_EQ(5, platformGestureBuilder.area().width());
381 EXPECT_EQ(5, platformGestureBuilder.area().height()); 389 EXPECT_EQ(5, platformGestureBuilder.area().height());
382 } 390 }
383 391
384 { 392 {
385 WebTouchEvent webTouchEvent; 393 WebTouchEvent webTouchEvent;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 434
427 { 435 {
428 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10) , NoButton, PlatformEvent::MouseMoved, 1, PlatformEvent::NoModifiers, PlatformMo useEvent::RealOrIndistinguishable, 0); 436 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10) , NoButton, PlatformEvent::MouseMoved, 1, PlatformEvent::NoModifiers, PlatformMo useEvent::RealOrIndistinguishable, 0);
429 RefPtrWillBeRawPtr<MouseEvent> mouseEvent = MouseEvent::create(EventType Names::mousemove, domWindow, platformMouseEvent, 0, document); 437 RefPtrWillBeRawPtr<MouseEvent> mouseEvent = MouseEvent::create(EventType Names::mousemove, domWindow, platformMouseEvent, 0, document);
430 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve nt); 438 WebMouseEventBuilder webMouseBuilder(view, documentLayoutView, *mouseEve nt);
431 EXPECT_EQ(WebMouseEvent::ButtonNone, webMouseBuilder.button); 439 EXPECT_EQ(WebMouseEvent::ButtonNone, webMouseBuilder.button);
432 } 440 }
433 441
434 { 442 {
435 PlatformGestureEvent platformGestureEvent(PlatformEvent::GestureScrollUp date, IntPoint(10, 12), IntPoint(20, 22), IntSize(25, 27), 0, 443 PlatformGestureEvent platformGestureEvent(PlatformEvent::GestureScrollUp date, IntPoint(10, 12), IntPoint(20, 22), IntSize(25, 27), 0,
436 PlatformEvent::NoModifiers); 444 PlatformEvent::NoModifiers, PlatformGestureSourceTouchscreen);
437 platformGestureEvent.setScrollGestureData(30, 32, 40, 42, true, true, -1 /* null plugin id */); 445 platformGestureEvent.setScrollGestureData(30, 32, 40, 42, true, true, -1 /* null plugin id */);
438 // FIXME: GestureEvent does not preserve velocityX, velocityY, 446 // FIXME: GestureEvent does not preserve velocityX, velocityY,
439 // or preventPropagation. It also fails to scale 447 // or preventPropagation. It also fails to scale
440 // coordinates (x, y, deltaX, deltaY) to the page scale. This 448 // coordinates (x, y, deltaX, deltaY) to the page scale. This
441 // may lead to unexpected bugs if a PlatformGestureEvent is 449 // may lead to unexpected bugs if a PlatformGestureEvent is
442 // transformed into WebGestureEvent and back. 450 // transformed into WebGestureEvent and back.
443 RefPtrWillBeRawPtr<GestureEvent> gestureEvent = GestureEvent::create(dom Window, platformGestureEvent); 451 RefPtrWillBeRawPtr<GestureEvent> gestureEvent = GestureEvent::create(dom Window, platformGestureEvent);
444 WebGestureEventBuilder webGestureBuilder(documentLayoutView, *gestureEve nt); 452 WebGestureEventBuilder webGestureBuilder(documentLayoutView, *gestureEve nt);
445 453
446 EXPECT_EQ(10, webGestureBuilder.x); 454 EXPECT_EQ(10, webGestureBuilder.x);
447 EXPECT_EQ(12, webGestureBuilder.y); 455 EXPECT_EQ(12, webGestureBuilder.y);
448 EXPECT_EQ(20, webGestureBuilder.globalX); 456 EXPECT_EQ(20, webGestureBuilder.globalX);
449 EXPECT_EQ(22, webGestureBuilder.globalY); 457 EXPECT_EQ(22, webGestureBuilder.globalY);
450 EXPECT_EQ(30, webGestureBuilder.data.scrollUpdate.deltaX); 458 EXPECT_EQ(30, webGestureBuilder.data.scrollUpdate.deltaX);
451 EXPECT_EQ(32, webGestureBuilder.data.scrollUpdate.deltaY); 459 EXPECT_EQ(32, webGestureBuilder.data.scrollUpdate.deltaY);
452 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityX); 460 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityX);
453 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityY); 461 EXPECT_EQ(0, webGestureBuilder.data.scrollUpdate.velocityY);
454 EXPECT_TRUE(webGestureBuilder.data.scrollUpdate.inertial); 462 EXPECT_TRUE(webGestureBuilder.data.scrollUpdate.inertial);
455 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.preventPropagation); 463 EXPECT_FALSE(webGestureBuilder.data.scrollUpdate.preventPropagation);
464 EXPECT_EQ(WebGestureDeviceTouchscreen, webGestureBuilder.sourceDevice);
456 } 465 }
457 466
458 { 467 {
459 RefPtrWillBeRawPtr<Touch> touch = Touch::create(toLocalFrame(webViewImpl ->page()->mainFrame()), document.get(), 0, FloatPoint(10, 9.5), FloatPoint(3.5, 2), FloatSize(4, 4.5), 0, 0); 468 RefPtrWillBeRawPtr<Touch> touch = Touch::create(toLocalFrame(webViewImpl ->page()->mainFrame()), document.get(), 0, FloatPoint(10, 9.5), FloatPoint(3.5, 2), FloatSize(4, 4.5), 0, 0);
460 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create(); 469 RefPtrWillBeRawPtr<TouchList> touchList = TouchList::create();
461 touchList->append(touch); 470 touchList->append(touch);
462 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList .get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow, PlatformEvent::NoModifiers, false, false); 471 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList .get(), touchList.get(), touchList.get(), EventTypeNames::touchmove, domWindow, PlatformEvent::NoModifiers, false, false);
463 472
464 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); 473 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent);
465 ASSERT_EQ(1u, webTouchBuilder.touchesLength); 474 ASSERT_EQ(1u, webTouchBuilder.touchesLength);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 EXPECT_EQ(30, platformMouseBuilder.position().y()); 518 EXPECT_EQ(30, platformMouseBuilder.position().y());
510 EXPECT_EQ(100, platformMouseBuilder.globalPosition().x()); 519 EXPECT_EQ(100, platformMouseBuilder.globalPosition().x());
511 EXPECT_EQ(110, platformMouseBuilder.globalPosition().y()); 520 EXPECT_EQ(110, platformMouseBuilder.globalPosition().y());
512 EXPECT_EQ(20, platformMouseBuilder.movementDelta().x()); 521 EXPECT_EQ(20, platformMouseBuilder.movementDelta().x());
513 EXPECT_EQ(20, platformMouseBuilder.movementDelta().y()); 522 EXPECT_EQ(20, platformMouseBuilder.movementDelta().y());
514 } 523 }
515 524
516 { 525 {
517 WebGestureEvent webGestureEvent; 526 WebGestureEvent webGestureEvent;
518 webGestureEvent.type = WebInputEvent::GestureScrollUpdate; 527 webGestureEvent.type = WebInputEvent::GestureScrollUpdate;
528 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
519 webGestureEvent.x = 100; 529 webGestureEvent.x = 100;
520 webGestureEvent.y = 110; 530 webGestureEvent.y = 110;
521 webGestureEvent.globalX = 100; 531 webGestureEvent.globalX = 100;
522 webGestureEvent.globalY = 110; 532 webGestureEvent.globalY = 110;
523 webGestureEvent.data.scrollUpdate.deltaX = 60; 533 webGestureEvent.data.scrollUpdate.deltaX = 60;
524 webGestureEvent.data.scrollUpdate.deltaY = 60; 534 webGestureEvent.data.scrollUpdate.deltaY = 60;
525 535
526 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 536 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
527 EXPECT_EQ(30, platformGestureBuilder.position().x()); 537 EXPECT_EQ(30, platformGestureBuilder.position().x());
528 EXPECT_EQ(30, platformGestureBuilder.position().y()); 538 EXPECT_EQ(30, platformGestureBuilder.position().y());
529 EXPECT_EQ(100, platformGestureBuilder.globalPosition().x()); 539 EXPECT_EQ(100, platformGestureBuilder.globalPosition().x());
530 EXPECT_EQ(110, platformGestureBuilder.globalPosition().y()); 540 EXPECT_EQ(110, platformGestureBuilder.globalPosition().y());
531 EXPECT_EQ(20, platformGestureBuilder.deltaX()); 541 EXPECT_EQ(20, platformGestureBuilder.deltaX());
532 EXPECT_EQ(20, platformGestureBuilder.deltaY()); 542 EXPECT_EQ(20, platformGestureBuilder.deltaY());
533 } 543 }
534 544
535 { 545 {
536 WebGestureEvent webGestureEvent; 546 WebGestureEvent webGestureEvent;
537 webGestureEvent.type = WebInputEvent::GestureTap; 547 webGestureEvent.type = WebInputEvent::GestureTap;
548 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
538 webGestureEvent.data.tap.width = 30; 549 webGestureEvent.data.tap.width = 30;
539 webGestureEvent.data.tap.height = 30; 550 webGestureEvent.data.tap.height = 30;
540 551
541 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 552 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
542 EXPECT_EQ(10, platformGestureBuilder.area().width()); 553 EXPECT_EQ(10, platformGestureBuilder.area().width());
543 EXPECT_EQ(10, platformGestureBuilder.area().height()); 554 EXPECT_EQ(10, platformGestureBuilder.area().height());
544 } 555 }
545 556
546 { 557 {
547 WebGestureEvent webGestureEvent; 558 WebGestureEvent webGestureEvent;
548 webGestureEvent.type = WebInputEvent::GestureTapUnconfirmed; 559 webGestureEvent.type = WebInputEvent::GestureTapUnconfirmed;
560 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
549 webGestureEvent.data.tap.width = 30; 561 webGestureEvent.data.tap.width = 30;
550 webGestureEvent.data.tap.height = 30; 562 webGestureEvent.data.tap.height = 30;
551 563
552 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 564 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
553 EXPECT_EQ(10, platformGestureBuilder.area().width()); 565 EXPECT_EQ(10, platformGestureBuilder.area().width());
554 EXPECT_EQ(10, platformGestureBuilder.area().height()); 566 EXPECT_EQ(10, platformGestureBuilder.area().height());
555 } 567 }
556 568
557 { 569 {
558 WebGestureEvent webGestureEvent; 570 WebGestureEvent webGestureEvent;
559 webGestureEvent.type = WebInputEvent::GestureTapDown; 571 webGestureEvent.type = WebInputEvent::GestureTapDown;
572 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
560 webGestureEvent.data.tapDown.width = 30; 573 webGestureEvent.data.tapDown.width = 30;
561 webGestureEvent.data.tapDown.height = 30; 574 webGestureEvent.data.tapDown.height = 30;
562 575
563 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 576 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
564 EXPECT_EQ(10, platformGestureBuilder.area().width()); 577 EXPECT_EQ(10, platformGestureBuilder.area().width());
565 EXPECT_EQ(10, platformGestureBuilder.area().height()); 578 EXPECT_EQ(10, platformGestureBuilder.area().height());
566 } 579 }
567 580
568 { 581 {
569 WebGestureEvent webGestureEvent; 582 WebGestureEvent webGestureEvent;
570 webGestureEvent.type = WebInputEvent::GestureShowPress; 583 webGestureEvent.type = WebInputEvent::GestureShowPress;
584 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
571 webGestureEvent.data.showPress.width = 30; 585 webGestureEvent.data.showPress.width = 30;
572 webGestureEvent.data.showPress.height = 30; 586 webGestureEvent.data.showPress.height = 30;
573 587
574 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 588 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
575 EXPECT_EQ(10, platformGestureBuilder.area().width()); 589 EXPECT_EQ(10, platformGestureBuilder.area().width());
576 EXPECT_EQ(10, platformGestureBuilder.area().height()); 590 EXPECT_EQ(10, platformGestureBuilder.area().height());
577 } 591 }
578 592
579 { 593 {
580 WebGestureEvent webGestureEvent; 594 WebGestureEvent webGestureEvent;
581 webGestureEvent.type = WebInputEvent::GestureLongPress; 595 webGestureEvent.type = WebInputEvent::GestureLongPress;
596 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
582 webGestureEvent.data.longPress.width = 30; 597 webGestureEvent.data.longPress.width = 30;
583 webGestureEvent.data.longPress.height = 30; 598 webGestureEvent.data.longPress.height = 30;
584 599
585 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 600 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
586 EXPECT_EQ(10, platformGestureBuilder.area().width()); 601 EXPECT_EQ(10, platformGestureBuilder.area().width());
587 EXPECT_EQ(10, platformGestureBuilder.area().height()); 602 EXPECT_EQ(10, platformGestureBuilder.area().height());
588 } 603 }
589 604
590 { 605 {
591 WebGestureEvent webGestureEvent; 606 WebGestureEvent webGestureEvent;
592 webGestureEvent.type = WebInputEvent::GestureTwoFingerTap; 607 webGestureEvent.type = WebInputEvent::GestureTwoFingerTap;
608 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
593 webGestureEvent.data.twoFingerTap.firstFingerWidth = 30; 609 webGestureEvent.data.twoFingerTap.firstFingerWidth = 30;
594 webGestureEvent.data.twoFingerTap.firstFingerHeight = 30; 610 webGestureEvent.data.twoFingerTap.firstFingerHeight = 30;
595 611
596 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 612 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
597 EXPECT_EQ(10, platformGestureBuilder.area().width()); 613 EXPECT_EQ(10, platformGestureBuilder.area().width());
598 EXPECT_EQ(10, platformGestureBuilder.area().height()); 614 EXPECT_EQ(10, platformGestureBuilder.area().height());
599 } 615 }
600 616
601 { 617 {
602 WebTouchEvent webTouchEvent; 618 WebTouchEvent webTouchEvent;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 webViewImpl->layout(); 650 webViewImpl->layout();
635 651
636 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); 652 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view();
637 RefPtrWillBeRawPtr<Document> document = toLocalFrame(webViewImpl->page()->ma inFrame())->document(); 653 RefPtrWillBeRawPtr<Document> document = toLocalFrame(webViewImpl->page()->ma inFrame())->document();
638 LocalDOMWindow* domWindow = document->domWindow(); 654 LocalDOMWindow* domWindow = document->domWindow();
639 LayoutView* documentLayoutView = document->layoutView(); 655 LayoutView* documentLayoutView = document->layoutView();
640 656
641 { 657 {
642 WebGestureEvent webGestureEvent; 658 WebGestureEvent webGestureEvent;
643 webGestureEvent.type = WebInputEvent::GestureTap; 659 webGestureEvent.type = WebInputEvent::GestureTap;
660 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
644 webGestureEvent.x = 10; 661 webGestureEvent.x = 10;
645 webGestureEvent.y = 10; 662 webGestureEvent.y = 10;
646 webGestureEvent.globalX = 10; 663 webGestureEvent.globalX = 10;
647 webGestureEvent.globalY = 10; 664 webGestureEvent.globalY = 10;
648 webGestureEvent.data.tap.tapCount = 1; 665 webGestureEvent.data.tap.tapCount = 1;
649 webGestureEvent.data.tap.width = 10; 666 webGestureEvent.data.tap.width = 10;
650 webGestureEvent.data.tap.height = 10; 667 webGestureEvent.data.tap.height = 10;
651 668
652 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 669 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
653 EXPECT_EQ(10.f, platformGestureBuilder.position().x()); 670 EXPECT_EQ(10.f, platformGestureBuilder.position().x());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 PlatformWheelEventBuilder platformWheelBuilder(view, webMouseWheelEvent) ; 734 PlatformWheelEventBuilder platformWheelBuilder(view, webMouseWheelEvent) ;
718 EXPECT_EQ(5 + visualOffset.x(), platformWheelBuilder.position().x()); 735 EXPECT_EQ(5 + visualOffset.x(), platformWheelBuilder.position().x());
719 EXPECT_EQ(5 + visualOffset.y(), platformWheelBuilder.position().y()); 736 EXPECT_EQ(5 + visualOffset.y(), platformWheelBuilder.position().y());
720 EXPECT_EQ(10, platformWheelBuilder.globalPosition().x()); 737 EXPECT_EQ(10, platformWheelBuilder.globalPosition().x());
721 EXPECT_EQ(10, platformWheelBuilder.globalPosition().y()); 738 EXPECT_EQ(10, platformWheelBuilder.globalPosition().y());
722 } 739 }
723 740
724 { 741 {
725 WebGestureEvent webGestureEvent; 742 WebGestureEvent webGestureEvent;
726 webGestureEvent.type = WebInputEvent::GestureScrollUpdate; 743 webGestureEvent.type = WebInputEvent::GestureScrollUpdate;
744 webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
727 webGestureEvent.x = 10; 745 webGestureEvent.x = 10;
728 webGestureEvent.y = 10; 746 webGestureEvent.y = 10;
729 webGestureEvent.globalX = 10; 747 webGestureEvent.globalX = 10;
730 webGestureEvent.globalY = 10; 748 webGestureEvent.globalY = 10;
731 749
732 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent ); 750 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
733 EXPECT_EQ(5 + visualOffset.x(), platformGestureBuilder.position().x()); 751 EXPECT_EQ(5 + visualOffset.x(), platformGestureBuilder.position().x());
734 EXPECT_EQ(5 + visualOffset.y(), platformGestureBuilder.position().y()); 752 EXPECT_EQ(5 + visualOffset.y(), platformGestureBuilder.position().y());
735 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); 753 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x());
736 EXPECT_EQ(10, platformGestureBuilder.globalPosition().y()); 754 EXPECT_EQ(10, platformGestureBuilder.globalPosition().y());
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 EXPECT_EQ(15, platformWheelBuilder.deltaX()); 987 EXPECT_EQ(15, platformWheelBuilder.deltaX());
970 EXPECT_EQ(10, platformWheelBuilder.deltaY()); 988 EXPECT_EQ(10, platformWheelBuilder.deltaY());
971 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers()); 989 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers());
972 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); 990 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas());
973 EXPECT_FALSE(platformWheelBuilder.canScroll()); 991 EXPECT_FALSE(platformWheelBuilder.canScroll());
974 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert ical); 992 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert ical);
975 } 993 }
976 } 994 }
977 995
978 } // namespace blink 996 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebFrameTest.cpp ('k') | third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698