Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Unified Diff: LayoutTests/resources/accessibility-helper.js

Issue 876003003: Extract buildAccessibilityTree() from the individual layout test. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated some tests and added rolesToIgnore param to helper function. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/accessibility/table-with-empty-thead-causes-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+}
« no previous file with comments | « LayoutTests/accessibility/table-with-empty-thead-causes-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698