Title: [264129] trunk/LayoutTests
Revision
264129
Author
[email protected]
Date
2020-07-08 12:54:01 -0700 (Wed, 08 Jul 2020)

Log Message

REGRESSION: (r263222-263223): [ macOS wk2 debug ] accessibility/textarea-selected-text-range.html is flaky failing
https://bugs.webkit.org/show_bug.cgi?id=214078

Reviewed by Darin Adler.

Make this test deterministic by waiting for the correct result.

* accessibility/textarea-selected-text-range-expected.txt:
* accessibility/textarea-selected-text-range.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264128 => 264129)


--- trunk/LayoutTests/ChangeLog	2020-07-08 19:42:08 UTC (rev 264128)
+++ trunk/LayoutTests/ChangeLog	2020-07-08 19:54:01 UTC (rev 264129)
@@ -1,3 +1,15 @@
+2020-07-08  Geoffrey Garen  <[email protected]>
+
+        REGRESSION: (r263222-263223): [ macOS wk2 debug ] accessibility/textarea-selected-text-range.html is flaky failing
+        https://bugs.webkit.org/show_bug.cgi?id=214078
+
+        Reviewed by Darin Adler.
+
+        Make this test deterministic by waiting for the correct result.
+
+        * accessibility/textarea-selected-text-range-expected.txt:
+        * accessibility/textarea-selected-text-range.html:
+
 2020-07-08  Truitt Savell  <[email protected]>
 
         Regression(r261756): webanimations/accelerated-animation-single-keyframe.html is consistently timing out on windows

Modified: trunk/LayoutTests/accessibility/textarea-selected-text-range-expected.txt (264128 => 264129)


--- trunk/LayoutTests/accessibility/textarea-selected-text-range-expected.txt	2020-07-08 19:42:08 UTC (rev 264128)
+++ trunk/LayoutTests/accessibility/textarea-selected-text-range-expected.txt	2020-07-08 19:54:01 UTC (rev 264129)
@@ -1,6 +1,6 @@
-{4, 0}
-{8, 2}
-{25, 0}
+PASS: textArea.selectedTextRange is {4, 0}
+PASS: textArea.selectedTextRange is {8, 2}
+PASS: textArea.selectedTextRange is {25, 0}
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/textarea-selected-text-range.html (264128 => 264129)


--- trunk/LayoutTests/accessibility/textarea-selected-text-range.html	2020-07-08 19:42:08 UTC (rev 264128)
+++ trunk/LayoutTests/accessibility/textarea-selected-text-range.html	2020-07-08 19:54:01 UTC (rev 264129)
@@ -11,30 +11,48 @@
     </textarea>
 
 <script>
+    function waitFor(condition)
+    {
+        return new Promise((resolve, reject) => {
+            let interval = setInterval(() => {
+                if (condition()) {
+                    clearInterval(interval);
+                    resolve();
+                }
+            }, 0);
+        });
+    }
+
     if (window.accessibilityController) {
         window.jsTestIsAsync = true;
         var area1 = document.getElementById("area1");
         area1.focus();
-        setTimeout(function() {
+
+        setTimeout(async function() {
             var textArea = accessibilityController.focusedElement;
+
+            // accessibilityController runs its code on a secondary thread without
+            // explicit synchronization, so changes show up at unpredictable times.
+
             textArea.setSelectedTextRange(4, 0);
+            await waitFor(() => {
+                return textArea.selectedTextRange == "{4, 0}";
+            });
+            debug("PASS: textArea.selectedTextRange is {4, 0}");
 
-            // After setting a property through accessibility, the value won't be updated immediately, so we
-            // must check after a timeout to re-verify the value.
-            setTimeout(function() {
-                debug(textArea.selectedTextRange);
+            textArea.setSelectedTextRange(8, 2);
+            await waitFor(() => {
+                return textArea.selectedTextRange == "{8, 2}";
+            });
+            debug("PASS: textArea.selectedTextRange is {8, 2}");
 
-                textArea.setSelectedTextRange(8,2);
-                setTimeout(function() {
-                    debug(textArea.selectedTextRange);
+            textArea.setSelectedTextRange(100, 0);
+            await waitFor(() => {
+                return textArea.selectedTextRange == "{25, 0}";
+            });
+            debug("PASS: textArea.selectedTextRange is {25, 0}");
 
-                    textArea.setSelectedTextRange(100,0);
-                    setTimeout(function() {
-                        debug(textArea.selectedTextRange);
-                        finishJSTest();
-                    }, 0);
-                }, 0);
-            }, 0);
+            finishJSTest();
         }, 0);
     }
 </script>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to