Title: [228159] branches/safari-605-branch/LayoutTests

Diff

Modified: branches/safari-605-branch/LayoutTests/ChangeLog (228158 => 228159)


--- branches/safari-605-branch/LayoutTests/ChangeLog	2018-02-06 15:16:06 UTC (rev 228158)
+++ branches/safari-605-branch/LayoutTests/ChangeLog	2018-02-06 15:16:11 UTC (rev 228159)
@@ -1,3 +1,28 @@
+2018-02-06  Jason Marcell  <jmarc...@apple.com>
+
+        Cherry-pick r227201. rdar://problem/37264507
+
+    2018-01-19  Frederic Wang  <fw...@igalia.com>
+
+            Use promises for basic-gestures.js and 'await' for the corresponding tests
+            https://bugs.webkit.org/show_bug.cgi?id=181841
+
+            Reviewed by Megan Gardner.
+
+            * fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html: Remove redundant
+            check for testRunner.runUIScript, rewrite runUIScript calls to just await a promise, add the
+            async keyword to runTest and reindent.
+            Also remove extraneous space after + operator.
+            * fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html: Ditto.
+            * fast/events/touch/ios/long-press-then-drag-left-to-change-selected-text.html: Ditto.
+            * fast/events/touch/ios/long-press-then-drag-right-to-change-selected-text.html: Ditto.
+            * fast/events/touch/ios/long-press-then-drag-to-select-text.html: Ditto.
+            * fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html: Ditto.
+            * fast/events/touch/ios/long-press-to-select-and-tap-to-clear.html: Ditto.
+            * fast/events/touch/ios/long-press-to-select-text.html: Ditto.
+            * resources/basic-gestures.js: For all functions in this file, wrap the script source into a
+            runUIScript call and a new promise, reindent.
+
 2018-02-05  Jason Marcell  <jmarc...@apple.com>
 
         Cherry-pick r228096. rdar://problem/37240973

Modified: branches/safari-605-branch/LayoutTests/fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html (228158 => 228159)


--- branches/safari-605-branch/LayoutTests/fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html	2018-02-06 15:16:06 UTC (rev 228158)
+++ branches/safari-605-branch/LayoutTests/fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html	2018-02-06 15:16:11 UTC (rev 228159)
@@ -10,7 +10,7 @@
             testRunner.waitUntilDone();
         }
     
-        function runTest()
+        async function runTest()
         {
             if (!testRunner.runUIScript)
                 return;
@@ -25,34 +25,26 @@
             
             var textLength = scrollBox.value.length;
 
-            if (testRunner.runUIScript) {
-                testRunner.runUIScript(tapAtPoint(tapPointX, tapPointY), function() {
-                    testRunner.runUIScript(didShowKeyboard(), function() {
-                        testRunner.runUIScript(longPressAndHoldAtPoint(tapPointX, tapPointY), function() {
-                            testRunner.runUIScript(continueTouchAndDragFromPointToPoint(tapPointX, tapPointY, dragX, tapPointY), function() {
-                                testRunner.runUIScript(holdAtPoint(dragX, tapPointY, 2.0), function() {
-                                    testRunner.runUIScript(continueTouchAndDragFromPointToPoint(dragX, tapPointY, dragX + 5, tapPointY), function() {
-                                        if (scrollBox.scrollLeft > 0)
-                                            output += 'PASS: Text Box has been scrolled.';
-                                        else
-                                            output += 'FAIL: Text Box has not been scrolled';
-                                        output += '<br>';
-                                                           
-                                        if ((scrollBox.selectionStart == scrollBox.selectionEnd) && (scrollBox.selectionStart == textLength))
-                                            output += 'PASS: Correct Cursor Location';
-                                        else
-                                            output += 'FAIL: cursor is at an unexpected position:' + scrollBox.selectionStart;
-                                        output += '<br>';
-                                   
-                                        document.getElementById('target').innerHTML = output;
-                                        testRunner.notifyDone();
-                                    });
-                                });
-                            });
-                        });
-                    });
-                });
-            }
+            await tapAtPoint(tapPointX, tapPointY);
+            await didShowKeyboard();
+            await longPressAndHoldAtPoint(tapPointX, tapPointY);
+            await continueTouchAndDragFromPointToPoint(tapPointX, tapPointY, dragX, tapPointY);
+            await holdAtPoint(dragX, tapPointY, 2.0);
+            await continueTouchAndDragFromPointToPoint(dragX, tapPointY, dragX + 5, tapPointY);
+            if (scrollBox.scrollLeft > 0)
+                output += 'PASS: Text Box has been scrolled.';
+            else
+                output += 'FAIL: Text Box has not been scrolled';
+            output += '<br>';
+
+            if ((scrollBox.selectionStart == scrollBox.selectionEnd) && (scrollBox.selectionStart == textLength))
+                output += 'PASS: Correct Cursor Location';
+            else
+                output += 'FAIL: cursor is at an unexpected position:' + scrollBox.selectionStart;
+            output += '<br>';
+
+            document.getElementById('target').innerHTML = output;
+            testRunner.notifyDone();
         }
     
         window.addEventListener('load', runTest, false);

