| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 const AXNode* button_node = root_node->ChildAtIndex(0); | 104 const AXNode* button_node = root_node->ChildAtIndex(0); |
| 105 EXPECT_EQ(button.id, button_node->id()); | 105 EXPECT_EQ(button.id, button_node->id()); |
| 106 EXPECT_EQ(button.role, button_node->data().role); | 106 EXPECT_EQ(button.role, button_node->data().role); |
| 107 | 107 |
| 108 const AXNode* checkbox_node = root_node->ChildAtIndex(1); | 108 const AXNode* checkbox_node = root_node->ChildAtIndex(1); |
| 109 EXPECT_EQ(checkbox.id, checkbox_node->id()); | 109 EXPECT_EQ(checkbox.id, checkbox_node->id()); |
| 110 EXPECT_EQ(checkbox.role, checkbox_node->data().role); | 110 EXPECT_EQ(checkbox.role, checkbox_node->data().role); |
| 111 | 111 |
| 112 EXPECT_EQ( | 112 EXPECT_EQ( |
| 113 "id=1 root_web_area FOCUSABLE FOCUSED (0, 0)-(800, 600) child_ids=2,3\n" | 113 "id=1 rootWebArea FOCUSABLE FOCUSED (0, 0)-(800, 600) child_ids=2,3\n" |
| 114 " id=2 button (20, 20)-(200, 30)\n" | 114 " id=2 button (20, 20)-(200, 30)\n" |
| 115 " id=3 check_box (20, 50)-(200, 30)\n", | 115 " id=3 checkBox (20, 50)-(200, 30)\n", |
| 116 dst_tree.ToString()); | 116 dst_tree.ToString()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 TEST(AXTreeTest, SerializeAXTreeUpdate) { | 119 TEST(AXTreeTest, SerializeAXTreeUpdate) { |
| 120 AXNodeData list; | 120 AXNodeData list; |
| 121 list.id = 3; | 121 list.id = 3; |
| 122 list.role = AX_ROLE_LIST; | 122 list.role = AX_ROLE_LIST; |
| 123 list.state = 0; | 123 list.state = 0; |
| 124 list.child_ids.push_back(4); | 124 list.child_ids.push_back(4); |
| 125 list.child_ids.push_back(5); | 125 list.child_ids.push_back(5); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 141 button.state = 0; | 141 button.state = 0; |
| 142 | 142 |
| 143 AXTreeUpdate update; | 143 AXTreeUpdate update; |
| 144 update.nodes.push_back(list); | 144 update.nodes.push_back(list); |
| 145 update.nodes.push_back(list_item_2); | 145 update.nodes.push_back(list_item_2); |
| 146 update.nodes.push_back(list_item_3); | 146 update.nodes.push_back(list_item_3); |
| 147 update.nodes.push_back(button); | 147 update.nodes.push_back(button); |
| 148 | 148 |
| 149 EXPECT_EQ( | 149 EXPECT_EQ( |
| 150 "id=3 list (0, 0)-(0, 0) child_ids=4,5,6\n" | 150 "id=3 list (0, 0)-(0, 0) child_ids=4,5,6\n" |
| 151 " id=5 list_item (0, 0)-(0, 0)\n" | 151 " id=5 listItem (0, 0)-(0, 0)\n" |
| 152 " id=6 list_item (0, 0)-(0, 0)\n" | 152 " id=6 listItem (0, 0)-(0, 0)\n" |
| 153 "id=7 button (0, 0)-(0, 0)\n", | 153 "id=7 button (0, 0)-(0, 0)\n", |
| 154 update.ToString()); | 154 update.ToString()); |
| 155 } | 155 } |
| 156 | 156 |
| 157 TEST(AXTreeTest, DeleteUnknownSubtreeFails) { | 157 TEST(AXTreeTest, DeleteUnknownSubtreeFails) { |
| 158 AXNodeData root; | 158 AXNodeData root; |
| 159 root.id = 1; | 159 root.id = 1; |
| 160 root.role = AX_ROLE_ROOT_WEB_AREA; | 160 root.role = AX_ROLE_ROOT_WEB_AREA; |
| 161 | 161 |
| 162 AXTreeUpdate initial_state; | 162 AXTreeUpdate initial_state; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 EXPECT_EQ(2, fake_delegate.creation_finished_ids()[0]); | 289 EXPECT_EQ(2, fake_delegate.creation_finished_ids()[0]); |
| 290 EXPECT_EQ(3, fake_delegate.creation_finished_ids()[1]); | 290 EXPECT_EQ(3, fake_delegate.creation_finished_ids()[1]); |
| 291 | 291 |
| 292 ASSERT_EQ(1U, fake_delegate.new_root_ids().size()); | 292 ASSERT_EQ(1U, fake_delegate.new_root_ids().size()); |
| 293 EXPECT_EQ(2, fake_delegate.new_root_ids()[0]); | 293 EXPECT_EQ(2, fake_delegate.new_root_ids()[0]); |
| 294 | 294 |
| 295 tree.SetDelegate(NULL); | 295 tree.SetDelegate(NULL); |
| 296 } | 296 } |
| 297 | 297 |
| 298 } // namespace ui | 298 } // namespace ui |
| OLD | NEW |