AX: layout tests need to be updated to reflect what is being tested
https://bugs.webkit.org/show_bug.cgi?id=38556

Reviewed by Beth Dakin.

Many of the initial AX layout tests just dumped a lot of attributes and did not
have a focused test. This updates some of those tests (more to follow in the future).

* accessibility/image-map1.html:
* accessibility/img-aria-button-alt-tag-expected.txt:
* accessibility/img-aria-button-alt-tag.html:
* accessibility/input-image-alt-expected.txt:
* accessibility/input-image-alt.html:
* accessibility/placeholder-expected.txt:
* accessibility/placeholder.html:
* platform/mac/accessibility/image-map1-expected.txt:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 8f385f2..2dfd2b6 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,22 @@
+2010-05-04  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Beth Dakin.
+
+        AX: layout tests need to be updated to reflect what is being tested
+        https://bugs.webkit.org/show_bug.cgi?id=38556
+
+        Many of the initial AX layout tests just dumped a lot of attributes and did not
+        have a focused test. This updates some of those tests (more to follow in the future).
+
+        * accessibility/image-map1.html:
+        * accessibility/img-aria-button-alt-tag-expected.txt:
+        * accessibility/img-aria-button-alt-tag.html:
+        * accessibility/input-image-alt-expected.txt:
+        * accessibility/input-image-alt.html:
+        * accessibility/placeholder-expected.txt:
+        * accessibility/placeholder.html:
+        * platform/mac/accessibility/image-map1-expected.txt:
+
 2010-05-04  Dirk Pranke  <dpranke@chromium.org>
 
         Unreviewed, expectations change.
diff --git a/LayoutTests/accessibility/image-map1.html b/LayoutTests/accessibility/image-map1.html
index b18708c..92e801c 100644
--- a/LayoutTests/accessibility/image-map1.html
+++ b/LayoutTests/accessibility/image-map1.html
@@ -1,12 +1,17 @@
 <html>
+<head>
+<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script>
+var successfullyParsed = false;
+</script>
+<script src="../fast/js/resources/js-test-pre.js"></script>
+</head>
 <script>
     if (window.layoutTestController)
         layoutTestController.dumpAsText();
 </script>
 <body id="body">
     
-    <div id="result"></div>
-    
     <!-- Test image map -->
     <map id="apple" name="imagemap1">
       <area shape="rect" coords="10,10,133,72" href="http://www.apple.com" title="Link1" />
@@ -17,17 +22,28 @@
 
     <img src="resources/cake.png"  border="0" align="left" usemap="#imagemap1" vspace="1">
 
+<p id="description"></p>
+<div id="console"></div>
      
     <script>