Modified: branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html (228158 => 228159)


--- branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html	2018-02-06 15:16:06 UTC (rev 228158)
+++ branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html	2018-02-06 15:16:11 UTC (rev 228159)
@@ -9,7 +9,7 @@
             testRunner.waitUntilDone();
         }
     
-        function runTest()
+        async function runTest()
         {
             if (!testRunner.runUIScript)
                 return;
@@ -27,58 +27,50 @@
             var dragY3 = thirdTargetRect.y + thirdTargetRect.height;
             var dragY4 = firstTargetRect.y - firstTargetRect.height;
         
-            if (testRunner.runUIScript) {
-                testRunner.runUIScript(longPressAtPoint(pressPointX,pressPointY), function(result) {
-                    if (document.getSelection().toString() == "sed")
-                        output += 'PASS: Correct Selection';
-                    else
-                        output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
-                    output += '<br>';
-                                   
-                    testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY2), function(result) {
-                        if (document.getSelection().toString() == "sed do eiusmod tempor incididun")
-                            output += 'PASS: Correct Selection';
-                        else
-                            output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                        output += '<br>';
-                                                          
-                        testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY3), function(result) {
-                            if (document.getSelection().toString() == "sed do eiusmod tempor incididunt ut labore et dolore ma")
-                                output += 'PASS: Correct Selection';
-                            else
-                                output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                            output += '<br>';
-                       
-                            testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY3, dragX, dragY2), function(result) {
-                                if (document.getSelection().toString() == "sed do eiusmod tempor incididun")
-                                    output += 'PASS: Correct Selection';
-                                else
-                                    output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                                output += '<br>';
-                                                                                                        
-                                testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY), function(result) {
-                                    if (document.getSelection().toString() == "sed")
-                                        output += 'PASS: Correct Selection';
-                                    else
-                                        output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                                    output += '<br>';
-                                                                                                                               
-                                    testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY4), function(result) {
-                                        if (document.getSelection().toString() == "s")
-                                            output += 'PASS: Correct Selection';
-                                        else
-                                            output += 'FAIL: failed to reduce selection to a single character by dragging up. Incorrect Selection: ' + document.getSelection().toString();
-                                        output += '<br>';
-                                        output += result;
-                                        document.getElementById('target').innerHTML = output;
-                                        testRunner.notifyDone();
-                                    });
-                                });
-                            });
-                        });
-                    });
-                });
-            }
+            await longPressAtPoint(pressPointX,pressPointY);
+            if (document.getSelection().toString() == "sed")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY2);
+            if (document.getSelection().toString() == "sed do eiusmod tempor incididun")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY3);
+            if (document.getSelection().toString() == "sed do eiusmod tempor incididunt ut labore et dolore ma")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            await touchAndDragFromPointToPoint(dragX, dragY3, dragX, dragY2);
+            if (document.getSelection().toString() == "sed do eiusmod tempor incididun")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY);
+            if (document.getSelection().toString() == "sed")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            var result = await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY4);
+            if (document.getSelection().toString() == "s")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to reduce selection to a single character by dragging up. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+            output += result;
+            document.getElementById('target').innerHTML = output;
+            testRunner.notifyDone();
         }
     
         window.addEventListener('load', runTest, false);

Modified: branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-left-to-change-selected-text.html (228158 => 228159)


--- branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-left-to-change-selected-text.html	2018-02-06 15:16:06 UTC (rev 228158)
+++ branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-left-to-change-selected-text.html	2018-02-06 15:16:11 UTC (rev 228159)
@@ -9,7 +9,7 @@
             testRunner.waitUntilDone();
         }
     
