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

Unified Diff: ui/accessibility/ax_tree_unittest.cc

Issue 1151393006: An accessibility tree update with two roots should be rejected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « ui/accessibility/ax_tree.cc ('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_unittest.cc
diff --git a/ui/accessibility/ax_tree_unittest.cc b/ui/accessibility/ax_tree_unittest.cc
index 83a8ae5abd5aeb86a3b1001f247cd7998e9d61fe..98ca7e5b2c896702920ac9da200472459f37a345 100644
--- a/ui/accessibility/ax_tree_unittest.cc
+++ b/ui/accessibility/ax_tree_unittest.cc
@@ -283,6 +283,24 @@ TEST(AXTreeTest, InvalidReparentingFails) {
ASSERT_EQ("Node 3 reparented from 2 to 1", tree.error());
}
+TEST(AXTreeTest, TwoRootsFails) {
+ AXTreeUpdate initial_state;
+ initial_state.nodes.resize(1);
+ initial_state.nodes[0].id = 1;
+ initial_state.nodes[0].role = AX_ROLE_ROOT_WEB_AREA;
+ AXTree tree(initial_state);
+
+ // This should fail because there are two new roots.
+ AXTreeUpdate update;
+ update.nodes.resize(2);
+ update.nodes[0].id = 2;
+ update.nodes[0].role = AX_ROLE_ROOT_WEB_AREA;
+ update.nodes[1].id = 3;
+ update.nodes[1].role = AX_ROLE_ROOT_WEB_AREA;
+ EXPECT_FALSE(tree.Unserialize(update));
+ ASSERT_EQ("Tree update contains two new roots", tree.error());
+}
+
TEST(AXTreeTest, TreeDelegateIsCalled) {
AXTreeUpdate initial_state;
initial_state.nodes.resize(2);
« no previous file with comments | « ui/accessibility/ax_tree.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698