| 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 "ui/accessibility/ax_tree.h" | 5 #include "ui/accessibility/ax_tree.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 const AXNode* button_node = root_node->ChildAtIndex(0); | 256 const AXNode* button_node = root_node->ChildAtIndex(0); |
| 257 EXPECT_EQ(button.id, button_node->id()); | 257 EXPECT_EQ(button.id, button_node->id()); |
| 258 EXPECT_EQ(button.role, button_node->data().role); | 258 EXPECT_EQ(button.role, button_node->data().role); |
| 259 | 259 |
| 260 const AXNode* checkbox_node = root_node->ChildAtIndex(1); | 260 const AXNode* checkbox_node = root_node->ChildAtIndex(1); |
| 261 EXPECT_EQ(checkbox.id, checkbox_node->id()); | 261 EXPECT_EQ(checkbox.id, checkbox_node->id()); |
| 262 EXPECT_EQ(checkbox.role, checkbox_node->data().role); | 262 EXPECT_EQ(checkbox.role, checkbox_node->data().role); |
| 263 | 263 |
| 264 EXPECT_EQ( | 264 EXPECT_EQ( |
| 265 "AXTree title=Title\n" | 265 "AXTree title=Title\n" |
| 266 "id=1 dialog FOCUSABLE (0, 0)-(800, 600) child_ids=2,3\n" | 266 "id=1 dialog FOCUSABLE (0, 0)-(800, 600) actions= child_ids=2,3\n" |
| 267 " id=2 button (20, 20)-(200, 30)\n" | 267 " id=2 button (20, 20)-(200, 30) actions=\n" |
| 268 " id=3 checkBox (20, 50)-(200, 30)\n", | 268 " id=3 checkBox (20, 50)-(200, 30) actions=\n", |
| 269 dst_tree.ToString()); | 269 dst_tree.ToString()); |
| 270 } | 270 } |
| 271 | 271 |
| 272 TEST(AXTreeTest, SerializeAXTreeUpdate) { | 272 TEST(AXTreeTest, SerializeAXTreeUpdate) { |
| 273 AXNodeData list; | 273 AXNodeData list; |
| 274 list.id = 3; | 274 list.id = 3; |
| 275 list.role = AX_ROLE_LIST; | 275 list.role = AX_ROLE_LIST; |
| 276 list.child_ids.push_back(4); | 276 list.child_ids.push_back(4); |
| 277 list.child_ids.push_back(5); | 277 list.child_ids.push_back(5); |
| 278 list.child_ids.push_back(6); | 278 list.child_ids.push_back(6); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 291 | 291 |
| 292 AXTreeUpdate update; | 292 AXTreeUpdate update; |
| 293 update.root_id = 3; | 293 update.root_id = 3; |
| 294 update.nodes.push_back(list); | 294 update.nodes.push_back(list); |
| 295 update.nodes.push_back(list_item_2); | 295 update.nodes.push_back(list_item_2); |
| 296 update.nodes.push_back(list_item_3); | 296 update.nodes.push_back(list_item_3); |
| 297 update.nodes.push_back(button); | 297 update.nodes.push_back(button); |
| 298 | 298 |
| 299 EXPECT_EQ( | 299 EXPECT_EQ( |
| 300 "AXTreeUpdate: root id 3\n" | 300 "AXTreeUpdate: root id 3\n" |
| 301 "id=3 list (0, 0)-(0, 0) child_ids=4,5,6\n" | 301 "id=3 list (0, 0)-(0, 0) actions= child_ids=4,5,6\n" |
| 302 " id=5 listItem (0, 0)-(0, 0)\n" | 302 " id=5 listItem (0, 0)-(0, 0) actions=\n" |
| 303 " id=6 listItem (0, 0)-(0, 0)\n" | 303 " id=6 listItem (0, 0)-(0, 0) actions=\n" |
| 304 "id=7 button (0, 0)-(0, 0)\n", | 304 "id=7 button (0, 0)-(0, 0) actions=\n", |
| 305 update.ToString()); | 305 update.ToString()); |
| 306 } | 306 } |
| 307 | 307 |
| 308 TEST(AXTreeTest, DeleteUnknownSubtreeFails) { | 308 TEST(AXTreeTest, DeleteUnknownSubtreeFails) { |
| 309 AXNodeData root; | 309 AXNodeData root; |
| 310 root.id = 1; | 310 root.id = 1; |
| 311 | 311 |
| 312 AXTreeUpdate initial_state; | 312 AXTreeUpdate initial_state; |
| 313 initial_state.root_id = 1; | 313 initial_state.root_id = 1; |
| 314 initial_state.nodes.push_back(root); | 314 initial_state.nodes.push_back(root); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 fake_delegate2.attribute_change_log(); | 777 fake_delegate2.attribute_change_log(); |
| 778 ASSERT_EQ(3U, change_log2.size()); | 778 ASSERT_EQ(3U, change_log2.size()); |
| 779 EXPECT_EQ("controlsIds changed from 2,2 to ", change_log2[0]); | 779 EXPECT_EQ("controlsIds changed from 2,2 to ", change_log2[0]); |
| 780 EXPECT_EQ("detailsIds changed from 3 to 2,2", change_log2[1]); | 780 EXPECT_EQ("detailsIds changed from 3 to 2,2", change_log2[1]); |
| 781 EXPECT_EQ("flowtoIds changed from to 3", change_log2[2]); | 781 EXPECT_EQ("flowtoIds changed from to 3", change_log2[2]); |
| 782 | 782 |
| 783 tree.SetDelegate(NULL); | 783 tree.SetDelegate(NULL); |
| 784 } | 784 } |
| 785 | 785 |
| 786 } // namespace ui | 786 } // namespace ui |
| OLD | NEW |