-        function runTest()
+        async function runTest()
         {
             if (!testRunner.runUIScript)
                 return;
@@ -27,58 +27,50 @@
             var dragX3 = thirdTargetRect.x;
             var dragX4 = firstTargetRect.x + firstTargetRect.width;
         
-            if (testRunner.runUIScript) {
-                testRunner.runUIScript(longPressAtPoint(pressPointX, pressPointY), function(result) {
-                    if (document.getSelection().toString() == "aliqua")
-                        output += 'PASS: Correct Selection';
-                    else
-                        output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
-                    output += '<br>';
-            
-                    testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY, dragX2, dragY), function(result) {
-                        if (document.getSelection().toString() == "magna aliqua")
-                            output += 'PASS: Correct Selection';
-                        else
-                            output += 'FAIL: failed to select additional word after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                        output += '<br>';
-                                       
-                        testRunner.runUIScript(touchAndDragFromPointToPoint(dragX2, dragY, dragX3, dragY), function(result) {
-                            if (document.getSelection().toString() == "dolore magna aliqua")
-                                output += 'PASS: Correct Selection';
-                            else
-                                output += 'FAIL: failed to select additional word after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                            output += '<br>';
-                                           
-                            testRunner.runUIScript(touchAndDragFromPointToPoint(dragX3, dragY, dragX2, dragY), function(result) {
-                                if (document.getSelection().toString() == "magna aliqua")
-                                    output += 'PASS: Correct Selection';
-                                else
-                                    output += 'FAIL: failed to deselect word after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                                output += '<br>';
-                        
-                                testRunner.runUIScript(touchAndDragFromPointToPoint(dragX2, dragY, dragX, dragY), function(result) {
-                                    if (document.getSelection().toString() == "aliqua")
-                                        output += 'PASS: Correct Selection';
-                                    else
-                                        output += 'FAIL: failed to deselect word after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                                    output += '<br>';
-                            
-                                    testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY, dragX4, dragY), function(result) {
-                                        if (document.getSelection().toString() == "a")
-                                            output += 'PASS: Correct Selection';
-                                        else
-                                            output += 'FAIL: failed to reduce selection to a single character by dragging right. Incorrect Selection: ' +     document.getSelection().toString();
-                                        output += '<br>';
-                                        output += result;
-                                        document.getElementById('target').innerHTML = output;
-                                        testRunner.notifyDone();
-                                    });
-                                });
-                            });
-                        });
-                    });
-                });
-            }
+            await longPressAtPoint(pressPointX, pressPointY);
+            if (document.getSelection().toString() == "aliqua")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            await touchAndDragFromPointToPoint(dragX, dragY, dragX2, dragY);
+            if (document.getSelection().toString() == "magna aliqua")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select additional word after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            await touchAndDragFromPointToPoint(dragX2, dragY, dragX3, dragY);
+            if (document.getSelection().toString() == "dolore magna aliqua")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select additional word after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            await touchAndDragFromPointToPoint(dragX3, dragY, dragX2, dragY);
+            if (document.getSelection().toString() == "magna aliqua")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to deselect word after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            await touchAndDragFromPointToPoint(dragX2, dragY, dragX, dragY);
+            if (document.getSelection().toString() == "aliqua")
+                 output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to deselect word after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            var result = await touchAndDragFromPointToPoint(dragX, dragY, dragX4, dragY);
+            if (document.getSelection().toString() == "a")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to reduce selection to a single character by dragging right. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+            output += result;
+            document.getElementById('target').innerHTML = output;
+            testRunner.notifyDone();
         }
     
         window.addEventListener('load', runTest, false);

Modified: branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-right-to-change-selected-text.html (228158 => 228159)


--- branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-right-to-change-selected-text.html	2018-02-06 15:16:06 UTC (rev 228158)
+++ branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-right-to-change-selected-text.html	2018-02-06 15:16:11 UTC (rev 228159)
@@ -9,7 +9,7 @@
             testRunner.waitUntilDone();
         }
     
