Bug 1689440 [wpt PR 27373] - Simulate user inputs in css-scroll-snap/snap-at-user-scroll-end.html, a=testonly

Automatic update from web-platform-tests
Simulate user inputs in css-scroll-snap/snap-at-user-scroll-end.html

Use testdriver Action API to simulate wheel scroll actions in
css/css-scroll-snap/snap-at-user-scroll-end.html.

Bug: 1145677
Change-Id: I98e121d71257c2f64244bfee48821fc65a988097
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2569986
Commit-Queue: Lan Wei <lanwei@chromium.org>
Reviewed-by: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#856129}

--

wpt-commits: 7af9d6ec48ab04043a2bea85a3599904a1a19efa
wpt-pr: 27373
This commit is contained in:
Lan Wei 2021-02-22 21:56:43 +00:00 коммит произвёл moz-wptsync-bot
Родитель e0e48f6705
Коммит c6fdebb0d2
1 изменённых файлов: 22 добавлений и 1 удалений

Просмотреть файл

@ -3,6 +3,10 @@
<title>Tests that window should snap at user scroll end.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="support/common.js"></script>
<style>
html {
margin: 0px;
@ -55,6 +59,9 @@ var scrolled_x = false;
var scrolled_y = false;
var start_x = window.scrollX;
var start_y = window.scrollY;
var actions_promise;
scrollTop = () => window.scrollY;
window.onscroll = function() {
if (scrolled_x && scrolled_y) {
@ -84,7 +91,21 @@ button.onclick = function() {
// To make the test result visible.
var content = document.getElementById("content");
body.removeChild(content);
snap_test.done();
actions_promise.then( () => {
snap_test.done();
});
}
// Inject scroll actions.
const pos_x = 20;
const pos_y = 20;
const scroll_delta_x = 100;
const scroll_delta_y = 100;
actions_promise = new test_driver.Actions()
.scroll(pos_x, pos_y, scroll_delta_x, scroll_delta_y)
.send().then(() => {
return waitForAnimationEnd(scrollTop);
}).then(() => {
return test_driver.click(button);
});
</script>