Index: LayoutTests/resources/accessibility-helper.js |
diff --git a/LayoutTests/resources/accessibility-helper.js b/LayoutTests/resources/accessibility-helper.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..66235a3cd9e52d62f80263c987eb56b1007f48ef |
--- /dev/null |
+++ b/LayoutTests/resources/accessibility-helper.js |
@@ -0,0 +1,30 @@ |
+function buildAccessibilityTree(accessibilityObject, indent, allAttributesRequired, rolesToIgnore, targetObject, targetString) { |
+ if (rolesToIgnore) { |
+ for (var i = 0; i < rolesToIgnore.length; i++) { |
+ if (accessibilityObject.role == 'AXRole: ' + rolesToIgnore[i]) |
+ return true; |
+ } |
+ } |
+ |
+ var str = ""; |
+ for (var i = 0; i < indent; i++) |
+ str += " "; |
+ str += accessibilityObject.role; |
+ str += " " + accessibilityObject.stringValue; |
+ str += allAttributesRequired && accessibilityObject.role == '' ? accessibilityObject.allAttributes() : ''; |
+ str += targetObject && accessibilityObject.isEqual(targetObject) ? " " + targetString : ''; |
+ str += "\n"; |
+ |
+ document.getElementById("console").innerText += str; |
+ |
+ if (accessibilityObject.stringValue.indexOf('End of test') >= 0) |
+ return false; |
+ |
+ var count = accessibilityObject.childrenCount; |
+ for (var i = 0; i < count; i++) { |
+ if (!buildAccessibilityTree(accessibilityObject.childAtIndex(i), indent + 1, allAttributesRequired, rolesToIgnore, targetObject, targetString)) |
+ return false; |
+ } |
+ |
+ return true; |
+} |