-        if (window.accessibilityController) {
-            var result = document.getElementById("result");
+        description("This tests that you can reach the links within an image map.");
 
-            var body = document.getElementById("body");
-            body.focus();
-            result.innerText += "Image map - test 1 - 3 Links\n";
-            result.innerText += "----------------------\n";
-            result.innerText += accessibilityController.focusedElement.attributesOfChildren() + "\n\n"; 
+        if (window.accessibilityController) {
+            document.getElementById("body").focus();
+
+            var body = accessibilityController.focusedElement;
+            shouldBe("body.childAtIndex(0).role", "'AXRole: AXLink'");
+            shouldBe("body.childAtIndex(0).title", "'AXTitle: Link1'");
+
+            shouldBe("body.childAtIndex(1).role", "'AXRole: AXLink'");
+            shouldBe("body.childAtIndex(1).title", "'AXTitle: Link2'");
+
+            shouldBe("body.childAtIndex(2).role", "'AXRole: AXLink'");
+            shouldBe("body.childAtIndex(2).title", "'AXTitle: Link3'");
         }
-    </script>
+   successfullyParsed = true;
+</script>
+
+<script src="../fast/js/resources/js-test-post.js"></script>
 </body>
 </html>
diff --git a/LayoutTests/accessibility/img-aria-button-alt-tag-expected.txt b/LayoutTests/accessibility/img-aria-button-alt-tag-expected.txt
index 942df1a..ad0202c 100644
--- a/LayoutTests/accessibility/img-aria-button-alt-tag-expected.txt
+++ b/LayoutTests/accessibility/img-aria-button-alt-tag-expected.txt
@@ -1,3 +1,11 @@
 
-Test passed
+This test makes sure that a img acting as an aria button still returns its alt tag as the description
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS imgUIElement.description is 'AXDescription: alternate'
+PASS successfullyParsed is true
+
+TEST COMPLETE
 
diff --git a/LayoutTests/accessibility/img-aria-button-alt-tag.html b/LayoutTests/accessibility/img-aria-button-alt-tag.html
index c90e013..7cef9ae 100644
--- a/LayoutTests/accessibility/img-aria-button-alt-tag.html
+++ b/LayoutTests/accessibility/img-aria-button-alt-tag.html
@@ -1,32 +1,35 @@
 <html>
+<head>
+<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script>
+var successfullyParsed = false;
+</script>
+<script src="../fast/js/resources/js-test-pre.js"></script>
+</head>
 <script>
     if (window.layoutTestController)
         layoutTestController.dumpAsText();
 </script>
 <body id="body">
  
-    <!-- This test makes sure that a img acting as an aria button still returns its alt tag as the description -->
- 
     <img id='image' src="resources/cake.png" role="button" alt="alternate" title="title">
     
-    <div id="result"></div>
-
+    <p id="description"></p>
+    <div id="console"></div>
      
     <script>
+        description("This test makes sure that a img acting as an aria button still returns its alt tag as the description");
+ 
         if (window.accessibilityController) {
             var result = document.getElementById("result");
 
-            var body = document.getElementById("body");
-            body.focus();
+            var body = document.getElementById("body").focus();
             var imgUIElement = accessibilityController.focusedElement.childAtIndex(0).childAtIndex(0);
-            var pattern = "AXDescription: alternate";
-            if (imgUIElement.allAttributes().indexOf(pattern) != -1) {
-                result.innerText += "Test passed\n";
-            }
-            else {
-                 result.innerText += "Test failed\n";
-            }
+            shouldBe("imgUIElement.description", "'AXDescription: alternate'");
         }
+        successfullyParsed = true;
     </script>
+    
+<script src="../fast/js/resources/js-test-post.js"></script>
 </body>
 </html>
diff --git a/LayoutTests/accessibility/input-image-alt-expected.txt b/LayoutTests/accessibility/input-image-alt-expected.txt
index 942df1a..ac0ce35 100644
--- a/LayoutTests/accessibility/input-image-alt-expected.txt
+++ b/LayoutTests/accessibility/input-image-alt-expected.txt
@@ -1,3 +1,11 @@
 
-Test passed
+This test makes sure that an input image returns its alt tag as the description
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS img.description is 'AXDescription: Submit'
+PASS successfullyParsed is true
+
+TEST COMPLETE
 
diff --git a/LayoutTests/accessibility/input-image-alt.html b/LayoutTests/accessibility/input-image-alt.html
index 373c5d4..c4333ab 100644
--- a/LayoutTests/accessibility/input-image-alt.html
+++ b/LayoutTests/accessibility/input-image-alt.html
@@ -1,32 +1,32 @@
 <html>
+<html>
+<head>
+<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
 <script>
-    if (window.layoutTestController)
-        layoutTestController.dumpAsText();
+var successfullyParsed = false;
 </script>
+<script src="../fast/js/resources/js-test-pre.js"></script>
+</head>
 <body id="body">
 
-    <!-- This test makes sure that an input image returns its alt tag as the description -->
- 
     <input type="image" alt="Submit" src="resources/cake.png" width=100 height=100 id="image1">
     
-    <div id="result"></div>
+    <p id="description"></p>
+    <div id="console"></div>
      
     <script>
         if (window.accessibilityController) {
-            var result = document.getElementById("result");
+            description("This test makes sure that an input image returns its alt tag as the description");
 
-            var image1 = document.getElementById("image1");
-            image1.focus();
+            var image1 = document.getElementById("image1").focus();
             var img = accessibilityController.focusedElement;
 
-            var pattern = "Description: Submit";
-            if (img.allAttributes().indexOf(pattern) != -1) {
-                result.innerText += "Test passed\n";
-            }
-            else {
-                 result.innerText += "Test failed\n";
-            }
+            shouldBe("img.description", "'AXDescription: Submit'");
         }
+        successfullyParsed = true;
     </script>
-</body>
+
+<script src="../fast/js/resources/js-test-post.js"></script>
+
+</body> 
 </html>
diff --git a/LayoutTests/accessibility/placeholder-expected.txt b/LayoutTests/accessibility/placeholder-expected.txt
index 942df1a..0d29332 100644
--- a/LayoutTests/accessibility/placeholder-expected.txt
+++ b/LayoutTests/accessibility/placeholder-expected.txt
@@ -1,3 +1,11 @@
 
-Test passed
+This test makes sure that the AXTitle will fall back to placeholder text if nothing else is available
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS fieldElement.title is 'AXTitle: search'
+PASS successfullyParsed is true
+
+TEST COMPLETE
 
diff --git a/LayoutTests/accessibility/placeholder.html b/LayoutTests/accessibility/placeholder.html
index 88ca1e0..9ccbbd1 100644
--- a/LayoutTests/accessibility/placeholder.html
+++ b/LayoutTests/accessibility/placeholder.html
@@ -1,33 +1,31 @@
 <html>
+<html>
+<head>
+<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
 <script>
-    if (window.layoutTestController)
-        layoutTestController.dumpAsText();
+var successfullyParsed = false;
 </script>
+<script src="../fast/js/resources/js-test-pre.js"></script>
+</head>
 <body id="body">
  
-    <!-- This test makes sure that the AXTitle will fall back to placeholder text if nothing else is available -->
- 
     <input placeholder="search" type="text" name="q" size="15" maxlength="255" id="searchterm" />
     
-    <div id="result"></div>
-
+    <p id="description"></p>
+    <div id="console"></div>
      
     <script>
         if (window.accessibilityController) {
-            var result = document.getElementById("result");
+            description("This test makes sure that the AXTitle will fall back to placeholder text if nothing else is available");
 
-            var field = document.getElementById("searchterm");
-            field.focus();
+            var field = document.getElementById("searchterm").focus();
             var fieldElement = accessibilityController.focusedElement;
-            
-            var pattern = "AXTitle: search";
-            if (fieldElement.allAttributes().indexOf(pattern) != -1) {
-                result.innerText += "Test passed\n";
-            }
-            else {
-                 result.innerText += "Test failed\n";
-            }
+            shouldBe("fieldElement.title", "'AXTitle: search'");
+
         }
+        successfullyParsed = true;
     </script>
+
+<script src="../fast/js/resources/js-test-post.js"></script>
 </body>
 </html>
diff --git a/LayoutTests/platform/mac/accessibility/image-map1-expected.txt b/LayoutTests/platform/mac/accessibility/image-map1-expected.txt
index 52a2bc1..5f7cd54 100644
--- a/LayoutTests/platform/mac/accessibility/image-map1-expected.txt
+++ b/LayoutTests/platform/mac/accessibility/image-map1-expected.txt
@@ -1,104 +1,16 @@
-Image map - test 1 - 3 Links
-----------------------
-AXRole: AXGroup
-AXSubrole: (null)
-AXRoleDescription: group
-AXChildren: <array of size 2>
-AXHelp: 
-AXParent: <AXGroup>
-AXSize: NSSize: {784, 36}
-AXTitle: 
-AXDescription: 
-AXValue: 
-AXFocused: 0
-AXEnabled: 1
-AXWindow: <AXGroup>
-AXSelectedTextMarkerRange: (null)
-AXStartTextMarker: <AXGroup>
-AXEndTextMarker: <AXGroup>
-AXVisited: 0
-AXLinkedUIElements: (null)
-AXSelected: 0
-AXBlockQuoteLevel: 0
-AXTopLevelUIElement: <AXGroup>
-AXTitleUIElement: (null)
-
-------------
-AXRole: AXLink
-AXSubrole: (null)
-AXRoleDescription: link
-AXChildren: <array of size 0>
-AXHelp: 
-AXParent: <AXLink: 'Link1'>
-AXSize: NSSize: {123, 62}
-AXTitle: Link1
-AXDescription: 
-AXValue: 
-AXFocused: 0
-AXEnabled: 1
-AXWindow: <AXLink: 'Link1'>
-AXSelectedTextMarkerRange: (null)
-AXStartTextMarker: (null)
-AXEndTextMarker: (null)
-AXVisited: 0
-AXLinkedUIElements: (null)
-AXSelected: 0
-AXBlockQuoteLevel: 0
-AXTopLevelUIElement: <AXLink: 'Link1'>
-AXURL: http://www.apple.com/
-AXAccessKey: (null)
-
-------------
-AXRole: AXLink
-AXSubrole: (null)
-AXRoleDescription: link
-AXChildren: <array of size 0>
-AXHelp: 
-AXParent: <AXLink: 'Link2'>
-AXSize: NSSize: {122, 14}
-AXTitle: Link2
-AXDescription: 
-AXValue: 
-AXFocused: 0
-AXEnabled: 1
-AXWindow: <AXLink: 'Link2'>
-AXSelectedTextMarkerRange: (null)
-AXStartTextMarker: (null)
-AXEndTextMarker: (null)
-AXVisited: 0
-AXLinkedUIElements: (null)
-AXSelected: 0
-AXBlockQuoteLevel: 0
-AXTopLevelUIElement: <AXLink: 'Link2'>
-AXURL: http://www.apple.com/
-AXAccessKey: (null)
-
-------------
-AXRole: AXLink
-AXSubrole: (null)
-AXRoleDescription: link
-AXChildren: <array of size 0>
-AXHelp: 
-AXParent: <AXLink: 'Link3'>
-AXSize: NSSize: {122, 14}
-AXTitle: Link3
-AXDescription: 
-AXValue: 
-AXFocused: 0
-AXEnabled: 1
-AXWindow: <AXLink: 'Link3'>
-AXSelectedTextMarkerRange: (null)
-AXStartTextMarker: (null)
-AXEndTextMarker: (null)
-AXVisited: 0
-AXLinkedUIElements: (null)
-AXSelected: 0
-AXBlockQuoteLevel: 0
-AXTopLevelUIElement: <AXLink: 'Link3'>
-AXURL: http://www.apple.com/
-AXAccessKey: (null)
-
-------------
-
-
  
+This tests that you can reach the links within an image map.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS body.childAtIndex(0).role is 'AXRole: AXLink'
+PASS body.childAtIndex(0).title is 'AXTitle: Link1'
+PASS body.childAtIndex(1).role is 'AXRole: AXLink'
+PASS body.childAtIndex(1).title is 'AXTitle: Link2'
+PASS body.childAtIndex(2).role is 'AXRole: AXLink'
+PASS body.childAtIndex(2).title is 'AXTitle: Link3'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+