OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/accessibility/ax_node.h" | 8 #include "ui/accessibility/ax_node.h" |
9 #include "ui/accessibility/ax_serializable_tree.h" | 9 #include "ui/accessibility/ax_serializable_tree.h" |
10 #include "ui/accessibility/ax_tree.h" | 10 #include "ui/accessibility/ax_tree.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 AXNode* button_node = root_node->ChildAtIndex(0); | 58 AXNode* button_node = root_node->ChildAtIndex(0); |
59 EXPECT_EQ(button.id, button_node->id()); | 59 EXPECT_EQ(button.id, button_node->id()); |
60 EXPECT_EQ(button.role, button_node->data().role); | 60 EXPECT_EQ(button.role, button_node->data().role); |
61 | 61 |
62 AXNode* checkbox_node = root_node->ChildAtIndex(1); | 62 AXNode* checkbox_node = root_node->ChildAtIndex(1); |
63 EXPECT_EQ(checkbox.id, checkbox_node->id()); | 63 EXPECT_EQ(checkbox.id, checkbox_node->id()); |
64 EXPECT_EQ(checkbox.role, checkbox_node->data().role); | 64 EXPECT_EQ(checkbox.role, checkbox_node->data().role); |
65 | 65 |
66 EXPECT_EQ( | 66 EXPECT_EQ( |
67 "id=1 ROOT_WEB_AREA FOCUSABLE FOCUSED (0, 0)-(800, 600) child_ids=2,3\n" | 67 "id=1 root_web_area FOCUSABLE FOCUSED (0, 0)-(800, 600) child_ids=2,3\n" |
68 " id=2 BUTTON (20, 20)-(200, 30)\n" | 68 " id=2 button (20, 20)-(200, 30)\n" |
69 " id=3 CHECKBOX (20, 50)-(200, 30)\n", | 69 " id=3 check_box (20, 50)-(200, 30)\n", |
70 dst_tree.ToString()); | 70 dst_tree.ToString()); |
71 } | 71 } |
72 | 72 |
73 TEST(AXTreeTest, DeleteUnknownSubtreeFails) { | 73 TEST(AXTreeTest, DeleteUnknownSubtreeFails) { |
74 AXNodeData root; | 74 AXNodeData root; |
75 root.id = 1; | 75 root.id = 1; |
76 root.role = AX_ROLE_ROOT_WEB_AREA; | 76 root.role = AX_ROLE_ROOT_WEB_AREA; |
77 | 77 |
78 AXTreeUpdate initial_state; | 78 AXTreeUpdate initial_state; |
79 initial_state.nodes.push_back(root); | 79 initial_state.nodes.push_back(root); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 update.nodes[0].role = AX_ROLE_ROOT_WEB_AREA; | 168 update.nodes[0].role = AX_ROLE_ROOT_WEB_AREA; |
169 update.nodes[0].child_ids.push_back(3); | 169 update.nodes[0].child_ids.push_back(3); |
170 update.nodes[0].child_ids.push_back(2); | 170 update.nodes[0].child_ids.push_back(2); |
171 update.nodes[1].id = 2; | 171 update.nodes[1].id = 2; |
172 update.nodes[2].id = 3; | 172 update.nodes[2].id = 3; |
173 EXPECT_FALSE(tree.Unserialize(update)); | 173 EXPECT_FALSE(tree.Unserialize(update)); |
174 ASSERT_EQ("Node 3 reparented from 2 to 1", tree.error()); | 174 ASSERT_EQ("Node 3 reparented from 2 to 1", tree.error()); |
175 } | 175 } |
176 | 176 |
177 } // namespace ui | 177 } // namespace ui |
OLD | NEW |