From bf6b20b25042dc6eb54f82ced56e839043f6fdeb Mon Sep 17 00:00:00 2001 From: Lan Wei Date: Thu, 21 May 2020 10:22:59 +0000 Subject: [PATCH] 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 Commit-Queue: Lan Wei Cr-Commit-Position: refs/heads/master@{#769399} -- wpt-commits: 71f24a0e457c86fba453e234d4de5aa635fb2d88 wpt-pr: 23614 --- .../pointerlock/pointerevent_movementxy.html | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/testing/web-platform/tests/pointerevents/pointerlock/pointerevent_movementxy.html b/testing/web-platform/tests/pointerevents/pointerlock/pointerevent_movementxy.html index 260ef4829cba..eb944460192c 100644 --- a/testing/web-platform/tests/pointerevents/pointerlock/pointerevent_movementxy.html +++ b/testing/web-platform/tests/pointerevents/pointerlock/pointerevent_movementxy.html @@ -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"); }