-        function runTest()
+        async function runTest()
         {
             if (!testRunner.runUIScript)
                 return;
@@ -27,58 +27,50 @@
             var dragX3 = thirdTargetRect.x;
             var dragX4 = firstTargetRect.x - firstTargetRect.width;
         
-            if (testRunner.runUIScript) {
-                testRunner.runUIScript(longPressAtPoint(pressPointX, pressPointY), function(result) {
-                    if (document.getSelection().toString() == "magna")
-                        output += 'PASS: Correct Selection';
-                    else
-                        output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
-                    output += '<br>';
+            await longPressAtPoint(pressPointX, pressPointY);
+            if (document.getSelection().toString() == "magna")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
 
-                    testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY, dragX2, dragY), function(result) {
-                        if (document.getSelection().toString() == "magna aliqua.")
-                            output += 'PASS: Correct Selection';
-                        else
-                            output += 'FAIL: failed to select additional word after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                        output += '<br>';
-                                      
-                        testRunner.runUIScript(touchAndDragFromPointToPoint(dragX2, dragY, dragX3, dragY), function(result) {
-                            if (document.getSelection().toString() == "magna aliqua. Ut")
-                                output += 'PASS: Correct Selection';
-                            else
-                                output += 'FAIL: failed to select additional word after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                            output += '<br>';
+            await touchAndDragFromPointToPoint(dragX, dragY, dragX2, dragY);
+            if (document.getSelection().toString() == "magna aliqua.")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select additional word after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
 
-                            testRunner.runUIScript(touchAndDragFromPointToPoint(dragX3, dragY, dragX2, dragY), function(result) {
-                                if (document.getSelection().toString() == "magna aliqua.")
-                                    output += 'PASS: Correct Selection';
-                                else
-                                    output += 'FAIL: failed to deselect word after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                                output += '<br>';
+            await touchAndDragFromPointToPoint(dragX2, dragY, dragX3, dragY);
+            if (document.getSelection().toString() == "magna aliqua. Ut")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select additional word after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
 
-                                testRunner.runUIScript(touchAndDragFromPointToPoint(dragX2, dragY, dragX, dragY), function(result) {
-                                    if (document.getSelection().toString() == "magna")
-                                        output += 'PASS: Correct Selection';
-                                    else
-                                        output += 'FAIL: failed to deselect word after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                                    output += '<br>';
-                        
-                                    testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY, dragX4, dragY), function(result) {
-                                        if (document.getSelection().toString() == "m")
-                                            output += 'PASS: Correct Selection';
-                                        else
-                                            output += 'FAIL: failed to reduce selection to a single character by dragging left. Incorrect Selection: ' + document.getSelection().toString();
-                                        output += '<br>';
-                                        output += result;
-                                        document.getElementById('target').innerHTML = output;
-                                        testRunner.notifyDone();
-                                    });
-                                });
-                            });
-                        });
-                    });
-                });
-            }
+            await touchAndDragFromPointToPoint(dragX3, dragY, dragX2, dragY);
+            if (document.getSelection().toString() == "magna aliqua.")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to deselect word after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            await(touchAndDragFromPointToPoint(dragX2, dragY, dragX, dragY);
+            if (document.getSelection().toString() == "magna")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to deselect word after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            var result = await touchAndDragFromPointToPoint(dragX, dragY, dragX4, dragY);
+            if (document.getSelection().toString() == "m")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to reduce selection to a single character by dragging left. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+            output += result;
+            document.getElementById('target').innerHTML = output;
+            testRunner.notifyDone();
         }
 
         window.addEventListener('load', runTest, false);

Modified: branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-to-select-text.html (228158 => 228159)


--- branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-to-select-text.html	2018-02-06 15:16:06 UTC (rev 228158)
+++ branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-to-select-text.html	2018-02-06 15:16:11 UTC (rev 228159)
@@ -9,7 +9,7 @@
             testRunner.waitUntilDone();
         }
     
-        function runTest()
+        async function runTest()
         {
             if (!testRunner.runUIScript)
                 return;
@@ -23,26 +23,22 @@
             var dragX = secondTargetRect.x + secondTargetRect.width / 2;
             var dragY = secondTargetRect.y + secondTargetRect.height / 2;
         
-            if (testRunner.runUIScript) {
-                testRunner.runUIScript(longPressAndHoldAtPoint(pressPointX, pressPointY), function(result) {
-                    if (document.getSelection().toString() == "magna")
-                        output += 'PASS: Correct Selection';
-                    else
-                        output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
-                    output += '<br>';
+            await longPressAndHoldAtPoint(pressPointX, pressPointY);
+            if (document.getSelection().toString() == "magna")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
 
-                    testRunner.runUIScript(continueTouchAndDragFromPointToPoint(pressPointX, pressPointY, dragX, dragY), function(result) {
-                        if (document.getSelection().toString() == "labore")
-                            output += 'PASS: Correct Selection';
-                        else
-                            output += 'FAIL: failed to reduce selection to a single character by dragging down. Incorrect Selection: ' +     document.getSelection().toString();
-                        output += '<br>';
-                        output += result;
-                        document.getElementById('target').innerHTML = output;
-                        testRunner.notifyDone();
-                    });
-                });
-            }
+            var result = await continueTouchAndDragFromPointToPoint(pressPointX, pressPointY, dragX, dragY);
+            if (document.getSelection().toString() == "labore")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to reduce selection to a single character by dragging down. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+            output += result;
+            document.getElementById('target').innerHTML = output;
+            testRunner.notifyDone();
         }
 
         window.addEventListener('load', runTest, false);

