OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 ax_tree.GetChildren(content, &content_children); | 91 ax_tree.GetChildren(content, &content_children); |
92 ASSERT_EQ(1U, content_children.size()); | 92 ASSERT_EQ(1U, content_children.size()); |
93 | 93 |
94 // Walk down to the text field and assert it is what we expect. | 94 // Walk down to the text field and assert it is what we expect. |
95 AXAuraObjWrapper* textfield = content_children[0]; | 95 AXAuraObjWrapper* textfield = content_children[0]; |
96 AXAuraObjWrapper* cached_textfield = | 96 AXAuraObjWrapper* cached_textfield = |
97 AXAuraObjCache::GetInstance()->GetOrCreate(textfield_); | 97 AXAuraObjCache::GetInstance()->GetOrCreate(textfield_); |
98 ASSERT_EQ(cached_textfield, textfield); | 98 ASSERT_EQ(cached_textfield, textfield); |
99 std::vector<AXAuraObjWrapper*> textfield_children; | 99 std::vector<AXAuraObjWrapper*> textfield_children; |
100 ax_tree.GetChildren(textfield, &textfield_children); | 100 ax_tree.GetChildren(textfield, &textfield_children); |
101 ASSERT_EQ(0U, textfield_children.size()); | 101 ASSERT_EQ(1U, textfield_children.size()); |
102 | 102 |
103 ASSERT_EQ(content, textfield->GetParent()); | 103 ASSERT_EQ(content, textfield->GetParent()); |
104 | 104 |
105 // Try walking up the tree to the root. | 105 // Try walking up the tree to the root. |
106 AXAuraObjWrapper* test_root = NULL; | 106 AXAuraObjWrapper* test_root = NULL; |
107 for (AXAuraObjWrapper* root_finder = ax_tree.GetParent(content); root_finder; | 107 for (AXAuraObjWrapper* root_finder = ax_tree.GetParent(content); root_finder; |
108 root_finder = ax_tree.GetParent(root_finder)) | 108 root_finder = ax_tree.GetParent(root_finder)) |
109 test_root = root_finder; | 109 test_root = root_finder; |
110 ASSERT_EQ(ax_tree.GetRoot(), test_root); | 110 ASSERT_EQ(ax_tree.GetRoot(), test_root); |
111 } | 111 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 int text_field_update_index = -1; | 169 int text_field_update_index = -1; |
170 for (size_t i = 0; i < node_count; ++i) { | 170 for (size_t i = 0; i < node_count; ++i) { |
171 if (textfield_wrapper->GetID() == out_update2.nodes[i].id) | 171 if (textfield_wrapper->GetID() == out_update2.nodes[i].id) |
172 text_field_update_index = i; | 172 text_field_update_index = i; |
173 } | 173 } |
174 | 174 |
175 ASSERT_NE(-1, text_field_update_index); | 175 ASSERT_NE(-1, text_field_update_index); |
176 ASSERT_EQ(ui::AX_ROLE_TEXT_FIELD, | 176 ASSERT_EQ(ui::AX_ROLE_TEXT_FIELD, |
177 out_update2.nodes[text_field_update_index].role); | 177 out_update2.nodes[text_field_update_index].role); |
178 } | 178 } |
OLD | NEW |