From c2397abe2c586730f384fb9695499126a34ebe31 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Sun, 1 Dec 2024 01:14:01 +0000 Subject: [PATCH] Bug 1932883 [wpt PR 49331] - Refactor pointerevents_iframe-touch-action-none, a=testonly Automatic update from web-platform-tests Refactor pointerevents_iframe-touch-action-none Problems in the test: * onload only ensures the parent frame is loaded and not the child frame. Fix by explicitly triggering load of the child frame and waiting on completion. * assumes message from child frame will be posted and processed by the time the button is pressed, but this can happen too quickly. Fix by waiting on a message promise from the child frame. * concatenation of events from the child frame is needlessly convoluted and likely the result of copy-paste from another test. 1 flake over 100 runs without fix. 0 flakes over 600 runs with the fix. Bug: 40770210 Change-Id: Icf6640ee87b0d85f93bfa0753794545f1c302462 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6035259 Reviewed-by: Mustaq Ahmed Commit-Queue: Kevin Ellis Cr-Commit-Position: refs/heads/main{#1386777} -- wpt-commits: 97bfee7308f1b4d2443ea91056be7867fb3d8f18 wpt-pr: 49331 UltraBlame original commit: 3a7738e120e8f694700a0b91e30b7b7f5d8f3ca4 --- ...revent_iframe-touch-action-none_touch.html | 332 +++++++----------- 1 file changed, 133 insertions(+), 199 deletions(-) diff --git a/testing/web-platform/tests/pointerevents/pointerevent_iframe-touch-action-none_touch.html b/testing/web-platform/tests/pointerevents/pointerevent_iframe-touch-action-none_touch.html index a983d7f6d1144..40ced4a5480da 100644 --- a/testing/web-platform/tests/pointerevents/pointerevent_iframe-touch-action-none_touch.html +++ b/testing/web-platform/tests/pointerevents/pointerevent_iframe-touch-action-none_touch.html @@ -13,7 +13,15 @@ action : none -attribute +does +not +prevent +panning +or +zooming +inside +the +iframe < / title @@ -165,14 +173,23 @@ head > < +style +> +iframe +{ +touch +- +action +: +none +; +} +< +/ +style +> +< body -onload -= -" -run -( -) -" > < h1 @@ -201,32 +218,6 @@ h2 > < -h4 -> -Test -Description -: -Drag -your -finger -in -the -green -rectangle -below -then -tap -the -" -Done -" -button -. -< -/ -h4 -> -< br > < @@ -236,195 +227,103 @@ " target " -style -= -" -touch -- -action -: -none -; -" -src -= -" -resources -/ -iframe -- -touch -- -action -- -none -- -subframe -. -html -" > < / iframe > < -input -type -= -" -button -" -id -= -" -btnDone -" -value -= -" -Done -" -> -< / body > < script > -var -event_log -= -[ -] +' +use +strict +' ; function -resetTestState +loadFrame ( ) { -event_log -= -[ -] -; -} -function -run +return +new +Promise ( -) -{ -var -test_pointerEvent +resolve = -setup_pointerevent_test -( -" -iframe -received -pointercancel -" -[ -" -touch -" -] -) -; -var -actions_promise -; -var -target +> +{ +const +frame = document . getElementById ( -" +' target -" +' ) ; -on_event -( -document +frame . -getElementById -( -" -btnDone -" -) -" -click -" -( -) +onload = -> -{ -test_pointerEvent +resolve +; +frame . -step -( -( -) +src = -> -{ -assert_equals -( -event_log +' +resources +/ +iframe +- +touch +- +action +- +none +- +subframe . -join -( -" -" -) -" -pointercancel -" -" -exactly -one -pointercancel -received -" -) +html +' ; } ) ; -actions_promise -. -then -( +} +function +messageReceived ( ) +{ +return +new +Promise +( +resolve = > -test_pointerEvent +{ +window . -done -( -) -) -; -} -) -; -on_event +addEventListener ( -window -" +' message -" -function +' ( event ) += +> { if ( @@ -462,9 +361,7 @@ " ) { -event_log -. -push +resolve ( event . @@ -477,8 +374,42 @@ } ) ; -actions_promise +} +) +; +} +promise_test +( +async +t = +> +{ +const +target += +document +. +getElementById +( +" +target +" +) +; +await +loadFrame +( +) +; +const +messagePromise += +messageReceived +( +) +; +await new test_driver . @@ -526,30 +457,33 @@ ( ) . -pointerMove -( -0 -0 -{ -origin -: -btnDone -} -) -. -pointerDown -( -) -. -pointerUp +send ( ) -. -send +; +const +eventType += +await +messagePromise +; +assert_equals ( +eventType +' +pointercancel +' ) ; } +' +touch +iframe +received +pointercancel +' +) +; < / script