Modified: branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html (228158 => 228159)


--- branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html	2018-02-06 15:16:06 UTC (rev 228158)
+++ branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html	2018-02-06 15:16:11 UTC (rev 228159)
@@ -9,7 +9,7 @@
             testRunner.waitUntilDone();
         }
     
-        function runTest()
+        async function runTest()
         {
             if (!testRunner.runUIScript)
                 return;
@@ -27,58 +27,50 @@
             var dragY3 = thirdTargetRect.y;
             var dragY4 = firstTargetRect.y + firstTargetRect.height;
         
-            if (testRunner.runUIScript) {
-                testRunner.runUIScript(longPressAtPoint(pressPointX, pressPointY), function(result) {
-                    if (document.getSelection().toString() == "Ut")
-                        output += 'PASS: Correct Selection';
-                    else
-                        output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
-                    output += '<br>';
+            await longPressAtPoint(pressPointX, pressPointY);
+            if (document.getSelection().toString() == "Ut")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
 
-                    testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY2), function(result) {
-                        if (document.getSelection().toString() == "e et dolore magna aliqua. Ut")
-                            output += 'PASS: Correct Selection';
-                        else
-                            output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                        output += '<br>';
-                                      
-                        testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY3), function(result) {
-                            if (document.getSelection().toString() == "mod tempor incididunt ut labore et dolore magna aliqua. Ut")
-                                output += 'PASS: Correct Selection';
-                            else
-                                output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                            output += '<br>';
+            await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY2);
+            if (document.getSelection().toString() == "e et dolore magna aliqua. Ut")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
 
-                            testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY3, dragX, dragY2), function(result) {
-                                if (document.getSelection().toString() == "e et dolore magna aliqua. Ut")
-                                    output += 'PASS: Correct Selection';
-                                else
-                                    output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                                output += '<br>';
+            await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY3);
+            if (document.getSelection().toString() == "mod tempor incididunt ut labore et dolore magna aliqua. Ut")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select additional line after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
 
-                                testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY), function(result) {
-                                    if (document.getSelection().toString() == "Ut")
-                                        output += 'PASS: Correct Selection';
-                                    else
-                                        output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
-                                    output += '<br>';
-                        
-                                    testRunner.runUIScript(touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY4), function(result) {
-                                        if (document.getSelection().toString() == "t")
-                                            output += 'PASS: Correct Selection';
-                                        else
-                                            output += 'FAIL: failed to reduce selection to a single character by dragging down. Incorrect Selection: ' +     document.getSelection().toString();
-                                        output += '<br>';
-                                        output += result;
-                                        document.getElementById('target').innerHTML = output;
-                                        testRunner.notifyDone();
-                                    });
-                                });
-                            });
-                        });
-                    });
-                });
-            }
+            await touchAndDragFromPointToPoint(dragX, dragY3, dragX, dragY2);
+            if (document.getSelection().toString() == "e et dolore magna aliqua. Ut")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            await touchAndDragFromPointToPoint(dragX, dragY2, dragX, dragY);
+            if (document.getSelection().toString() == "Ut")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to deselect line after a drag. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+
+            var result = await touchAndDragFromPointToPoint(dragX, dragY, dragX, dragY4);
+            if (document.getSelection().toString() == "t")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to reduce selection to a single character by dragging down. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+            output += result;
+            document.getElementById('target').innerHTML = output;
+            testRunner.notifyDone();
         }
 
         window.addEventListener('load', runTest, false);

Modified: branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-to-select-and-tap-to-clear.html (228158 => 228159)


--- branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-to-select-and-tap-to-clear.html	2018-02-06 15:16:06 UTC (rev 228158)
+++ branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-to-select-and-tap-to-clear.html	2018-02-06 15:16:11 UTC (rev 228159)
@@ -9,7 +9,7 @@
             testRunner.waitUntilDone();
         }
     
