From 141355652222891dafe363fdb4e44209ae0a8ab5 Mon Sep 17 00:00:00 2001 From: Blink WPT Bot Date: Mon, 11 Jul 2022 06:32:07 -0700 Subject: [PATCH] Fix flaky test memory leak (#34723) event-timing-test-utils.js tap() has some unknown flaky memory leak issue related to test_driver.Actions(), while test_driver also has a built in function for click which doesn't cause any memory leak. This commit replace tap with click to fix the memory leak and re-enable the disabled test. Test coverage for tap will be added later once Bug 1338420 is fixed. Also added helper function addListenersAndClick() to reduce repetitive patterns between tests. Bug: 1335002 Change-Id: Ic2670288e596ff5eac8f1e742e395717bdabde5c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3747288 Reviewed-by: Lan Wei Commit-Queue: Aoyuan Zuo Reviewed-by: Michal Mocny Cr-Commit-Position: refs/heads/main@{#1021762} Co-authored-by: Aoyuan Zuo --- ....html => first-input-interactionid-click.html} | 10 ++++------ event-timing/interactionid-click.html | 15 ++------------- event-timing/resources/event-timing-test-utils.js | 7 +++++++ 3 files changed, 13 insertions(+), 19 deletions(-) rename event-timing/{first-input-interactionid-tap.html => first-input-interactionid-click.html} (81%) diff --git a/event-timing/first-input-interactionid-tap.html b/event-timing/first-input-interactionid-click.html similarity index 81% rename from event-timing/first-input-interactionid-tap.html rename to event-timing/first-input-interactionid-click.html index c5c6f5177ebd98..7295e35b5de4c0 100644 --- a/event-timing/first-input-interactionid-tap.html +++ b/event-timing/first-input-interactionid-click.html @@ -1,13 +1,11 @@ - -Event Timing: first-input-interactionId-tap. - +First Input: interactionId-click. + - @@ -49,8 +47,8 @@ } })).observe({ entryTypes: ["event", "first-input"] }); - addListenersAndTap(document.getElementById('test'), ['pointerdown', 'pointerup']); - }, "Event Timing: The interactionId of first input should match the event timing pointerdown entry when tap."); + addListenersAndClick(document.getElementById('testButtonId')); + }, "The interactionId of the first input entry should match the same pointerdown entry of event timing when click."); diff --git a/event-timing/interactionid-click.html b/event-timing/interactionid-click.html index a43f9a2a4b479d..f0d32e63aefbf3 100644 --- a/event-timing/interactionid-click.html +++ b/event-timing/interactionid-click.html @@ -11,18 +11,7 @@ diff --git a/event-timing/resources/event-timing-test-utils.js b/event-timing/resources/event-timing-test-utils.js index c549e7ebf616d6..f60bfb21afb81b 100644 --- a/event-timing/resources/event-timing-test-utils.js +++ b/event-timing/resources/event-timing-test-utils.js @@ -314,6 +314,13 @@ async function addListenersAndPress(element, key, events) { pressKey(element, key); } +// The testdriver.js, testdriver-vendor.js need to be included to use this +// function. +async function addListenersAndClick(element) { + addListeners(element, ['mousedown', 'mouseup', 'pointerdown', 'pointerup', 'click']); + await test_driver.click(element); +} + function filterAndAddToMap(events, map) { return function (entry) { if (events.includes(entry.name)) {