Bug 1638121 [wpt PR 23614] - De-flaky pointerlock/pointerevent_movementxy.html, a=testonly

Automatic update from web-platform-tests
De-flaky pointerlock/pointerevent_movementxy.html

Because of Linux memory leak, pointerevent wpt tests
pointerlock/pointerevent_movementxy.html is flaky, we should finish the
test in the actions promise's callback to guarantee the actions are all
executed before the test finishes to avoid memory leak.

Bug: 998948
Change-Id: I483ea75e5081faedb5c59296d7c5d4f40b3f3880
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2200154
Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org>
Commit-Queue: Lan Wei <lanwei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#769399}

--

wpt-commits: 71f24a0e457c86fba453e234d4de5aa635fb2d88
wpt-pr: 23614
This commit is contained in:
Lan Wei 2020-05-21 10:22:59 +00:00 коммит произвёл moz-wptsync-bot
Родитель 640181b148
Коммит bf6b20b250
1 изменённых файлов: 21 добавлений и 7 удалений

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

@ -40,6 +40,9 @@
var expectedPointerId = NaN;
var lastScreenX = null;
var lastScreenY = null;
var actionsPromiseMouse;
var actionsPromiseTouch;
var actionsPromisePen;
function resetTestState() {
lastScreenX = null;
@ -111,15 +114,26 @@
lastScreenY = event.screenY;
});
on_event(document.querySelector('#box2'), 'pointerup', function(event) {
test_pointerEvent.done();
// Make sure the test finishes after all the input actions are completed.
if (expectedPointerType == "mouse") {
actionsPromiseTouch = actionsPromiseMouse.then(function(){
test_pointerEvent.done();
return injectInput("touch");
});
} else if (expectedPointerType == "touch") {
actionsPromisePen = actionsPromiseTouch.then(function(){
test_pointerEvent.done();
return injectInput("pen");
});
} else {
actionsPromisePen.then( () => {
test_pointerEvent.done();
});
}
});
// Inject input
injectInput("mouse").then(function(){
return injectInput("touch")
}).then(function() {
return injectInput("pen")
})
// Inject mouse input
actionsPromiseMouse = injectInput("mouse");
}
</script>