-        function runTest()
+        async function runTest()
         {
             if (!testRunner.runUIScript)
                 return;
@@ -20,24 +20,20 @@
             var pressPointX = targetRect.x + targetRect.width / 2;
             var pressPointY = targetRect.y + targetRect.height / 2;
             
-            if (testRunner.runUIScript) {
-                testRunner.runUIScript(longPressAtPoint(pressPointX, pressPointY), function(result) {
-                    if (document.getSelection().toString() == "PressMe")
-                        output += 'PASS: Correct Selection';
-                    else
-                        output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
-                    output += '<br>';
-                    testRunner.runUIScript(tapAtPoint(100, 100), function(result) {
-                        if (document.getSelection().toString() == "")
-                            output += 'PASS: Cleared selection';
-                        else
-                            output += 'FAIL: failed to clear selection after tap.' + document.getSelection().toString();
-                        output += '<br>';
-                        document.getElementById('target').innerHTML = output;
-                        testRunner.notifyDone();
-                    });
-                });
-            }
+            await longPressAtPoint(pressPointX, pressPointY);
+            if (document.getSelection().toString() == "PressMe")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select a word as a result of a long press. Incorrect Selection: ' + document.getSelection().toString();
+            output += '<br>';
+            await tapAtPoint(100, 100);
+            if (document.getSelection().toString() == "")
+                output += 'PASS: Cleared selection';
+            else
+                output += 'FAIL: failed to clear selection after tap.' + document.getSelection().toString();
+            output += '<br>';
+            document.getElementById('target').innerHTML = output;
+            testRunner.notifyDone();
         }
 
         window.addEventListener('load', runTest, false);

Modified: branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-to-select-text.html (228158 => 228159)


--- branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-to-select-text.html	2018-02-06 15:16:06 UTC (rev 228158)
+++ branches/safari-605-branch/LayoutTests/fast/events/touch/ios/long-press-to-select-text.html	2018-02-06 15:16:11 UTC (rev 228159)
@@ -9,7 +9,7 @@
             testRunner.waitUntilDone();
         }
 
-        function runTest()
+        async function runTest()
         {
             if (!testRunner.runUIScript)
                 return;
@@ -20,18 +20,15 @@
             var pressPointX = targetRect.x + targetRect.width / 2;
             var pressPointY = targetRect.y + targetRect.height / 2;
             
-            if (testRunner.runUIScript) {                
-                testRunner.runUIScript(longPressAtPoint(pressPointX, pressPointY), function(result) {
-                    if (document.getSelection().toString() == "PressMe")
-                        output += 'PASS: Correct Selection';
-                    else
-                        output += 'FAIL: failed to select a word as a result of a long press';
-                    output += '<br>';
-                    output += result;
-                    document.getElementById('target').innerHTML = output;
-                    testRunner.notifyDone();
-                });
-            }
+            var result = await longPressAtPoint(pressPointX, pressPointY);
+            if (document.getSelection().toString() == "PressMe")
+                output += 'PASS: Correct Selection';
+            else
+                output += 'FAIL: failed to select a word as a result of a long press';
+            output += '<br>';
+            output += result;
+            document.getElementById('target').innerHTML = output;
+            testRunner.notifyDone();
         }
 
         window.addEventListener('load', runTest, false);

Modified: branches/safari-605-branch/LayoutTests/fast/events/touch/ios/resources/basic-gestures.js (228158 => 228159)


--- branches/safari-605-branch/LayoutTests/fast/events/touch/ios/resources/basic-gestures.js	2018-02-06 15:16:06 UTC (rev 228158)
+++ branches/safari-605-branch/LayoutTests/fast/events/touch/ios/resources/basic-gestures.js	2018-02-06 15:16:11 UTC (rev 228159)
@@ -1,220 +1,235 @@
 function didShowKeyboard()
 {
-	return `
-	(function() {
-        uiController.didShowKeyboardCallback = function() {
-            uiController.uiScriptComplete();
-		}
-    })();`
+    return new Promise(resolve => {
+        testRunner.runUIScript(`
+            (function() {
+                uiController.didShowKeyboardCallback = function() {
+                    uiController.uiScriptComplete();
+                }
+            })();`, resolve);
+    });
 }
 
