⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286794 in webkit


Ignore:
Timestamp:
Dec 9, 2021, 12:02:20 PM (5 years ago)
Author:
Tyler Wilcock
Message:

AX: Make 6 more layout tests async so they pass in isolated tree mode
https://bugs.webkit.org/show_bug.cgi?id=233966

Reviewed by Chris Fleizach.

  • accessibility/element-haspopup-expected.txt:
  • accessibility/element-haspopup.html:

Use accessibilityController.accessibleElementById to get a reference
to the link1 and link2 AX objects instead of document.getElementById()
and accessibilityController.focusedElement. The latter would work, but
would require the test to be made unnecessarily async.

  • accessibility/mac/label-element-changing-children-string-value-expected.txt:
  • accessibility/mac/label-element-changing-children-string-value.html:
  • accessibility/mac/label-element-changing-textcontent-string-value-expected.txt:
  • accessibility/mac/label-element-changing-textcontent-string-value.html:
  • accessibility/mac/update-children-when-aria-role-changes-expected.txt:
  • accessibility/mac/update-children-when-aria-role-changes.html:
  • accessibility/tabindex-removed-expected.txt:
  • accessibility/tabindex-removed.html:

Make these tests async. They dynamically change page content with JS,
so they must verify expectations asynchronously to pass in isolated
tree mode.

  • accessibility/auto-fill-crash.html:

Make this test async.

  • accessibility/auto-fill-crash-expected.txt:
  • platform/glib/accessibility/auto-fill-crash-expected.txt:

Update expectations to reflect the test rewrite.

  • platform/win/accessibility/auto-fill-crash-expected.txt:

Removed because the expectation is the same as the base
auto-fill-crash-expected.txt

