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

Unified Diff: ui/accessibility/ax_tree_serializer.h

Issue 1195353002: Add aria-owns DumpAccessibilityTree test and make it pass. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add link to test from code change Created 5 years, 6 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 | « content/test/data/accessibility/aria/aria-owns-expected-win.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/accessibility/ax_tree_serializer.h
diff --git a/ui/accessibility/ax_tree_serializer.h b/ui/accessibility/ax_tree_serializer.h
index 5435bbe2bae702eb274fcfc18b160a2fee67fe49..c2b124e1b316eb4fd7321638ffa290d43ba746b5 100644
--- a/ui/accessibility/ax_tree_serializer.h
+++ b/ui/accessibility/ax_tree_serializer.h
@@ -137,6 +137,9 @@ class AXTreeSerializer {
void SerializeChangedNodes(AXSourceNode node,
AXTreeUpdate* out_update);
+ // Visit all of the descendants of |node| once.
+ void WalkAllDescendants(AXSourceNode node);
+
// The tree source.
AXTreeSource<AXSourceNode>* tree_;
@@ -329,6 +332,13 @@ void AXTreeSerializer<AXSourceNode>::SerializeChanges(
// Serialize from the LCA, or from the root if there isn't one.
if (!tree_->IsValid(lca))
lca = tree_->GetRoot();
+
+ // Work around flaky source trees where nodes don't figure out their
+ // correct parent/child relationships until you walk the whole tree once.
+ // Covered by this test in the content_browsertests suite:
+ // DumpAccessibilityTreeTest.AccessibilityAriaOwns.
+ WalkAllDescendants(lca);
+
SerializeChangedNodes(lca, out_update);
}
@@ -472,6 +482,15 @@ void AXTreeSerializer<AXSourceNode>::SerializeChangedNodes(
actual_serialized_node_child_ids);
}
+template<typename AXSourceNode>
+void AXTreeSerializer<AXSourceNode>::WalkAllDescendants(
+ AXSourceNode node) {
+ std::vector<AXSourceNode> children;
+ tree_->GetChildren(node, &children);
+ for (size_t i = 0; i < children.size(); ++i)
+ WalkAllDescendants(children[i]);
+}
+
} // namespace ui
#endif // UI_ACCESSIBILITY_AX_TREE_SERIALIZER_H_
« no previous file with comments | « content/test/data/accessibility/aria/aria-owns-expected-win.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698