-
 function longPressAtPoint(x, y)
 {
-    return `
-    (function() {
-        uiController.longPressAtPoint(${x}, ${y}, function() {
-            uiController.uiScriptComplete();
-        });
-    })();`
+    return new Promise(resolve => {
+        testRunner.runUIScript(`
+            (function() {
+                uiController.longPressAtPoint(${x}, ${y}, function() {
+                    uiController.uiScriptComplete();
+                });
+            })();`, resolve);
+    });
 }
 
 function liftUpAtPoint(x, y)
 {
-    return `
-    (function() {
-        uiController.liftUpAtPoint(${x}, ${y}, 1, function() {
-            uiController.uiScriptComplete();
-        });
-    })();`
+    return new Promise(resolve => {
+        testRunner.runUIScript(`
+            (function() {
+                uiController.liftUpAtPoint(${x}, ${y}, 1, function() {
+                    uiController.uiScriptComplete();
+                });
+            })();`, resolve);
+    });
 }
 
 function longPressAndHoldAtPoint(x, y)
 {
-    return `
-    (function() {
-    var eventStream = {
-    events : [
-        {
-            interpolate : "linear",
-            timestep: 0.1,
-            coordinateSpace : "content",
-            startEvent : {
-                inputType : "hand",
-                timeOffset : 0,
-                touches : [
-                    {
-                        inputType : "finger",
-                        phase : "began",
-                        id : 1,
-                        x : ${x},
-                        y : ${y},
-                        pressure : 0
+    return new Promise(resolve => {
+        testRunner.runUIScript(`
+            (function() {
+            var eventStream = {
+            events : [
+                {
+                    interpolate : "linear",
+                    timestep: 0.1,
+                    coordinateSpace : "content",
+                    startEvent : {
+                        inputType : "hand",
+                        timeOffset : 0,
+                        touches : [
+                            {
+                                inputType : "finger",
+                                phase : "began",
+                                id : 1,
+                                x : ${x},
+                                y : ${y},
+                                pressure : 0
+                            }
+                        ]
+                    },
+                    endEvent : {
+                        inputType : "hand",
+                        timeOffset : 2.0,
+                        touches : [
+                            {
+                                inputType : "finger",
+                                phase : "moved",
+                                id : 1,
+                                x : ${x},
+                                y : ${y},
+                                pressure : 0
+                            }
+                        ]
                     }
-                ]
-            },
-            endEvent : {
-                inputType : "hand",
-                timeOffset : 2.0,
-                touches : [
-                    {
-                        inputType : "finger",
-                        phase : "moved",
-                        id : 1,
-                        x : ${x},
-                        y : ${y},
-                        pressure : 0
-                    }
-                ]
-            }
-    }]};
-    
-    uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-        uiController.uiScriptComplete();
-    })();`
+            }]};
+
+            uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                uiController.uiScriptComplete();
+            })();`, resolve);
+    });
 }
 
 function tapAtPoint(x, y)
 {
-    return `
-    (function() {
-        uiController.singleTapAtPoint(${x}, ${y}, function() {
-            uiController.uiScriptComplete();
-        });
-    })();`
+    return new Promise(resolve => {
+        testRunner.runUIScript(`
+            (function() {
+                uiController.singleTapAtPoint(${x}, ${y}, function() {
+                    uiController.uiScriptComplete();
+                });
+            })();`, resolve);
+    });
 }
 
 function touchAndDragFromPointToPoint(startX, startY, endX, endY)
 {
-    return `
-    (function() {
-    var eventStream = {
-    events : [
-        {
-            interpolate : "linear",
-            timestep: 0.1,
-            coordinateSpace : "content",
-            startEvent : {
-                inputType : "hand",
-                timeOffset : 0,
-                touches : [
-                    {
-                        inputType : "finger",
-                        phase : "began",
-                        id : 1,
-                        x : ${startX},
-                        y : ${startY},
-                        pressure : 0
+    return new Promise(resolve => {
+        testRunner.runUIScript(`
+            (function() {
+            var eventStream = {
+            events : [
+                {
+                    interpolate : "linear",
+                    timestep: 0.1,
+                    coordinateSpace : "content",
+                    startEvent : {
+                        inputType : "hand",
+                        timeOffset : 0,
+                        touches : [
+                            {
+                                inputType : "finger",
+                                phase : "began",
+                                id : 1,
+                                x : ${startX},
+                                y : ${startY},
+                                pressure : 0
+                            }
+                        ]
+                    },
+                    endEvent : {
+                        inputType : "hand",
+                        timeOffset : 0.5,
+                        touches : [
+                            {
+                                inputType : "finger",
+                                phase : "moved",
+                                id : 1,
+                                x : ${endX},
+                                y : ${endY},
+                                pressure : 0
+                            }
+                        ]
                     }
-                ]
-            },
-            endEvent : {
-                inputType : "hand",
-                timeOffset : 0.5,
-                touches : [
-                    {
-                        inputType : "finger",
-                        phase : "moved",
-                        id : 1,
-                        x : ${endX},
-                        y : ${endY},
-                        pressure : 0
-                    }
-                ]
-            }
-    }]};
-    
-    uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-        uiController.uiScriptComplete();
-    })();`
+            }]};
+
+            uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                uiController.uiScriptComplete();
+            })();`, resolve);
+    });
 }
 
 function holdAtPoint(x, y)
 {
-    return `
-    (function() {
-    var eventStream = {
-    events : [
-        {
-            interpolate : "linear",
-            timestep: 0.1,
-            coordinateSpace : "content",
-            startEvent : {
-                inputType : "hand",
-                timeOffset : 0,
-                touches : [
-                    {
-                        inputType : "finger",
-                        phase : "moved",
-                        id : 1,
-                        x : ${x},
-                        y : ${y},
-                        pressure : 0
+    return new Promise(resolve => {
+        testRunner.runUIScript(`
+            (function() {
+            var eventStream = {
+            events : [
+                {
+                    interpolate : "linear",
+                    timestep: 0.1,
+                    coordinateSpace : "content",
+                    startEvent : {
+                        inputType : "hand",
+                        timeOffset : 0,
+                        touches : [
+                            {
+                                inputType : "finger",
+                                phase : "moved",
+                                id : 1,
+                                x : ${x},
+                                y : ${y},
+                                pressure : 0
+                            }
+                        ]
+                    },
+                    endEvent : {
+                        inputType : "hand",
+                        timeOffset : 5.0,
+                        touches : [
+                            {
+                                inputType : "finger",
+                                phase : "moved",
+                                id : 1,
+                                x : ${x},
+                                y : ${y},
+                                pressure : 0
+                            }
+                        ]
                     }
-                ]
-            },
-            endEvent : {
-                inputType : "hand",
-                timeOffset : 5.0,
-                touches : [
-                    {
-                        inputType : "finger",
-                        phase : "moved",
-                        id : 1,
-                        x : ${x},
-                        y : ${y},
-                        pressure : 0
-                    }
-                ]
-            }
-    }]};
-    
-    uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-        uiController.uiScriptComplete();
-    })();`
+            }]};
+
+            uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                uiController.uiScriptComplete();
+            })();`, resolve);
+    });
 }
 
 function continueTouchAndDragFromPointToPoint(startX, startY, endX, endY)
 {
-    return `
-    (function() {
-     var eventStream = {
-     events : [
-               {
-               interpolate : "linear",
-               timestep: 0.1,
-               coordinateSpace : "content",
-               startEvent : {
-                   inputType : "hand",
-                   timeOffset : 0,
-                   touches : [
+    return new Promise(resolve => {
+        testRunner.runUIScript(`
+            (function() {
+             var eventStream = {
+             events : [
                        {
-                           inputType : "finger",
-                           phase : "moved",
-                           id : 1,
-                           x : ${startX},
-                           y : ${startY},
-                           pressure : 0
+                       interpolate : "linear",
+                       timestep: 0.1,
+                       coordinateSpace : "content",
+                       startEvent : {
+                           inputType : "hand",
+                           timeOffset : 0,
+                           touches : [
+                               {
+                                   inputType : "finger",
+                                   phase : "moved",
+                                   id : 1,
+                                   x : ${startX},
+                                   y : ${startY},
+                                   pressure : 0
+                               }
+                           ]
+                       },
+                       endEvent : {
+                           inputType : "hand",
+                           timeOffset : 0.5,
+                           touches : [
+                               {
+                                   inputType : "finger",
+                                   phase : "moved",
+                                   id : 1,
+                                   x : ${endX},
+                                   y : ${endY},
+                                   pressure : 0
+                               }
+                           ]
                        }
-                   ]
-               },
-               endEvent : {
-                   inputType : "hand",
-                   timeOffset : 0.5,
-                   touches : [
-                       {
-                           inputType : "finger",
-                           phase : "moved",
-                           id : 1,
-                           x : ${endX},
-                           y : ${endY},
-                           pressure : 0
-                       }
-                   ]
-               }
-     }]};
-     
-     uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-         uiController.uiScriptComplete();
-     })();`
+             }]};
+
+             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
+                 uiController.uiScriptComplete();
+             })();`, resolve);
+    });
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to