Title: [258406] trunk/LayoutTests
Revision
258406
Author
simon.fra...@apple.com
Date
2020-03-13 10:16:35 -0700 (Fri, 13 Mar 2020)

Log Message

[iOS WK2] Some pointerevents tests time out
https://bugs.webkit.org/show_bug.cgi?id=209026
<rdar://problem/60338691>

Reviewed by Wenson Hsieh.

Pointerevents tests that used ui.* functions threw errors in the UI-side script because ui._run() bungled
the callbacks. Fix ui._run() to take two arguments, the command name and all arguments except the callback,
which it adds.

The tests are skipped in Open Source because most of them require touch events.

* pointerevents/utils.js:
(const.ui.new.UIController.prototype.swipe):
(const.ui.new.UIController.prototype.tap):
(const.ui.new.UIController.prototype.doubleTap):
(const.ui.new.UIController.prototype.doubleTapToZoom):
(const.ui.new.UIController.prototype.tapStylus):
(const.ui.new.UIController.prototype._runEvents):
(const.ui.new.UIController.prototype._run):
(const.ui.new.UIController):
(const.ui.new.UIController.prototype._run.): Deleted.
(const.ui.new.UIController.prototype._run.return.new.Promise): Deleted.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (258405 => 258406)


--- trunk/LayoutTests/ChangeLog	2020-03-13 17:14:59 UTC (rev 258405)
+++ trunk/LayoutTests/ChangeLog	2020-03-13 17:16:35 UTC (rev 258406)
@@ -1,3 +1,29 @@
+2020-03-12  Simon Fraser  <simon.fra...@apple.com>
+
+        [iOS WK2] Some pointerevents tests time out
+        https://bugs.webkit.org/show_bug.cgi?id=209026
+        <rdar://problem/60338691>
+
+        Reviewed by Wenson Hsieh.
+
+        Pointerevents tests that used ui.* functions threw errors in the UI-side script because ui._run() bungled
+        the callbacks. Fix ui._run() to take two arguments, the command name and all arguments except the callback,
+        which it adds.
+
+        The tests are skipped in Open Source because most of them require touch events. 
+
+        * pointerevents/utils.js:
+        (const.ui.new.UIController.prototype.swipe):
+        (const.ui.new.UIController.prototype.tap):
+        (const.ui.new.UIController.prototype.doubleTap):
+        (const.ui.new.UIController.prototype.doubleTapToZoom):
+        (const.ui.new.UIController.prototype.tapStylus):
+        (const.ui.new.UIController.prototype._runEvents):
+        (const.ui.new.UIController.prototype._run):
+        (const.ui.new.UIController):
+        (const.ui.new.UIController.prototype._run.): Deleted.
+        (const.ui.new.UIController.prototype._run.return.new.Promise): Deleted.
+
 2020-03-13  Chris Dumez  <cdu...@apple.com>
 
         [ macOS ] fast/frames/sandboxed-iframe-navigation-allowed.html is flaky failing

Modified: trunk/LayoutTests/pointerevents/utils.js (258405 => 258406)


--- trunk/LayoutTests/pointerevents/utils.js	2020-03-13 17:14:59 UTC (rev 258405)
+++ trunk/LayoutTests/pointerevents/utils.js	2020-03-13 17:16:35 UTC (rev 258406)
@@ -124,7 +124,7 @@
     swipe(from, to)
     {
         const durationInSeconds = 0.1;
-        return new Promise(resolve => this._run(`uiController.dragFromPointToPoint(${from.x}, ${from.y}, ${to.x}, ${to.y}, ${durationInSeconds})`).then(() =>
+        return new Promise(resolve => this._run('dragFromPointToPoint', `${from.x}, ${from.y}, ${to.x}, ${to.y}, ${durationInSeconds}`).then(() =>
             setTimeout(resolve, durationInSeconds * 1000)
         ));
     }
@@ -131,21 +131,20 @@
 
     tap(options)
     {
-        return this._run(`uiController.singleTapAtPoint(${options.x}, ${options.y})`);
+        return this._run('singleTapAtPoint', `${options.x}, ${options.y}`);
     }
 
     doubleTap(options)
     {
-        return this._run(`uiController.doubleTapAtPoint(${options.x}, ${options.y}, 0, () => uiController.uiScriptComplete())`);
+        return this._run('doubleTapAtPoint', `${options.x}, ${options.y}, 0`);
     }
 
     doubleTapToZoom(options)
     {
         const durationInSeconds = 0.35;
-        return new Promise(resolve => this._run(`uiController.doubleTapAtPoint(${options.x}, ${options.y}, 0)`).then(() =>
+        return new Promise(resolve => this._run('doubleTapAtPoint', `${options.x}, ${options.y}, 0`).then(() =>
             setTimeout(resolve, durationInSeconds * 1000)
         ));
-        return this._run();
     }
 
     pinchOut(options)
@@ -218,20 +217,18 @@
         options.azimuthAngle = options.azimuthAngle || 0;
         options.altitudeAngle = options.altitudeAngle || 0;
         options.pressure = options.pressure || 0;
-        return this._run(`uiController.stylusTapAtPoint(${options.x}, ${options.y}, ${options.azimuthAngle}, ${options.altitudeAngle}, ${options.pressure})`);
+        return this._run('stylusTapAtPoint', `${options.x}, ${options.y}, ${options.azimuthAngle}, ${options.altitudeAngle}, ${options.pressure}`);
     }
 
     _runEvents(events)
     {
-        return this._run(`uiController.sendEventStream('${JSON.stringify({ events })}')`);
+        return this._run('sendEventStream', `'${JSON.stringify({ events })}'`);
     }
 
-    _run(command)
+    _run(command, args)
     {
-        return new Promise(resolve => testRunner.runUIScript(`(function() {
-            (function() { ${command} })();
-            uiController.uiScriptComplete();
-        })();`, resolve));
+        const script = `uiController.${command}(${args}, () => uiController.uiScriptComplete());`;
+        return new Promise(resolve => testRunner.runUIScript(script, resolve));
     }
 
 })();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to