Location:
trunk/LayoutTests
Files:
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r286787 r286794  
     12021-12-09  Tyler Wilcock  <tyler_w@apple.com>
     2
     3        AX: Make 6 more layout tests async so they pass in isolated tree mode
     4        https://bugs.webkit.org/show_bug.cgi?id=233966
     5
     6        Reviewed by Chris Fleizach.
     7
     8        * accessibility/element-haspopup-expected.txt:
     9        * accessibility/element-haspopup.html:
     10        Use accessibilityController.accessibleElementById to get a reference
     11        to the link1 and link2 AX objects instead of document.getElementById()
     12        and accessibilityController.focusedElement. The latter would work, but
     13        would require the test to be made unnecessarily async.
     14
     15        * accessibility/mac/label-element-changing-children-string-value-expected.txt:
     16        * accessibility/mac/label-element-changing-children-string-value.html:
     17        * accessibility/mac/label-element-changing-textcontent-string-value-expected.txt:
     18        * accessibility/mac/label-element-changing-textcontent-string-value.html:
     19        * accessibility/mac/update-children-when-aria-role-changes-expected.txt:
     20        * accessibility/mac/update-children-when-aria-role-changes.html:
     21        * accessibility/tabindex-removed-expected.txt:
     22        * accessibility/tabindex-removed.html:
     23        Make these tests async. They dynamically change page content with JS,
     24        so they must verify expectations asynchronously to pass in isolated
     25        tree mode.
     26
     27        * accessibility/auto-fill-crash.html:
     28        Make this test async.
     29        * accessibility/auto-fill-crash-expected.txt:
     30        * platform/glib/accessibility/auto-fill-crash-expected.txt:
     31        Update expectations to reflect the test rewrite.
     32        * platform/win/accessibility/auto-fill-crash-expected.txt:
     33        Removed because the expectation is the same as the base
     34        auto-fill-crash-expected.txt
     35
    1362021-12-09  Robert Jenner  <Jenner@apple.com>
    237
  • trunk/LayoutTests/accessibility/auto-fill-crash-expected.txt

    r284612 r286794  
    1 
    21This tests that when an auto fill element is removed we won't crash accessing an old value.
    32
     
    54
    65
    7 PASS textFieldAxObject.childrenCount is 2
    8 PASS textFieldAxObject.childAtIndex(childrenCountExpected - 1).description is 'AXDescription: contact info AutoFill'
    9 PASS textFieldAxObject.childrenCount is 1
     6PASS axTextField.childrenCount === 2
     7PASS axTextField.childAtIndex(expectedChildrenCount - 1).description === 'AXDescription: contact info AutoFill'
     8PASS axTextField.childrenCount === 1
    109PASS successfullyParsed is true
    1110
  • trunk/LayoutTests/accessibility/auto-fill-crash.html

    r284612 r286794  
    22<html>
    33<head>
    4 <meta charset="utf-8">
    5 <script src="../resources/js-test-pre.js"></script>
     4<script src="../resources/js-test.js"></script>
     5<script src="../resources/accessibility-helper.js"></script>
    66</head>
    7 <body id="body">
     7<body>
    88
    99<input type="text" value="hello" id="textfield">
    1010
    11 <p id="description"></p>
    12 <div id="console"></div>
    13 
    1411<script>
    15 
    1612    description("This tests that when an auto fill element is removed we won't crash accessing an old value.");
    1713
    1814    if (window.accessibilityController) {
     15        window.jsTestIsAsync = true;
     16
     17        var platformName = accessibilityController.platformName;
    1918        var axTextField = accessibilityController.accessibleElementById("textfield");
    20         var childrenCountExpected = accessibilityController.platformName == "atk" ? "1" : "2";
    21         window.internals.setShowAutoFillButton(document.getElementById("textfield"), "Contacts");
    22         var textFieldAxObject = accessibilityController.accessibleElementById('textfield');
    23         shouldBe("textFieldAxObject.childrenCount", childrenCountExpected);
    24         // Verify the autofill button is represented in the accessibility tree.
    25         shouldBe("textFieldAxObject.childAtIndex(childrenCountExpected - 1).description", "'AXDescription: contact info AutoFill'");
     19        var domTextField = document.getElementById("textfield");
    2620
    27         var platform = accessibilityController.platformName;
    28         // Windows expects 2 children.
    29         childrenCountExpected = "2";
    30         if (platform == "mac" || platform == "ios")
    31             childrenCountExpected = "1"
    32         else if (platform == "atk")
    33             childrenCountExpected = "0"
     21        window.internals.setShowAutoFillButton(domTextField, "Contacts");
     22        var expectedChildrenCount = platformName == "atk" ? "1" : "2";
     23        setTimeout(async function() {
     24            await expectAsyncExpression("axTextField.childrenCount", expectedChildrenCount);
     25            // Verify the autofill button is represented in the accessibility tree.
     26            await expectAsyncExpression("axTextField.childAtIndex(expectedChildrenCount - 1).description", "'AXDescription: contact info AutoFill'");
    3427
    35         // Don't crash!
    36         window.internals.setShowAutoFillButton(document.getElementById("textfield"), "None");
    37         shouldBe("textFieldAxObject.childrenCount", childrenCountExpected);
     28            // Don't crash!
     29            window.internals.setShowAutoFillButton(domTextField, "None");
     30            await expectAsyncExpression("axTextField.childrenCount", platformName == "atk" ? "0" : "1");
     31
     32            finishJSTest();
     33        }, 0);
    3834    }
    39 
    4035</script>
    41 
    42 <script src="../resources/js-test-post.js"></script>
    4336</body>
    4437</html>
     38
  • trunk/LayoutTests/accessibility/element-haspopup-expected.txt

    r246715 r286794  
    1111
    1212
    13 PASS accessibilityController.focusedElement.hasPopup is true
    14 PASS accessibilityController.focusedElement.hasPopup is false
    15 PASS p1.hasPopup is true
    16 PASS p2.hasPopup is false
    17 PASS p3.hasPopup is false
     13PASS accessibilityController.accessibleElementById('link1').hasPopup is true
     14PASS accessibilityController.accessibleElementById('link2').hasPopup is false
     15PASS accessibilityController.accessibleElementById('paragraph1').hasPopup is true
     16PASS accessibilityController.accessibleElementById('paragraph2').hasPopup is false
     17PASS accessibilityController.accessibleElementById('paragraph3').hasPopup is false
    1818PASS successfullyParsed is true
    1919
  • trunk/LayoutTests/accessibility/element-haspopup.html

    r246715 r286794  
    2828
    2929    if (window.accessibilityController) {
    30         document.getElementById("link1").focus();
    31         shouldBe("accessibilityController.focusedElement.hasPopup", "true");
     30        shouldBe("accessibilityController.accessibleElementById('link1').hasPopup", "true");
     31        shouldBe("accessibilityController.accessibleElementById('link2').hasPopup", "false");
    3232
    33         document.getElementById("link2").focus();
    34         shouldBe("accessibilityController.focusedElement.hasPopup", "false");
    35 
    36         var p1 = accessibilityController.accessibleElementById("paragraph1");
    37         shouldBe("p1.hasPopup", "true");
    38 
    39         var p2 = accessibilityController.accessibleElementById("paragraph2");
    40         shouldBe("p2.hasPopup", "false");
    41 
    42         var p3 = accessibilityController.accessibleElementById("paragraph3");
    43         shouldBe("p3.hasPopup", "false");
     33        shouldBe("accessibilityController.accessibleElementById('paragraph1').hasPopup", "true");
     34        shouldBe("accessibilityController.accessibleElementById('paragraph2').hasPopup", "false");
     35        shouldBe("accessibilityController.accessibleElementById('paragraph3').hasPopup", "false");
    4436    }
    4537
  • trunk/LayoutTests/accessibility/mac/label-element-changing-children-string-value-expected.txt

    r202063 r286794  
    1  firstfoo choice
    21This tests that if a label element's children change, the string value updates
    32
     
    76PASS label.role is 'AXRole: AXStaticText'
    87PASS initialStringValue is 'AXValue: first choice'
    9 PASS mutatedStringValue is 'AXValue: first foo choice'
     8PASS label.stringValue === 'AXValue: first foo choice'
    109PASS successfullyParsed is true
    1110
    1211TEST COMPLETE
    13 
     12 firstfoo choice
  • trunk/LayoutTests/accessibility/mac/label-element-changing-children-string-value.html

    r202063 r286794  
    22<html>
    33<head>
    4 <script src="../../resources/js-test-pre.js"></script>
     4<script src="../../resources/js-test.js"></script>
     5<script src="../../resources/accessibility-helper.js"></script>
    56</head>
    6 <body id="body">
     7<body>
    78
    89<input type="radio" id="input" />
     
    1213</label>
    1314
    14 <p id="description"></p>
    15 <div id="console"></div>
     15<script>
     16    description("This tests that if a label element's children change, the string value updates");
    1617
    17 <script>
     18    var label, initialStringValue;
     19    if (window.accessibilityController) {
     20        window.jsTestIsAsync = true;
    1821
    19     var label = 0;
    20     var initialStringValue = 0;
    21     var mutatedStringValue = 0;
     22        label = accessibilityController.accessibleElementById("label");
     23        initialStringValue = label.stringValue;
     24        let first = document.getElementById("first")
     25        let span = document.createElement("span");
     26        let textNode = document.createTextNode("foo");
     27        span.appendChild(textNode);
     28        first.appendChild(textNode);
    2229
    23     description("This tests that if a label element's children change, the string value updates");
    24     if (window.accessibilityController) {
     30        shouldBe("label.role", "'AXRole: AXStaticText'");
     31        shouldBe("initialStringValue", "'AXValue: first choice'");
    2532
    26         if (window.accessibilityController) {
    27 
    28             var body = document.getElementById("body");
    29             body.focus();
    30            
    31             label = accessibilityController.accessibleElementById("label");
    32             initialStringValue = label.stringValue;
    33             var first = document.getElementById("first")
    34             var element = document.createElement("span");
    35             var foo = document.createTextNode("foo");
    36             element.appendChild(foo);
    37             first.appendChild(foo);
    38             mutatedStringValue = label.stringValue;
    39 
    40             shouldBe("label.role", "'AXRole: AXStaticText'");
    41             shouldBe("initialStringValue", "'AXValue: first choice'");
    42             shouldBe("mutatedStringValue", "'AXValue: first foo choice'");
    43         }
     33        setTimeout(async function() {
     34            await expectAsyncExpression("label.stringValue", "'AXValue: first foo choice'");
     35            finishJSTest();
     36        }, 0);
    4437    }
    4538</script>
    46 
    47 <script src="../../resources/js-test-post.js"></script>
    4839</body>
    4940</html>
     41
     42
     43
  • trunk/LayoutTests/accessibility/mac/label-element-changing-textcontent-string-value-expected.txt

    r202063 r286794  
    1  second choice
    21This tests that if a label element's children's textContent changes, the string value updates
    32
     
    76PASS label.role is 'AXRole: AXStaticText'
    87PASS initialStringValue is 'AXValue: first choice'
    9 PASS mutatedStringValue is 'AXValue: second choice'
     8PASS label.stringValue === 'AXValue: second choice'
    109PASS successfullyParsed is true
    1110
    1211TEST COMPLETE
    13 
     12 second choice
  • trunk/LayoutTests/accessibility/mac/label-element-changing-textcontent-string-value.html

    r202063 r286794  
    22<html>
    33<head>
    4 <script src="../../resources/js-test-pre.js"></script>
     4<script src="../../resources/js-test.js"></script>
     5<script src="../../resources/accessibility-helper.js"></script>
    56</head>
    6 <body id="body">
     7<body>
    78
    89<input type="radio" id="input" />
     
    1213</label>
    1314
    14 <p id="description"></p>
    15 <div id="console"></div>
     15<script>
     16    description("This tests that if a label element's children's textContent changes, the string value updates");
    1617
    17 <script>
     18    var label, initialStringValue;
     19    if (window.accessibilityController) {
     20        window.jsTestIsAsync = true;
    1821
    19     var label = 0;
    20     var initialStringValue = 0;
    21     var mutatedStringValue = 0;
     22        label = accessibilityController.accessibleElementById("label");
     23        initialStringValue = label.stringValue;
     24        shouldBe("label.role", "'AXRole: AXStaticText'");
     25        shouldBe("initialStringValue", "'AXValue: first choice'");
    2226
    23     description("This tests that if a label element's children's textContent changes, the string value updates");
    24     if (window.accessibilityController) {
    25 
    26         if (window.accessibilityController) {
    27 
    28             var body = document.getElementById("body");
    29             body.focus();
    30            
    31             label = accessibilityController.accessibleElementById("label");
    32             initialStringValue = label.stringValue;
    33             var first = document.getElementById("first")
    34             first.textContent = "second";
    35             mutatedStringValue = label.stringValue;
    36 
    37             shouldBe("label.role", "'AXRole: AXStaticText'");
    38             shouldBe("initialStringValue", "'AXValue: first choice'");
    39             shouldBe("mutatedStringValue", "'AXValue: second choice'");
    40         }
     27        document.getElementById("first").textContent = "second";
     28        setTimeout(async function() {
     29            await expectAsyncExpression("label.stringValue", "'AXValue: second choice'")
     30            finishJSTest();
     31        }, 0);
    4132    }
    4233</script>
    43 
    44 <script src="../../resources/js-test-post.js"></script>
    4534</body>
    4635</html>
     36
  • trunk/LayoutTests/accessibility/mac/update-children-when-aria-role-changes-expected.txt

    r187799 r286794  
    1 button 1
    21This tests that when an ARIA role changes, the AX hierarchy is updated accordingly.
    32
     
    54
    65
    7 PASS parent.childAtIndex(0).role is 'AXRole: AXButton'
    8 PASS parent.childAtIndex(1) == null || parent.childAtIndex(1).isValid == false is true
    9 PASS parent.childAtIndex(0).role is 'AXRole: AXStaticText'
    10 PASS parent.childAtIndex(1).role is 'AXRole: AXButton'
     6PASS container.childAtIndex(0).role is 'AXRole: AXButton'
     7PASS container.childAtIndex(1) == null || container.childAtIndex(1).isValid == false is true
     8PASS container.childAtIndex(0).role === 'AXRole: AXStaticText'
     9PASS container.childAtIndex(1).role === 'AXRole: AXButton'
    1110PASS successfullyParsed is true
    1211
    1312TEST COMPLETE
    14 
     13button 1
  • trunk/LayoutTests/accessibility/mac/update-children-when-aria-role-changes.html

    r187799 r286794  
    22<html>
    33<head>
    4 <script src="../../resources/js-test-pre.js"></script>
    5 <script>
    6 if (window.testRunner)
    7    testRunner.dumpAsText();
    8 </script>
     4<script src="../../resources/js-test.js"></script>
     5<script src="../../resources/accessibility-helper.js"></script>
    96</head>
    107<body>
    118
    12 <div id="parent" tabindex=0 role="group">
     9<div id="container" tabindex=0 role="group">
    1310   <span role="button" id="button1">button 1</span>
    1411   <span id="button2" title="button 2"></span>
    1512</div>
    1613
    17 <p id="description"></p>
    18 <div id="console"></div>
    19 
    2014<script>
    21 
    2215    description("This tests that when an ARIA role changes, the AX hierarchy is updated accordingly.");
    2316
     17    var container;
    2418    if (window.accessibilityController) {
    25         document.getElementById("parent").focus();
    26         var parent = accessibilityController.focusedElement;
    27         shouldBe("parent.childAtIndex(0).role", "'AXRole: AXButton'");
    28         shouldBeTrue("parent.childAtIndex(1) == null || parent.childAtIndex(1).isValid == false");
     19        window.jsTestIsAsync = true;
     20
     21        container = accessibilityController.accessibleElementById("container");
     22        shouldBe("container.childAtIndex(0).role", "'AXRole: AXButton'");
     23        shouldBeTrue("container.childAtIndex(1) == null || container.childAtIndex(1).isValid == false");
    2924 
    3025        document.getElementById("button1").removeAttribute("role");
    3126        document.getElementById("button2").setAttribute("role", "button");
    32        
    33         shouldBe("parent.childAtIndex(0).role", "'AXRole: AXStaticText'");
    34         shouldBe("parent.childAtIndex(1).role", "'AXRole: AXButton'");
     27        setTimeout(async function() {
     28            await expectAsyncExpression("container.childAtIndex(0).role", "'AXRole: AXStaticText'");
     29            await expectAsyncExpression("container.childAtIndex(1).role", "'AXRole: AXButton'");
     30            finishJSTest();
     31        }, 0);
    3532    }
    36 
    3733</script>
    38 
    39 <script src="../../resources/js-test-post.js"></script>
    40 
    4134</body>
    4235</html>
  • trunk/LayoutTests/accessibility/tabindex-removed-expected.txt

    r249534 r286794  
    1  test
    21This tests that when tabindex is updated on an element, the children are re-computed.
    32
     
    98PASS group.parentElement().isEqual(main) is true
    109PASS main.childAtIndex(0).isEqual(group) is true
    11 PASS main.childAtIndex(0).isEqual(button) is true
    12 PASS button.parentElement().isEqual(main) is true
     10PASS main.childAtIndex(0).isEqual(button) === true
     11PASS button.parentElement().isEqual(main) === true
    1312PASS successfullyParsed is true
    1413
    1514TEST COMPLETE
    16 
     15 test
  • trunk/LayoutTests/accessibility/tabindex-removed.html

    r249534 r286794  
    1 <!DOCTYPE HTML>
     1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
    22<html>
    33<head>
    4 <script src="../resources/js-test-pre.js"></script>
     4<script src="../resources/js-test.js"></script>
     5<script src="../resources/accessibility-helper.js"></script>
    56</head>
    67<body>
    78
    89<main id="main">
    9 
    10 <div style="display:inline" tabindex="0">
    11 <button id="button">test</button>
    12 </div>
    13 
     10    <div style="display:inline" tabindex="0">
     11    <button id="button">test</button>
     12    </div>
    1413</main>
    15 
    16 <p id="description"></p>
    17 <div id="console"></div>
    1814
    1915<script>
    2016    description("This tests that when tabindex is updated on an element, the children are re-computed.")
    2117
     18    var button, group, main;
    2219    if (window.accessibilityController) {
    23         var main = accessibilityController.accessibleElementById("main");
    24         var group = main.childAtIndex(0);
    25         var button = accessibilityController.accessibleElementById("button");
     20        window.jsTestIsAsync = true;
     21
     22        button = accessibilityController.accessibleElementById("button");
     23        main = accessibilityController.accessibleElementById("main");
     24        group = main.childAtIndex(0);
    2625
    2726        shouldBeTrue("group.childAtIndex(0).parentElement().isEqual(group)");
     
    3029        shouldBeTrue("main.childAtIndex(0).isEqual(group)");
    3130
    32         // Removing the tabindex updates children
     31        // Removing tabindex should cause children to update.
    3332        document.getElementById("main").children[0].removeAttribute("tabindex");
    34 
    35         shouldBeTrue("main.childAtIndex(0).isEqual(button)");
    36         shouldBeTrue("button.parentElement().isEqual(main)");
     33        setTimeout(async function() {
     34            await expectAsyncExpression("main.childAtIndex(0).isEqual(button)", "true");
     35            await expectAsyncExpression("button.parentElement().isEqual(main)", "true");
     36            finishJSTest();
     37        }, 0);
    3738    }
    3839</script>
    39 <script src="../resources/js-test-post.js"></script>
    4040</body>
    4141</html>
  • trunk/LayoutTests/platform/glib/accessibility/auto-fill-crash-expected.txt

    r284612 r286794  
    1 
    21This tests that when an auto fill element is removed we won't crash accessing an old value.
    32
     
    54
    65
    7 PASS textFieldAxObject.childrenCount is 1
    8 PASS textFieldAxObject.childAtIndex(childrenCountExpected - 1).description is 'AXDescription: contact info AutoFill'
    9 PASS textFieldAxObject.childrenCount is 0
     6PASS axTextField.childrenCount === 1
     7PASS axTextField.childAtIndex(expectedChildrenCount - 1).description === 'AXDescription: contact info AutoFill'
     8PASS axTextField.childrenCount === 0
    109PASS successfullyParsed is true
    1110
Note: See TracChangeset for help on using the changeset viewer.