| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 std::vector<int32_t> change_finished_ids_; | 112 std::vector<int32_t> change_finished_ids_; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 } // namespace | 115 } // namespace |
| 116 | 116 |
| 117 TEST(AXTreeTest, SerializeSimpleAXTree) { | 117 TEST(AXTreeTest, SerializeSimpleAXTree) { |
| 118 AXNodeData root; | 118 AXNodeData root; |
| 119 root.id = 1; | 119 root.id = 1; |
| 120 root.role = AX_ROLE_DIALOG; | 120 root.role = AX_ROLE_DIALOG; |
| 121 root.state = 1 << AX_STATE_FOCUSABLE; | 121 root.state = 1 << AX_STATE_FOCUSABLE; |
| 122 root.location = gfx::Rect(0, 0, 800, 600); | 122 root.location = gfx::RectF(0, 0, 800, 600); |
| 123 root.child_ids.push_back(2); | 123 root.child_ids.push_back(2); |
| 124 root.child_ids.push_back(3); | 124 root.child_ids.push_back(3); |
| 125 | 125 |
| 126 AXNodeData button; | 126 AXNodeData button; |
| 127 button.id = 2; | 127 button.id = 2; |
| 128 button.role = AX_ROLE_BUTTON; | 128 button.role = AX_ROLE_BUTTON; |
| 129 button.state = 0; | 129 button.state = 0; |
| 130 button.location = gfx::Rect(20, 20, 200, 30); | 130 button.location = gfx::RectF(20, 20, 200, 30); |
| 131 | 131 |
| 132 AXNodeData checkbox; | 132 AXNodeData checkbox; |
| 133 checkbox.id = 3; | 133 checkbox.id = 3; |
| 134 checkbox.role = AX_ROLE_CHECK_BOX; | 134 checkbox.role = AX_ROLE_CHECK_BOX; |
| 135 checkbox.state = 0; | 135 checkbox.state = 0; |
| 136 checkbox.location = gfx::Rect(20, 50, 200, 30); | 136 checkbox.location = gfx::RectF(20, 50, 200, 30); |
| 137 | 137 |
| 138 AXTreeUpdate initial_state; | 138 AXTreeUpdate initial_state; |
| 139 initial_state.root_id = 1; | 139 initial_state.root_id = 1; |
| 140 initial_state.nodes.push_back(root); | 140 initial_state.nodes.push_back(root); |
| 141 initial_state.nodes.push_back(button); | 141 initial_state.nodes.push_back(button); |
| 142 initial_state.nodes.push_back(checkbox); | 142 initial_state.nodes.push_back(checkbox); |
| 143 initial_state.has_tree_data = true; | 143 initial_state.has_tree_data = true; |
| 144 initial_state.tree_data.title = "Title"; | 144 initial_state.tree_data.title = "Title"; |
| 145 AXSerializableTree src_tree(initial_state); | 145 AXSerializableTree src_tree(initial_state); |
| 146 | 146 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 std::vector<int> node_reparented = | 426 std::vector<int> node_reparented = |
| 427 fake_delegate.node_reparented_finished_ids(); | 427 fake_delegate.node_reparented_finished_ids(); |
| 428 ASSERT_EQ(std::find(created.begin(), created.end(), 3), created.end()); | 428 ASSERT_EQ(std::find(created.begin(), created.end(), 3), created.end()); |
| 429 ASSERT_NE(std::find(subtree_reparented.begin(), subtree_reparented.end(), 3), | 429 ASSERT_NE(std::find(subtree_reparented.begin(), subtree_reparented.end(), 3), |
| 430 subtree_reparented.end()); | 430 subtree_reparented.end()); |
| 431 ASSERT_EQ(std::find(node_reparented.begin(), node_reparented.end(), 3), | 431 ASSERT_EQ(std::find(node_reparented.begin(), node_reparented.end(), 3), |
| 432 node_reparented.end()); | 432 node_reparented.end()); |
| 433 } | 433 } |
| 434 | 434 |
| 435 } // namespace ui | 435 } // namespace ui |
| OLD | NEW |