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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js

Issue 2842483002: Set relatedtarget for dragleave/enter events (Closed)
Patch Set: Add event sender input automation Created 3 years, 7 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 // This file contains the commonly used functions in pointerevent tests. 1 // This file contains the commonly used functions in pointerevent tests.
2 2
3 const scrollOffset = 20; 3 const scrollOffset = 20;
4 const boundaryOffset = 2; 4 const boundaryOffset = 2;
5 5
6 function delayPromise(delay) { 6 function delayPromise(delay) {
7 return new Promise(function(resolve, reject) { 7 return new Promise(function(resolve, reject) {
8 window.setTimeout(resolve, delay); 8 window.setTimeout(resolve, delay);
9 }); 9 });
10 } 10 }
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 { name: 'pointerMove', x: xPosition, y: yPosition }, 433 { name: 'pointerMove', x: xPosition, y: yPosition },
434 { name: 'pointerDown', x: xPosition, y: yPosition }, 434 { name: 'pointerDown', x: xPosition, y: yPosition },
435 { name: 'pointerUp' } 435 { name: 'pointerUp' }
436 ]}], resolve); 436 ]}], resolve);
437 } else { 437 } else {
438 reject(); 438 reject();
439 } 439 }
440 }); 440 });
441 } 441 }
442 442
443 // Drag and drop actions
444 function mouseDragAndDropInTargets(targetSelectorList) {
445 return new Promise(function(resolve, reject) {
446 if (window.eventSender) {
447 scrollPageIfNeeded(targetSelectorList[0], document);
448 var target = document.querySelector(targetSelectorList[0]);
449 var targetRect = target.getBoundingClientRect();
450 var xPosition = targetRect.left + boundaryOffset;
451 var yPosition = targetRect.top + boundaryOffset;
452 eventSender.mouseMoveTo(xPosition, yPosition);
453 eventSender.mouseDown();
454 eventSender.leapForward(100);
455 for (var i = 1; i < targetSelectorList.length; i++) {
456 scrollPageIfNeeded(targetSelectorList[i], document);
457 target = document.querySelector(targetSelectorList[i]);
458 targetRect = target.getBoundingClientRect();
459 xPosition = targetRect.left + boundaryOffset;
460 yPosition = targetRect.top + boundaryOffset;
461 eventSender.mouseMoveTo(xPosition, yPosition);
462 }
463 eventSender.mouseUp();
464 resolve();
465 } else {
466 reject();
467 }
468 });
469 }
470
443 // Keyboard inputs. 471 // Keyboard inputs.
444 function keyboardScroll(direction) { 472 function keyboardScroll(direction) {
445 return new Promise(function(resolve, reject) { 473 return new Promise(function(resolve, reject) {
446 if (window.eventSender) { 474 if (window.eventSender) {
447 if (direction == 'down') 475 if (direction == 'down')
448 eventSender.keyDown('ArrowDown'); 476 eventSender.keyDown('ArrowDown');
449 else if (direction == 'right') 477 else if (direction == 'right')
450 eventSender.keyDown('ArrowRight'); 478 eventSender.keyDown('ArrowRight');
451 else 479 else
452 reject(); 480 reject();
(...skipping 28 matching lines...) Expand all
481 }); 509 });
482 } 510 }
483 511
484 { 512 {
485 var pointerevent_automation = async_test("PointerEvent Automation"); 513 var pointerevent_automation = async_test("PointerEvent Automation");
486 // Defined in every test and should return a promise that gets resolved when i nput is finished. 514 // Defined in every test and should return a promise that gets resolved when i nput is finished.
487 inject_input().then(function() { 515 inject_input().then(function() {
488 pointerevent_automation.done(); 516 pointerevent_automation.done();
489 }); 517 });
490 } 518 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698