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

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: Added another 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
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..1f782b83a81af381e7a22c8acf6b173d6bde19f4
--- /dev/null
+++ b/LayoutTests/resources/accessibility-helper.js
@@ -0,0 +1,36 @@
+function buildAccessibilityTree(accessibilityObject, indent, allAttributesRequired, targetObject, targetString) {
+ if (accessibilityObject.role == 'AXRole: AXColumn' || accessibilityObject.role == 'AXRole: AXTableHeaderContainer')
dmazzoni 2015/01/28 20:38:03 This should be a parameter rather than every test
+ 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, targetObject, targetString))
+ return false;
+ }
+
+ return true;
+}
+
+function generateAccessibilityTree(accessibilityObject) {
+ var count = accessibilityObject.childrenCount;
+ for (var i = 0; i < count; i++) {
+ if (!generateAccessibilityTree(accessibilityObject.childAtIndex(i)))
+ return false;
+ }
+
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698