Commit d916caa6 authored by nzolghadr's avatar nzolghadr Committed by Commit bot

Add delay promise and change automation scripts

Also update the scroll an element into the view
as it may cause some internal div to scroll
and fail the test.

BUG=643215

Review-Url: https://codereview.chromium.org/2319133002
Cr-Commit-Position: refs/heads/master@{#417598}
parent 2ded0b9b
...@@ -817,13 +817,13 @@ crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-pa ...@@ -817,13 +817,13 @@ crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-pa
crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-pan-down-css_touch-manual.html [ Skip ] crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-pan-down-css_touch-manual.html [ Skip ]
crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-pan-x-pan-y_touch-manual.html [ Skip ] crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-pan-x-pan-y_touch-manual.html [ Skip ]
crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-pan-x-css_touch-manual.html [ Skip ] crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-pan-x-css_touch-manual.html [ Skip ]
#crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-button-test_touch-manual.html [ Skip ] crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-button-test_touch-manual.html [ Skip ]
#crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-table-test_touch-manual.html [ Skip ] crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-table-test_touch-manual.html [ Skip ]
crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-pan-x-pan-y-pan-y_touch-manual.html [ Skip ] crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-pan-x-pan-y-pan-y_touch-manual.html [ Skip ]
crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-pan-y-css_touch-manual.html [ Skip ] crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-pan-y-css_touch-manual.html [ Skip ]
crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-inherit_highest-parent-none_touch-manual.html [ Skip ] crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-inherit_highest-parent-none_touch-manual.html [ Skip ]
#crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-span-test_touch-manual.html [ Skip ] crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-span-test_touch-manual.html [ Skip ]
#crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-svg-test_touch-manual.html [ Skip ] crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-svg-test_touch-manual.html [ Skip ]
crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-inherit_child-pan-x-child-pan-x_touch-manual.html [ Skip ] crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-inherit_child-pan-x-child-pan-x_touch-manual.html [ Skip ]
crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-none-css_touch-manual.html [ Skip ] crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-none-css_touch-manual.html [ Skip ]
crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-inherit_parent-none_touch-manual.html [ Skip ] crbug.com/613672 [ Mac ] imported/wpt/pointerevents/pointerevent_touch-action-inherit_parent-none_touch-manual.html [ Skip ]
...@@ -837,12 +837,6 @@ crbug.com/613672 [ Mac ] virtual/scalefactor150/fast/events/synthetic-events/tap ...@@ -837,12 +837,6 @@ crbug.com/613672 [ Mac ] virtual/scalefactor150/fast/events/synthetic-events/tap
crbug.com/629722 imported/wpt/pointerevents/pointerevent_lostpointercapture_is_first-manual.html [ Skip ] crbug.com/629722 imported/wpt/pointerevents/pointerevent_lostpointercapture_is_first-manual.html [ Skip ]
crbug.com/629722 imported/wpt/pointerevents/pointerevent_lostpointercapture_for_disconnected_node-manual.html [ Skip ] crbug.com/629722 imported/wpt/pointerevents/pointerevent_lostpointercapture_for_disconnected_node-manual.html [ Skip ]
# These tests are using timeouts and might be flaky sometimes
crbug.com/643215 imported/wpt/pointerevents/pointerevent_touch-action-button-test_touch-manual.html [ Skip ]
crbug.com/643215 imported/wpt/pointerevents/pointerevent_touch-action-span-test_touch-manual.html [ Skip ]
crbug.com/643215 imported/wpt/pointerevents/pointerevent_touch-action-svg-test_touch-manual.html [ Skip ]
crbug.com/643215 imported/wpt/pointerevents/pointerevent_touch-action-table-test_touch-manual.html [ Skip ]
# There is no assoicated JS file to support automated user inputs. # There is no assoicated JS file to support automated user inputs.
crbug.com/629724 imported/wpt/pointerevents/pointerevent_suppress_compat_events_on_click.html [ Skip ] crbug.com/629724 imported/wpt/pointerevents/pointerevent_suppress_compat_events_on_click.html [ Skip ]
crbug.com/629724 imported/wpt/pointerevents/pointerevent_suppress_compat_events_on_drag_mouse.html [ Skip ] crbug.com/629724 imported/wpt/pointerevents/pointerevent_suppress_compat_events_on_drag_mouse.html [ Skip ]
......
...@@ -2,6 +2,20 @@ ...@@ -2,6 +2,20 @@
const scrollOffset = 30; const scrollOffset = 30;
const boundaryOffset = 5; const boundaryOffset = 5;
const touchSourceType = 1;
function delayPromise(delay) {
return new Promise(function(resolve, reject) {
window.setTimeout(resolve, delay);
});
}
function scrollPageIfNeeded(targetSelector) {
var target = document.querySelector(targetSelector);
var targetRect = target.getBoundingClientRect();
if (targetRect.top < 0 || targetRect.left < 0 || targetRect.bottom > window.innerHeight || targetRect.right > window.innerWidth)
window.scrollTo(targetRect.left, targetRect.top);
}
// Mouse inputs. // Mouse inputs.
function mouseMoveToDocument() { function mouseMoveToDocument() {
...@@ -82,8 +96,8 @@ function mouseWheelScroll(direction) { ...@@ -82,8 +96,8 @@ function mouseWheelScroll(direction) {
function touchTapInTarget(targetSelector) { function touchTapInTarget(targetSelector) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
if (window.chrome && chrome.gpuBenchmarking) { if (window.chrome && chrome.gpuBenchmarking) {
scrollPageIfNeeded(targetSelector);
var target = document.querySelector(targetSelector); var target = document.querySelector(targetSelector);
target.scrollIntoViewIfNeeded();
var targetRect = target.getBoundingClientRect(); var targetRect = target.getBoundingClientRect();
chrome.gpuBenchmarking.tap(targetRect.left + boundaryOffset, targetRect.top + boundaryOffset, function() { chrome.gpuBenchmarking.tap(targetRect.left + boundaryOffset, targetRect.top + boundaryOffset, function() {
resolve(); resolve();
...@@ -97,12 +111,12 @@ function touchTapInTarget(targetSelector) { ...@@ -97,12 +111,12 @@ function touchTapInTarget(targetSelector) {
function touchScrollInTarget(targetSelector, direction) { function touchScrollInTarget(targetSelector, direction) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
if (window.chrome && chrome.gpuBenchmarking) { if (window.chrome && chrome.gpuBenchmarking) {
scrollPageIfNeeded(targetSelector);
var target = document.querySelector(targetSelector); var target = document.querySelector(targetSelector);
target.scrollIntoViewIfNeeded();
var targetRect = target.getBoundingClientRect(); var targetRect = target.getBoundingClientRect();
chrome.gpuBenchmarking.smoothScrollBy(scrollOffset, function() { chrome.gpuBenchmarking.smoothScrollBy(scrollOffset, function() {
resolve(); resolve();
}, targetRect.left + boundaryOffset, targetRect.top + boundaryOffset, 1, direction); }, targetRect.left + boundaryOffset, targetRect.top + boundaryOffset, touchSourceType, direction);
} else { } else {
reject(); reject();
} }
...@@ -172,3 +186,4 @@ function keyboardScroll(direction) { ...@@ -172,3 +186,4 @@ function keyboardScroll(direction) {
pointerevent_automation.done(); pointerevent_automation.done();
}); });
} }
importAutomationScript('/pointerevents/pointerevent_common_input.js'); importAutomationScript('/pointerevents/pointerevent_common_input.js');
function callback_function() {
window.setTimeout(function() {
touchTapInTarget('btnComplete');}
, scrollReturnInterval);
}
function inject_input() { function inject_input() {
var target = document.getElementById("target0"); return touchScrollInTarget('#target0', 'down').then(function() {
var targetRect = target.getBoundingClientRect(); return touchScrollInTarget('#target0', 'right');
}).then(function() {
var button = document.getElementsByTagName("button")[0]; return delayPromise(4*scrollReturnInterval);
var buttonRect = button.getBoundingClientRect(); }).then(function() {
return touchScrollInTarget('#testButton', 'down');
var x = (buttonRect.left - targetRect.left)/2; }).then(function() {
touchScrollByPosition(x, targetRect.top + 100, 30, "down"); return touchScrollInTarget('#testButton', 'right');
touchScrollByPosition(x, targetRect.top + 100, 30, "right", callback_function); }).then(function() {
touchTapInTarget('#btnComplete');
window.setTimeout(function() { });
touchSmoothScrollUp(button); }
touchSmoothScrollLeft(button, callback_function);
} , 4*scrollReturnInterval);
}
\ No newline at end of file
importAutomationScript('/pointerevents/pointerevent_common_input.js'); importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() { function inject_input() {
return touchScrollInTarget('#target0 > div > div > p', 'down').then(function() { return touchScrollInTarget('#target0 > div > div', 'down').then(function() {
return touchScrollInTarget('#target0 > div > div > p', 'right'); return touchScrollInTarget('#target0 > div > div', 'right');
}).then(function() { }).then(function() {
return touchTapInTarget('#btnComplete'); return touchTapInTarget('#btnComplete');
}); });
......
importAutomationScript('/pointerevents/pointerevent_common_input.js'); importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() { function inject_input() {
return touchScrollInTarget('#target0 > div > p', 'down').then(function() { return touchScrollInTarget('#target0 > div', 'down').then(function() {
return touchScrollInTarget('#target0 > div > p', 'right'); return touchScrollInTarget('#target0 > div', 'right');
}).then(function() { }).then(function() {
return touchTapInTarget('#btnComplete'); return touchTapInTarget('#btnComplete');
}); });
......
importAutomationScript('/pointerevents/pointerevent_common_input.js'); importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() { function inject_input() {
return touchScrollInTarget('#target0 > div > div > p', 'down').then(function() { return touchScrollInTarget('#target0 > div > div', 'down').then(function() {
return touchScrollInTarget('#target0 > div > div > p', 'right'); return touchScrollInTarget('#target0 > div > div', 'right');
}).then(function() { }).then(function() {
return touchTapInTarget('#btnComplete'); return touchTapInTarget('#btnComplete');
}); });
......
importAutomationScript('/pointerevents/pointerevent_common_input.js'); importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() { function inject_input() {
return touchScrollInTarget('#target0 > div > div > p', 'down').then(function() { return touchScrollInTarget('#target0 > div > div', 'down').then(function() {
return touchScrollInTarget('#target0 > div > div > p', 'right'); return touchScrollInTarget('#target0 > div > div', 'right');
}).then(function() { }).then(function() {
return touchTapInTarget('#btnComplete'); return touchTapInTarget('#btnComplete');
}); });
......
importAutomationScript('/pointerevents/pointerevent_common_input.js'); importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() { function inject_input() {
return touchScrollInTarget('#target0 > div > p', 'down').then(function() { return touchScrollInTarget('#target0 > div', 'down').then(function() {
return touchScrollInTarget('#target0 > div > p', 'right'); return touchScrollInTarget('#target0 > div', 'right');
}); });
} }
importAutomationScript('/pointerevents/pointerevent_common_input.js'); importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() { function inject_input() {
return touchScrollInTarget('#target0 > div > p', 'down').then(function() { return touchScrollInTarget('#target0 > div', 'down').then(function() {
return touchScrollInTarget('#target0 > div > p', 'right'); return touchScrollInTarget('#target0 > div', 'right');
}).then(function() { }).then(function() {
return touchTapInTarget('#btnComplete'); return touchTapInTarget('#btnComplete');
}); });
......
importAutomationScript('/pointerevents/pointerevent_common_input.js'); importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() { function inject_input() {
return touchScrollInTarget('#target0 > div > div > p', 'down').then(function() { return touchScrollInTarget('#target0 > div > div', 'down').then(function() {
return touchScrollInTarget('#target0 > div > div > p', 'right'); return touchScrollInTarget('#target0 > div > div', 'right');
}).then(function() { }).then(function() {
return touchTapInTarget('#btnComplete'); return touchTapInTarget('#btnComplete');
}); });
......
importAutomationScript('/pointerevents/pointerevent_common_input.js'); importAutomationScript('/pointerevents/pointerevent_common_input.js');
function callback_function() {
touchTapInTarget('btnComplete');
}
function inject_input() { function inject_input() {
var target = document.getElementById("target0"); return touchScrollInTarget('#target0', 'down').then(function() {
var targetRect = target.getBoundingClientRect(); return touchScrollInTarget('#target0', 'right');
}).then(function() {
var span = document.getElementsByTagName("span")[0]; return delayPromise(4*scrollReturnInterval);
var spanRect = span.getBoundingClientRect(); }).then(function() {
return touchScrollInTarget('#target0 > span', 'down');
var x = (spanRect.left - targetRect.left)/2; }).then(function() {
touchScrollByPosition(x, targetRect.top + 100, 30, "down"); return touchScrollInTarget('#target0 > span', 'right');
touchScrollByPosition(x, targetRect.top + 100, 30, "right"); }).then(function() {
touchTapInTarget('#btnComplete');
window.setTimeout(function() { });
touchSmoothScrollUp(span); }
touchSmoothScrollLeft(span, callback_function);
} , 6*scrollReturnInterval);
}
\ No newline at end of file
importAutomationScript('/pointerevents/pointerevent_common_input.js'); importAutomationScript('/pointerevents/pointerevent_common_input.js');
function callback_function() {
touchTapInTarget('btnComplete');
}
function inject_input() { function inject_input() {
var target = document.getElementById("target0"); return touchScrollInTarget('#target0', 'down').then(function() {
var targetRect = target.getBoundingClientRect(); return touchScrollInTarget('#target0', 'right');
}).then(function() {
var svg = document.getElementsByTagName("svg")[0]; return delayPromise(4*scrollReturnInterval);
var svgRect = svg.getBoundingClientRect(); }).then(function() {
return touchScrollInTarget('#target0 > svg', 'down');
var x = (svgRect.left - targetRect.left)/2; }).then(function() {
touchScrollByPosition(x, targetRect.top + 100, 30, "down"); return touchScrollInTarget('#target0 > svg', 'right');
touchScrollByPosition(x, targetRect.top + 100, 30, "right"); }).then(function() {
touchTapInTarget('#btnComplete');
window.setTimeout(function() { });
touchSmoothScrollUp(svg); }
touchSmoothScrollLeft(svg, callback_function);
} , 4*scrollReturnInterval);
}
\ No newline at end of file
importAutomationScript('/pointerevents/pointerevent_common_input.js'); importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() { function inject_input() {
touchScrollInTarget('row1', 'down'); return touchScrollInTarget('#row1', 'down').then(function() {
window.setTimeout(function() { return touchScrollInTarget('#row1', 'right');
touchScrollInTarget('row1', 'right'); }).then(function() {
window.setTimeout(function() { return delayPromise(4*scrollReturnInterval);
touchScrollInTarget('cell3', 'down').then(function() { }).then(function() {
return touchScrollInTarget('cell3', 'right'); return touchScrollInTarget('#cell3', 'down');
}).then(function() { }).then(function() {
touchTapInTarget('btnComplete'); return touchScrollInTarget('#cell3', 'right');
}); }).then(function() {
} , 2 * scrollReturnInterval); touchTapInTarget('#btnComplete');
} , 2 * scrollReturnInterval); });
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment