WebKit Bugzilla
Attachment 369163 Details for
Bug 197624
: Tests under pointerevents/ios are flaky
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197624-20190506222051.patch (text/plain), 22.07 KB, created by
Antoine Quint
on 2019-05-06 13:20:53 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Antoine Quint
Created:
2019-05-06 13:20:53 PDT
Size:
22.07 KB
patch
obsolete
>Subversion Revision: 244956 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 93169fc697fa3b9f46806ec71c0f912cc9f25670..304d1f8ad4cd0440afd26264b298ac069c0f2385 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,44 @@ >+2019-05-06 Antoine Quint <graouts@apple.com> >+ >+ Tests under pointerevents/ios are flaky >+ https://bugs.webkit.org/show_bug.cgi?id=197624 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Tests under pointerevents/ios generate touches that use UIScriptController may not succeed if ran in multiple iterations or in a specific >+ order due to not ensuring that all touches are released when the test completes. We now ensure that we do when running swipes, taps, and pinches. >+ >+ * pointerevents/ios/pointer-events-dispatch-on-stylus.html: Use the new ui.tapStylus() method to generate a tap with the stylus which ensures all >+ touches are removed upon completion. >+ * pointerevents/ios/pointer-events-dispatch-on-touch.html: Use a tap to ensure all touches are removed upon completion. >+ * pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down.html: Use a tap to ensure all touches are removed upon completion. >+ * pointerevents/ios/pointer-events-implicit-capture-release-exception.html: Use a tap to ensure all touches are removed upon completion. >+ * pointerevents/ios/pointer-events-implicit-capture-release.html: Use a tap to ensure all touches are removed upon completion. >+ * pointerevents/ios/pointer-events-prevent-default-allows-click-event.html: Ensure both the "click" event and the tap generation have succeeded before >+ marking the test as complete. >+ * pointerevents/ios/pointer-events-set-pointer-capture-exceptions.html: Use a tap to ensure all touches are removed upon completion. >+ * pointerevents/ios/touch-action-none-link-traversal.html: Ensure both the "load" event and the tap generation have succeeded before marking the test >+ as complete. >+ * pointerevents/ios/touch-action-pan-x-pan-y.html: Remove the requestAnimationFrame() call since ui.swipe() now resolves its promise once all touches >+ have completed. >+ * pointerevents/ios/touch-action-pan-x.html: Remove the requestAnimationFrame() call since ui.swipe() now resolves its promise once all touches >+ have completed. >+ * pointerevents/ios/touch-action-pan-y.html: Remove the requestAnimationFrame() call since ui.swipe() now resolves its promise once all touches >+ have completed. >+ * pointerevents/ios/touch-action-pinch-zoom-allows-zooming.html: Remove the requestAnimationFrame() call since ui.pinchOut() now resolves its promise >+ once all touches have completed. >+ * pointerevents/ios/touch-action-pointercancel-pan-x.html: We don't need to track "pointermove" events since dispatch of "pointercancel" is asynchronous >+ and the number of "pointermove" events prior to its dispatch can legitimately vary. >+ * pointerevents/ios/touch-action-pointercancel-pan-y.html: We don't need to track "pointermove" events since dispatch of "pointercancel" is asynchronous >+ and the number of "pointermove" events prior to its dispatch can legitimately vary. >+ * pointerevents/utils.js: >+ (const.ui.new.UIController.prototype.swipe): Wait until the swipe is complete before resolving the promise. >+ (const.ui.new.UIController.prototype.pinchOut): Use a custom sequence to ensure that the pinch releases touches upon completion. >+ (const.ui.new.UIController.prototype.tapStylus): Introduce this new method to perform a stylus tap which ensures all touches are complete before resolving >+ the promise. >+ (const.ui.new.UIController.prototype.beginTouches): Deleted. >+ (const.ui.new.UIController.prototype.beginStylus): Deleted. >+ > 2019-05-04 Tadeu Zagallo <tzagallo@apple.com> > > TypedArrays should not store properties that are canonical numeric indices >diff --git a/LayoutTests/pointerevents/ios/pointer-events-dispatch-on-stylus.html b/LayoutTests/pointerevents/ios/pointer-events-dispatch-on-stylus.html >index f522931497881db9b50bc5bb321d13101ab1f273..6df32c7ddfc55f16c55eab5f00d94d0db405e5ba 100644 >--- a/LayoutTests/pointerevents/ios/pointer-events-dispatch-on-stylus.html >+++ b/LayoutTests/pointerevents/ios/pointer-events-dispatch-on-stylus.html >@@ -27,7 +27,7 @@ target_test((target, test) => { > assert_approx_equals(event.tiltY, 20, 1); > test.done(); > }); >- ui.beginStylus({ x: 50, y: 50, pressure: 0.75, azimuthAngle: fifteenDegrees, altitudeAngle: thirtyDegrees }); >+ ui.tapStylus({ x: 50, y: 50, pressure: 0.75, azimuthAngle: fifteenDegrees, altitudeAngle: thirtyDegrees }); > }, "Pointer events get dispatched in response to a stylus."); > > </script> >diff --git a/LayoutTests/pointerevents/ios/pointer-events-dispatch-on-touch.html b/LayoutTests/pointerevents/ios/pointer-events-dispatch-on-touch.html >index 5d4748cfbba6915def3b856b902e70dbcdbef670..3f711219ad6dcfbfe3a7ff54f65805844316a300 100644 >--- a/LayoutTests/pointerevents/ios/pointer-events-dispatch-on-touch.html >+++ b/LayoutTests/pointerevents/ios/pointer-events-dispatch-on-touch.html >@@ -21,7 +21,7 @@ target_test((target, test) => { > assert_equals(event.pointerType, "touch"); > test.done(); > }); >- ui.beginTouches({ x: 50, y: 50 }); >+ ui.tap({ x: 50, y: 50 }); > }, "Pointer events get dispatched in response to a touch."); > > </script> >diff --git a/LayoutTests/pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down.html b/LayoutTests/pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down.html >index 3587115d7eecbee09a4944d4fd7bc9247b98c743..8470cebddf6b2f4e3d1beb8917bb115c301901c6 100644 >--- a/LayoutTests/pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down.html >+++ b/LayoutTests/pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down.html >@@ -14,7 +14,7 @@ > > target_test((target, test) => { > target.addEventListener("pointerdown", event => assert_true(target.hasPointerCapture(event.pointerId))); >- ui.beginTouches({ x: 50, y: 50 }).then(() => test.done()); >+ ui.tap({ x: 50, y: 50 }).then(() => test.done()); > }, "Calling hasPointerCapture() in the 'pointerdown' event handler returns true for direct manipulation devices."); > > </script> >diff --git a/LayoutTests/pointerevents/ios/pointer-events-implicit-capture-release-exception.html b/LayoutTests/pointerevents/ios/pointer-events-implicit-capture-release-exception.html >index 8c9d1ec9870a16a65f9f52d2b27affdeb4e5c521..4d48e2f9ad85c26bfa8aebcb4cf6332e3bac7728 100644 >--- a/LayoutTests/pointerevents/ios/pointer-events-implicit-capture-release-exception.html >+++ b/LayoutTests/pointerevents/ios/pointer-events-implicit-capture-release-exception.html >@@ -18,7 +18,7 @@ target_test((target, test) => { > assert_throws("NotFoundError", () => target.releasePointerCapture(event.pointerId + 1)); > assert_true(target.hasPointerCapture(event.pointerId)); > }); >- ui.beginTouches({ x: 50, y: 50 }).then(() => test.done()); >+ ui.tap({ x: 50, y: 50 }).then(() => test.done()); > }, "Calling releasePointerCapture() in the 'pointerdown' event handler with a bogus pointer id raises an exception and does not alter pointer capture."); > > </script> >diff --git a/LayoutTests/pointerevents/ios/pointer-events-implicit-capture-release.html b/LayoutTests/pointerevents/ios/pointer-events-implicit-capture-release.html >index 0f3b673cf21f9c06b289bd9ac8d6dcf0ae0d1dec..d4ba0bfbb41ecbbf8e6a36b68f86828db3b6586b 100644 >--- a/LayoutTests/pointerevents/ios/pointer-events-implicit-capture-release.html >+++ b/LayoutTests/pointerevents/ios/pointer-events-implicit-capture-release.html >@@ -18,7 +18,7 @@ target_test((target, test) => { > target.releasePointerCapture(event.pointerId); > assert_false(target.hasPointerCapture(event.pointerId)); > }); >- ui.beginTouches({ x: 50, y: 50 }).then(() => test.done()); >+ ui.tap({ x: 50, y: 50 }).then(() => test.done()); > }, "Calling releasePointerCapture() in the 'pointerdown' event handler makes hasPointerCapture() return false."); > > </script> >diff --git a/LayoutTests/pointerevents/ios/pointer-events-prevent-default-allows-click-event.html b/LayoutTests/pointerevents/ios/pointer-events-prevent-default-allows-click-event.html >index a8ae94f46ee98737fb976e6cc3ed6a8c640ad38c..c3a9d5ae8e3ecbbbaa93f7e2901aa6d50d272355 100644 >--- a/LayoutTests/pointerevents/ios/pointer-events-prevent-default-allows-click-event.html >+++ b/LayoutTests/pointerevents/ios/pointer-events-prevent-default-allows-click-event.html >@@ -14,8 +14,9 @@ > > target_test((target, test) => { > target.addEventListener("pointerdown", event => event.preventDefault()); >- target.addEventListener("click", event => test.done()); >- ui.tap({ x: 100, y: 100 }); >+ const clicked = new Promise(resolve => target.addEventListener("click", resolve)); >+ const tapped = ui.tap({ x: 100, y: 100 }); >+ Promise.all([clicked, tapped]).then(() => test.done()); > }, "A 'click' event is dispatched when tapping even if preventDefault() was called for a pointer event."); > > </script> >diff --git a/LayoutTests/pointerevents/ios/pointer-events-set-pointer-capture-exceptions.html b/LayoutTests/pointerevents/ios/pointer-events-set-pointer-capture-exceptions.html >index e39749152662d27256500209e88560b56b9e05e1..e3256151e2a1c67c178eee76bd27d5c836e2f8c8 100644 >--- a/LayoutTests/pointerevents/ios/pointer-events-set-pointer-capture-exceptions.html >+++ b/LayoutTests/pointerevents/ios/pointer-events-set-pointer-capture-exceptions.html >@@ -19,7 +19,7 @@ target_test((target, test) => { > assert_true(target.hasPointerCapture(event.pointerId)); > assert_throws("InvalidStateError", () => document.createElement("div").setPointerCapture(event.pointerId), "Calling setPointerCapture() with a valid pointer id on a disconnected element throws an InvalidStateError exception."); > }); >- ui.beginTouches({ x: 50, y: 50 }).then(() => test.done()); >+ ui.tap({ x: 50, y: 50 }).then(() => test.done()); > }, "The setPointerCapture() method can throw."); > > </script> >diff --git a/LayoutTests/pointerevents/ios/touch-action-none-link-traversal.html b/LayoutTests/pointerevents/ios/touch-action-none-link-traversal.html >index 5e4baa7cff0ad275f318135b8e4ad9ee7c4ee760..835d9e99a7209d1db6c8a5b694d7b628ff0f1015 100644 >--- a/LayoutTests/pointerevents/ios/touch-action-none-link-traversal.html >+++ b/LayoutTests/pointerevents/ios/touch-action-none-link-traversal.html >@@ -39,12 +39,16 @@ async_test(test => { > > assert_equals(iframe.contentWindow.location.href, "about:blank", "The iframe initially has no URL."); > >- iframe.addEventListener("load", () => { >- assert_true(iframe.contentWindow.location.href.includes("disabled.html"), "Upon navigation the URL has a location."); >- test.done(); >+ const loaded = new Promise(resolve => { >+ iframe.addEventListener("load", () => { >+ assert_true(iframe.contentWindow.location.href.includes("disabled.html"), "Upon navigation the URL has a location."); >+ resolve(); >+ }); > }); > >- ui.tap({ x: 100, y: 100 }); >+ const tapped = ui.tap({ x: 100, y: 100 }); >+ >+ Promise.all([loaded, tapped]).then(() => test.done()); > }, "Testing that setting touch-action: none allows link traversal."); > > </script> >diff --git a/LayoutTests/pointerevents/ios/touch-action-pan-x-pan-y.html b/LayoutTests/pointerevents/ios/touch-action-pan-x-pan-y.html >index 82b5008d9e2c16d6ad886e5ab0018b348c5f4154..d201b9c42173f5212a181f635119aca1a0d50718 100644 >--- a/LayoutTests/pointerevents/ios/touch-action-pan-x-pan-y.html >+++ b/LayoutTests/pointerevents/ios/touch-action-pan-x-pan-y.html >@@ -19,11 +19,9 @@ target_test({ width: "200px", height: "200px" }, (target, test) => { > target.style.touchAction = "pan-x pan-y"; > > ui.swipe({ x: 150, y: 150 }, { x: 50, y: 50 }).then(() => { >- requestAnimationFrame(() => { >- assert_not_equals(window.pageXOffset, 0, "The page was scrolled in the x-axis."); >- assert_not_equals(window.pageYOffset, 0, "The page was scrolled in the y-axis."); >- test.done(); >- }); >+ assert_not_equals(window.pageXOffset, 0, "The page was scrolled in the x-axis."); >+ assert_not_equals(window.pageYOffset, 0, "The page was scrolled in the y-axis."); >+ test.done(); > }); > > }, "Testing that setting 'touch-action: pan-x pan-y' on an element allows page scrolling in both axes."); >diff --git a/LayoutTests/pointerevents/ios/touch-action-pan-x.html b/LayoutTests/pointerevents/ios/touch-action-pan-x.html >index fd9c14584bc57df9d5b9ad01120a3df188458b45..cb9205f7ef5da2cab70019cfb8ea70f95d77c6f7 100644 >--- a/LayoutTests/pointerevents/ios/touch-action-pan-x.html >+++ b/LayoutTests/pointerevents/ios/touch-action-pan-x.html >@@ -19,11 +19,9 @@ target_test({ width: "200px", height: "200px" }, (target, test) => { > target.style.touchAction = "pan-x"; > > ui.swipe({ x: 150, y: 150 }, { x: 50, y: 50 }).then(() => { >- requestAnimationFrame(() => { >- assert_not_equals(window.pageXOffset, 0, "The page was scrolled in the x-axis."); >- assert_equals(window.pageYOffset, 0, "The page was not scrolled in the y-axis."); >- test.done(); >- }); >+ assert_not_equals(window.pageXOffset, 0, "The page was scrolled in the x-axis."); >+ assert_equals(window.pageYOffset, 0, "The page was not scrolled in the y-axis."); >+ test.done(); > }); > }, "Testing that setting touch-action: pan-x on an element prevents page scrolling in the y-axis."); > >diff --git a/LayoutTests/pointerevents/ios/touch-action-pan-y.html b/LayoutTests/pointerevents/ios/touch-action-pan-y.html >index 6ba9c81f1e1bb193ec1d654915e4cf8a0e08c182..d4407d3ac535adf35952e4f528a70e6888e0af6c 100644 >--- a/LayoutTests/pointerevents/ios/touch-action-pan-y.html >+++ b/LayoutTests/pointerevents/ios/touch-action-pan-y.html >@@ -19,11 +19,9 @@ target_test({ width: "200px", height: "200px" }, (target, test) => { > target.style.touchAction = "pan-y"; > > ui.swipe({ x: 150, y: 150 }, { x: 50, y: 50 }).then(() => { >- requestAnimationFrame(() => { >- assert_equals(window.pageXOffset, 0, "The page was not scrolled in the x-axis."); >- assert_not_equals(window.pageYOffset, 0, "The page was scrolled in the y-axis."); >- test.done(); >- }); >+ assert_equals(window.pageXOffset, 0, "The page was not scrolled in the x-axis."); >+ assert_not_equals(window.pageYOffset, 0, "The page was scrolled in the y-axis."); >+ test.done(); > }); > }, "Testing that setting touch-action: pan-y on an element prevents page scrolling in the x-axis."); > >diff --git a/LayoutTests/pointerevents/ios/touch-action-pinch-zoom-allows-zooming.html b/LayoutTests/pointerevents/ios/touch-action-pinch-zoom-allows-zooming.html >index 27957608bd77adb15d0f5a8a0c7122937b9b019c..2da63c9429e1aa139026ed4313cea6d5d4787976 100644 >--- a/LayoutTests/pointerevents/ios/touch-action-pinch-zoom-allows-zooming.html >+++ b/LayoutTests/pointerevents/ios/touch-action-pinch-zoom-allows-zooming.html >@@ -19,10 +19,8 @@ target_test({ width: "400px", height: "400px" }, (target, test) => { > target.style.touchAction = "pinch-zoom"; > > ui.pinchOut({ x: 50, y: 50, width: 100, height: 100, scale: 0.5 }).then(() => { >- requestAnimationFrame(() => { >- assert_not_equals(window.internals.pageScaleFactor(), 1, "The page was scaled."); >- test.done(); >- }); >+ assert_not_equals(window.internals.pageScaleFactor(), 1, "The page was scaled."); >+ test.done(); > }); > }, "Testing that setting touch-action: pinch-zoom on an element allows page zooming."); > >diff --git a/LayoutTests/pointerevents/ios/touch-action-pointercancel-pan-x.html b/LayoutTests/pointerevents/ios/touch-action-pointercancel-pan-x.html >index 04e06d6abdb3d02b42daa6bdf70c605e161e1638..b2a247ad56d0bfaa559456f582c3f208c8c170bc 100644 >--- a/LayoutTests/pointerevents/ios/touch-action-pointercancel-pan-x.html >+++ b/LayoutTests/pointerevents/ios/touch-action-pointercancel-pan-x.html >@@ -18,7 +18,7 @@ target_test({ width: "200px", height: "200px" }, (target, test) => { > > target.style.touchAction = "pan-x"; > >- const eventTracker = new EventTracker(target, ["pointerdown", "pointermove", "pointerup", "pointercancel"]); >+ const eventTracker = new EventTracker(target, ["pointerdown", "pointerup", "pointercancel"]); > > const one = ui.finger(); > ui.sequence([ >@@ -31,9 +31,6 @@ target_test({ width: "200px", height: "200px" }, (target, test) => { > ]).then(() => { > eventTracker.assertMatchesEvents([ > { type: "pointerdown" }, >- { type: "pointermove" }, >- { type: "pointermove" }, >- { type: "pointermove" }, > { type: "pointercancel" } > ]); > test.done(); >diff --git a/LayoutTests/pointerevents/ios/touch-action-pointercancel-pan-y.html b/LayoutTests/pointerevents/ios/touch-action-pointercancel-pan-y.html >index 5398c67d2fccb4aa7229b7c0570047f05b6b0b57..f97ec06866a1a3be25ca2bb8789ed8c088aec361 100644 >--- a/LayoutTests/pointerevents/ios/touch-action-pointercancel-pan-y.html >+++ b/LayoutTests/pointerevents/ios/touch-action-pointercancel-pan-y.html >@@ -18,7 +18,7 @@ target_test({ width: "200px", height: "200px" }, (target, test) => { > > target.style.touchAction = "pan-y"; > >- const eventTracker = new EventTracker(target, ["pointerdown", "pointermove", "pointerup", "pointercancel"]); >+ const eventTracker = new EventTracker(target, ["pointerdown", "pointerup", "pointercancel"]); > > const one = ui.finger(); > ui.sequence([ >@@ -31,9 +31,6 @@ target_test({ width: "200px", height: "200px" }, (target, test) => { > ]).then(() => { > eventTracker.assertMatchesEvents([ > { type: "pointerdown" }, >- { type: "pointermove" }, >- { type: "pointermove" }, >- { type: "pointermove" }, > { type: "pointercancel" } > ]); > test.done(); >diff --git a/LayoutTests/pointerevents/utils.js b/LayoutTests/pointerevents/utils.js >index e836778ef2cecc904f86af07c794f5ac05f75a1f..b144edcc829a43764e910d577d62270137eede81 100644 >--- a/LayoutTests/pointerevents/utils.js >+++ b/LayoutTests/pointerevents/utils.js >@@ -107,15 +107,12 @@ const ui = new (class UIController { > return this.fingers[id] = new Finger(id); > } > >- beginTouches(options) >- { >- return this._run(`uiController.touchDownAtPoint(${options.x}, ${options.y}, ${options.numberOfTouches || 1})`); >- } >- > swipe(from, to) > { >- const durationInSeconds = 0.5; >- return this._run(`uiController.dragFromPointToPoint(${from.x}, ${from.y}, ${to.x}, ${to.y}, ${durationInSeconds})`); >+ const durationInSeconds = 0.1; >+ return new Promise(resolve => this._run(`uiController.dragFromPointToPoint(${from.x}, ${from.y}, ${to.x}, ${to.y}, ${durationInSeconds})`).then(() => >+ setTimeout(resolve, durationInSeconds * 1000) >+ )); > } > > tap(options) >@@ -132,55 +129,30 @@ const ui = new (class UIController { > options.x = options.x || 0; > options.y = options.y || 0; > >- const startEvent = { >- inputType : "hand", >- timeOffset : 0, >- touches : [ >- { inputType : "finger", >- phase : "moved", >- id : 1, >- x : options.x, >- y : options.y, >- pressure : 0 >- }, >- { inputType : "finger", >- phase : "moved", >- id : 2, >- x : (options.x + options.width) / options.scale, >- y : (options.y + options.height) / options.scale, >- pressure : 0 >- } >- ] >- }; >- >- const endEvent = { >- inputType : "hand", >- timeOffset : 0.5, >- touches : [ >- { inputType : "finger", >- phase : "moved", >- id : 1, >- x : options.x, >- y : options.y, >- pressure : 0 >- }, >- { inputType : "finger", >- phase : "moved", >- id : 2, >- x : options.x + options.width, >- y : options.y + options.height, >- pressure : 0 >- } >- ] >- }; >- >- return this._runEvents([{ >- interpolate : "linear", >- timestep: 0.1, >- coordinateSpace : "content", >- startEvent: startEvent, >- endEvent: endEvent >- }]); >+ const startPoint = { x: options.x + options.width, y: options.y + options.height }; >+ const endPoint = { x: options.x + options.width * options.scale, y: options.y + options.height * options.scale }; >+ >+ function step(factor) >+ { >+ return { >+ x: endPoint.x + (startPoint.x - endPoint.x) * (1 - factor), >+ y: endPoint.y + (startPoint.y - endPoint.y) * (1 - factor) >+ }; >+ } >+ >+ const one = this.finger(); >+ const two = this.finger(); >+ return this.sequence([ >+ one.begin({ x: options.x, y: options.y }), >+ two.begin(step(0)), >+ two.move(step(0.2)), >+ two.move(step(0.4)), >+ two.move(step(0.6)), >+ two.move(step(0.8)), >+ two.move(step(1)), >+ one.end(), >+ two.end() >+ ]); > } > > sequence(touches) >@@ -217,12 +189,12 @@ const ui = new (class UIController { > })); > } > >- beginStylus(options) >+ tapStylus(options) > { > options.azimuthAngle = options.azimuthAngle || 0; > options.altitudeAngle = options.altitudeAngle || 0; > options.pressure = options.pressure || 0; >- return this._run(`uiController.stylusDownAtPoint(${options.x}, ${options.y}, ${options.azimuthAngle}, ${options.altitudeAngle}, ${options.pressure})`); >+ return this._run(`uiController.stylusTapAtPoint(${options.x}, ${options.y}, ${options.azimuthAngle}, ${options.altitudeAngle}, ${options.pressure})`); > } > > _runEvents(events)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dino
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197624
: 369163