OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
11 #include "content/public/browser/notification_types.h" | 11 #include "content/public/browser/notification_types.h" |
12 #include "content/public/browser/render_widget_host_view.h" | 12 #include "content/public/browser/render_widget_host_view.h" |
13 #include "content/shell/browser/shell.h" | 13 #include "content/shell/browser/shell.h" |
14 #include "content/test/accessibility_browser_test_utils.h" | 14 #include "content/test/accessibility_browser_test_utils.h" |
15 #include "content/test/content_browser_test.h" | 15 #include "content/test/content_browser_test.h" |
16 #include "content/test/content_browser_test_utils.h" | 16 #include "content/test/content_browser_test_utils.h" |
| 17 #include "ui/accessibility/ax_node.h" |
17 | 18 |
18 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
19 #include <atlbase.h> | 20 #include <atlbase.h> |
20 #include <atlcom.h> | 21 #include <atlcom.h> |
21 #include "base/win/scoped_com_initializer.h" | 22 #include "base/win/scoped_com_initializer.h" |
22 #include "ui/base/win/atl_module.h" | 23 #include "ui/base/win/atl_module.h" |
23 #endif | 24 #endif |
24 | 25 |
25 // TODO(dmazzoni): Disabled accessibility tests on Win64. crbug.com/179717 | 26 // TODO(dmazzoni): Disabled accessibility tests on Win64. crbug.com/179717 |
26 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) | 27 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) |
27 #define MAYBE_TableSpan DISABLED_TableSpan | 28 #define MAYBE_TableSpan DISABLED_TableSpan |
28 #else | 29 #else |
29 #define MAYBE_TableSpan TableSpan | 30 #define MAYBE_TableSpan TableSpan |
30 #endif | 31 #endif |
31 | 32 |
32 namespace content { | 33 namespace content { |
33 | 34 |
34 class CrossPlatformAccessibilityBrowserTest : public ContentBrowserTest { | 35 class CrossPlatformAccessibilityBrowserTest : public ContentBrowserTest { |
35 public: | 36 public: |
36 CrossPlatformAccessibilityBrowserTest() {} | 37 CrossPlatformAccessibilityBrowserTest() {} |
37 | 38 |
38 // Tell the renderer to send an accessibility tree, then wait for the | 39 // Tell the renderer to send an accessibility tree, then wait for the |
39 // notification that it's been received. | 40 // notification that it's been received. |
40 const AccessibilityNodeDataTreeNode& GetAccessibilityNodeDataTree( | 41 const ui::AXTree& GetAXTree( |
41 AccessibilityMode accessibility_mode = AccessibilityModeComplete) { | 42 AccessibilityMode accessibility_mode = AccessibilityModeComplete) { |
42 AccessibilityNotificationWaiter waiter( | 43 AccessibilityNotificationWaiter waiter( |
43 shell(), accessibility_mode, blink::WebAXEventLayoutComplete); | 44 shell(), accessibility_mode, ui::AX_EVENT_LAYOUT_COMPLETE); |
44 waiter.WaitForNotification(); | 45 waiter.WaitForNotification(); |
45 return waiter.GetAccessibilityNodeDataTree(); | 46 return waiter.GetAXTree(); |
46 } | 47 } |
47 | 48 |
48 // Make sure each node in the tree has an unique id. | 49 // Make sure each node in the tree has an unique id. |
49 void RecursiveAssertUniqueIds( | 50 void RecursiveAssertUniqueIds( |
50 const AccessibilityNodeDataTreeNode& node, base::hash_set<int>* ids) { | 51 const ui::AXNode* node, base::hash_set<int>* ids) { |
51 ASSERT_TRUE(ids->find(node.id) == ids->end()); | 52 ASSERT_TRUE(ids->find(node->id()) == ids->end()); |
52 ids->insert(node.id); | 53 ids->insert(node->id()); |
53 for (size_t i = 0; i < node.children.size(); i++) | 54 for (int i = 0; i < node->child_count(); i++) |
54 RecursiveAssertUniqueIds(node.children[i], ids); | 55 RecursiveAssertUniqueIds(node->ChildAtIndex(i), ids); |
55 } | 56 } |
56 | 57 |
57 // ContentBrowserTest | 58 // ContentBrowserTest |
58 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; | 59 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; |
59 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; | 60 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; |
60 | 61 |
61 protected: | 62 protected: |
62 std::string GetAttr(const AccessibilityNodeData& node, | 63 std::string GetAttr(const ui::AXNode* node, |
63 const AccessibilityNodeData::StringAttribute attr); | 64 const ui::AXStringAttribute attr); |
64 int GetIntAttr(const AccessibilityNodeData& node, | 65 int GetIntAttr(const ui::AXNode* node, |
65 const AccessibilityNodeData::IntAttribute attr); | 66 const ui::AXIntAttribute attr); |
66 bool GetBoolAttr(const AccessibilityNodeData& node, | 67 bool GetBoolAttr(const ui::AXNode* node, |
67 const AccessibilityNodeData::BoolAttribute attr); | 68 const ui::AXBoolAttribute attr); |
68 | 69 |
69 private: | 70 private: |
70 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
71 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; | 72 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; |
72 #endif | 73 #endif |
73 | 74 |
74 DISALLOW_COPY_AND_ASSIGN(CrossPlatformAccessibilityBrowserTest); | 75 DISALLOW_COPY_AND_ASSIGN(CrossPlatformAccessibilityBrowserTest); |
75 }; | 76 }; |
76 | 77 |
77 void CrossPlatformAccessibilityBrowserTest::SetUpInProcessBrowserTestFixture() { | 78 void CrossPlatformAccessibilityBrowserTest::SetUpInProcessBrowserTestFixture() { |
78 #if defined(OS_WIN) | 79 #if defined(OS_WIN) |
79 ui::win::CreateATLModuleIfNeeded(); | 80 ui::win::CreateATLModuleIfNeeded(); |
80 com_initializer_.reset(new base::win::ScopedCOMInitializer()); | 81 com_initializer_.reset(new base::win::ScopedCOMInitializer()); |
81 #endif | 82 #endif |
82 } | 83 } |
83 | 84 |
84 void | 85 void |
85 CrossPlatformAccessibilityBrowserTest::TearDownInProcessBrowserTestFixture() { | 86 CrossPlatformAccessibilityBrowserTest::TearDownInProcessBrowserTestFixture() { |
86 #if defined(OS_WIN) | 87 #if defined(OS_WIN) |
87 com_initializer_.reset(); | 88 com_initializer_.reset(); |
88 #endif | 89 #endif |
89 } | 90 } |
90 | 91 |
91 // Convenience method to get the value of a particular AccessibilityNodeData | 92 // Convenience method to get the value of a particular AXNode |
92 // node attribute as a UTF-8 string. | 93 // attribute as a UTF-8 string. |
93 std::string CrossPlatformAccessibilityBrowserTest::GetAttr( | 94 std::string CrossPlatformAccessibilityBrowserTest::GetAttr( |
94 const AccessibilityNodeData& node, | 95 const ui::AXNode* node, |
95 const AccessibilityNodeData::StringAttribute attr) { | 96 const ui::AXStringAttribute attr) { |
96 for (size_t i = 0; i < node.string_attributes.size(); ++i) { | 97 const ui::AXNodeData& data = node->data(); |
97 if (node.string_attributes[i].first == attr) | 98 for (size_t i = 0; i < data.string_attributes.size(); ++i) { |
98 return node.string_attributes[i].second; | 99 if (data.string_attributes[i].first == attr) |
| 100 return data.string_attributes[i].second; |
99 } | 101 } |
100 return std::string(); | 102 return std::string(); |
101 } | 103 } |
102 | 104 |
103 // Convenience method to get the value of a particular AccessibilityNodeData | 105 // Convenience method to get the value of a particular AXNode |
104 // node integer attribute. | 106 // integer attribute. |
105 int CrossPlatformAccessibilityBrowserTest::GetIntAttr( | 107 int CrossPlatformAccessibilityBrowserTest::GetIntAttr( |
106 const AccessibilityNodeData& node, | 108 const ui::AXNode* node, |
107 const AccessibilityNodeData::IntAttribute attr) { | 109 const ui::AXIntAttribute attr) { |
108 for (size_t i = 0; i < node.int_attributes.size(); ++i) { | 110 const ui::AXNodeData& data = node->data(); |
109 if (node.int_attributes[i].first == attr) | 111 for (size_t i = 0; i < data.int_attributes.size(); ++i) { |
110 return node.int_attributes[i].second; | 112 if (data.int_attributes[i].first == attr) |
| 113 return data.int_attributes[i].second; |
111 } | 114 } |
112 return -1; | 115 return -1; |
113 } | 116 } |
114 | 117 |
115 // Convenience method to get the value of a particular AccessibilityNodeData | 118 // Convenience method to get the value of a particular AXNode |
116 // node boolean attribute. | 119 // boolean attribute. |
117 bool CrossPlatformAccessibilityBrowserTest::GetBoolAttr( | 120 bool CrossPlatformAccessibilityBrowserTest::GetBoolAttr( |
118 const AccessibilityNodeData& node, | 121 const ui::AXNode* node, |
119 const AccessibilityNodeData::BoolAttribute attr) { | 122 const ui::AXBoolAttribute attr) { |
120 for (size_t i = 0; i < node.bool_attributes.size(); ++i) { | 123 const ui::AXNodeData& data = node->data(); |
121 if (node.bool_attributes[i].first == attr) | 124 for (size_t i = 0; i < data.bool_attributes.size(); ++i) { |
122 return node.bool_attributes[i].second; | 125 if (data.bool_attributes[i].first == attr) |
| 126 return data.bool_attributes[i].second; |
123 } | 127 } |
124 return false; | 128 return false; |
125 } | 129 } |
126 | 130 |
127 // Marked flaky per http://crbug.com/101984 | 131 // Marked flaky per http://crbug.com/101984 |
128 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 132 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
129 DISABLED_WebpageAccessibility) { | 133 DISABLED_WebpageAccessibility) { |
130 // Create a data url and load it. | 134 // Create a data url and load it. |
131 const char url_str[] = | 135 const char url_str[] = |
132 "data:text/html," | 136 "data:text/html," |
133 "<!doctype html>" | 137 "<!doctype html>" |
134 "<html><head><title>Accessibility Test</title></head>" | 138 "<html><head><title>Accessibility Test</title></head>" |
135 "<body><input type='button' value='push' /><input type='checkbox' />" | 139 "<body><input type='button' value='push' /><input type='checkbox' />" |
136 "</body></html>"; | 140 "</body></html>"; |
137 GURL url(url_str); | 141 GURL url(url_str); |
138 NavigateToURL(shell(), url); | 142 NavigateToURL(shell(), url); |
139 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 143 const ui::AXTree& tree = GetAXTree(); |
| 144 const ui::AXNode* root = tree.GetRoot(); |
140 | 145 |
141 // Check properties of the root element of the tree. | 146 // Check properties of the root element of the tree. |
142 EXPECT_STREQ(url_str, | 147 EXPECT_STREQ(url_str, |
143 GetAttr(tree, AccessibilityNodeData::ATTR_DOC_URL).c_str()); | 148 GetAttr(root, ui::AX_ATTR_DOC_URL).c_str()); |
144 EXPECT_STREQ( | 149 EXPECT_STREQ( |
145 "Accessibility Test", | 150 "Accessibility Test", |
146 GetAttr(tree, AccessibilityNodeData::ATTR_DOC_TITLE).c_str()); | 151 GetAttr(root, ui::AX_ATTR_DOC_TITLE).c_str()); |
147 EXPECT_STREQ( | 152 EXPECT_STREQ( |
148 "html", GetAttr(tree, AccessibilityNodeData::ATTR_DOC_DOCTYPE).c_str()); | 153 "html", GetAttr(root, ui::AX_ATTR_DOC_DOCTYPE).c_str()); |
149 EXPECT_STREQ( | 154 EXPECT_STREQ( |
150 "text/html", | 155 "text/html", |
151 GetAttr(tree, AccessibilityNodeData::ATTR_DOC_MIMETYPE).c_str()); | 156 GetAttr(root, ui::AX_ATTR_DOC_MIMETYPE).c_str()); |
152 EXPECT_STREQ( | 157 EXPECT_STREQ( |
153 "Accessibility Test", | 158 "Accessibility Test", |
154 GetAttr(tree, AccessibilityNodeData::ATTR_NAME).c_str()); | 159 GetAttr(root, ui::AX_ATTR_NAME).c_str()); |
155 EXPECT_EQ(blink::WebAXRoleRootWebArea, tree.role); | 160 EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, root->data().role); |
156 | 161 |
157 // Check properites of the BODY element. | 162 // Check properites of the BODY element. |
158 ASSERT_EQ(1U, tree.children.size()); | 163 ASSERT_EQ(1, root->child_count()); |
159 const AccessibilityNodeDataTreeNode& body = tree.children[0]; | 164 const ui::AXNode* body = root->ChildAtIndex(0); |
160 EXPECT_EQ(blink::WebAXRoleGroup, body.role); | 165 EXPECT_EQ(ui::AX_ROLE_GROUP, body->data().role); |
161 EXPECT_STREQ("body", | 166 EXPECT_STREQ("body", |
162 GetAttr(body, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); | 167 GetAttr(body, ui::AX_ATTR_HTML_TAG).c_str()); |
163 EXPECT_STREQ("block", | 168 EXPECT_STREQ("block", |
164 GetAttr(body, AccessibilityNodeData::ATTR_DISPLAY).c_str()); | 169 GetAttr(body, ui::AX_ATTR_DISPLAY).c_str()); |
165 | 170 |
166 // Check properties of the two children of the BODY element. | 171 // Check properties of the two children of the BODY element. |
167 ASSERT_EQ(2U, body.children.size()); | 172 ASSERT_EQ(2, body->child_count()); |
168 | 173 |
169 const AccessibilityNodeDataTreeNode& button = body.children[0]; | 174 const ui::AXNode* button = body->ChildAtIndex(0); |
170 EXPECT_EQ(blink::WebAXRoleButton, button.role); | 175 EXPECT_EQ(ui::AX_ROLE_BUTTON, button->data().role); |
171 EXPECT_STREQ( | 176 EXPECT_STREQ( |
172 "input", GetAttr(button, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); | 177 "input", GetAttr(button, ui::AX_ATTR_HTML_TAG).c_str()); |
173 EXPECT_STREQ( | 178 EXPECT_STREQ( |
174 "push", | 179 "push", |
175 GetAttr(button, AccessibilityNodeData::ATTR_NAME).c_str()); | 180 GetAttr(button, ui::AX_ATTR_NAME).c_str()); |
176 EXPECT_STREQ( | 181 EXPECT_STREQ( |
177 "inline-block", | 182 "inline-block", |
178 GetAttr(button, AccessibilityNodeData::ATTR_DISPLAY).c_str()); | 183 GetAttr(button, ui::AX_ATTR_DISPLAY).c_str()); |
179 ASSERT_EQ(2U, button.html_attributes.size()); | 184 ASSERT_EQ(2U, button->data().html_attributes.size()); |
180 EXPECT_STREQ("type", button.html_attributes[0].first.c_str()); | 185 EXPECT_STREQ("type", button->data().html_attributes[0].first.c_str()); |
181 EXPECT_STREQ("button", button.html_attributes[0].second.c_str()); | 186 EXPECT_STREQ("button", button->data().html_attributes[0].second.c_str()); |
182 EXPECT_STREQ("value", button.html_attributes[1].first.c_str()); | 187 EXPECT_STREQ("value", button->data().html_attributes[1].first.c_str()); |
183 EXPECT_STREQ("push", button.html_attributes[1].second.c_str()); | 188 EXPECT_STREQ("push", button->data().html_attributes[1].second.c_str()); |
184 | 189 |
185 const AccessibilityNodeDataTreeNode& checkbox = body.children[1]; | 190 const ui::AXNode* checkbox = body->ChildAtIndex(1); |
186 EXPECT_EQ(blink::WebAXRoleCheckBox, checkbox.role); | 191 EXPECT_EQ(ui::AX_ROLE_CHECK_BOX, checkbox->data().role); |
187 EXPECT_STREQ( | 192 EXPECT_STREQ( |
188 "input", GetAttr(checkbox, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); | 193 "input", GetAttr(checkbox, ui::AX_ATTR_HTML_TAG).c_str()); |
189 EXPECT_STREQ( | 194 EXPECT_STREQ( |
190 "inline-block", | 195 "inline-block", |
191 GetAttr(checkbox, AccessibilityNodeData::ATTR_DISPLAY).c_str()); | 196 GetAttr(checkbox, ui::AX_ATTR_DISPLAY).c_str()); |
192 ASSERT_EQ(1U, checkbox.html_attributes.size()); | 197 ASSERT_EQ(1U, checkbox->data().html_attributes.size()); |
193 EXPECT_STREQ("type", checkbox.html_attributes[0].first.c_str()); | 198 EXPECT_STREQ("type", checkbox->data().html_attributes[0].first.c_str()); |
194 EXPECT_STREQ("checkbox", checkbox.html_attributes[0].second.c_str()); | 199 EXPECT_STREQ("checkbox", checkbox->data().html_attributes[0].second.c_str()); |
195 } | 200 } |
196 | 201 |
197 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 202 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
198 UnselectedEditableTextAccessibility) { | 203 UnselectedEditableTextAccessibility) { |
199 // Create a data url and load it. | 204 // Create a data url and load it. |
200 const char url_str[] = | 205 const char url_str[] = |
201 "data:text/html," | 206 "data:text/html," |
202 "<!doctype html>" | 207 "<!doctype html>" |
203 "<body>" | 208 "<body>" |
204 "<input value=\"Hello, world.\"/>" | 209 "<input value=\"Hello, world.\"/>" |
205 "</body></html>"; | 210 "</body></html>"; |
206 GURL url(url_str); | 211 GURL url(url_str); |
207 NavigateToURL(shell(), url); | 212 NavigateToURL(shell(), url); |
208 | 213 |
209 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 214 const ui::AXTree& tree = GetAXTree(); |
210 ASSERT_EQ(1U, tree.children.size()); | 215 const ui::AXNode* root = tree.GetRoot(); |
211 const AccessibilityNodeDataTreeNode& body = tree.children[0]; | 216 ASSERT_EQ(1, root->child_count()); |
212 ASSERT_EQ(1U, body.children.size()); | 217 const ui::AXNode* body = root->ChildAtIndex(0); |
213 const AccessibilityNodeDataTreeNode& text = body.children[0]; | 218 ASSERT_EQ(1, body->child_count()); |
214 EXPECT_EQ(blink::WebAXRoleTextField, text.role); | 219 const ui::AXNode* text = body->ChildAtIndex(0); |
| 220 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, text->data().role); |
215 EXPECT_STREQ( | 221 EXPECT_STREQ( |
216 "input", GetAttr(text, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); | 222 "input", GetAttr(text, ui::AX_ATTR_HTML_TAG).c_str()); |
217 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_START)); | 223 EXPECT_EQ(0, GetIntAttr(text, ui::AX_ATTR_TEXT_SEL_START)); |
218 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_END)); | 224 EXPECT_EQ(0, GetIntAttr(text, ui::AX_ATTR_TEXT_SEL_END)); |
219 EXPECT_STREQ( | 225 EXPECT_STREQ( |
220 "Hello, world.", | 226 "Hello, world.", |
221 GetAttr(text, AccessibilityNodeData::ATTR_VALUE).c_str()); | 227 GetAttr(text, ui::AX_ATTR_VALUE).c_str()); |
222 | 228 |
223 // TODO(dmazzoni): as soon as more accessibility code is cross-platform, | 229 // TODO(dmazzoni): as soon as more accessibility code is cross-platform, |
224 // this code should test that the accessible info is dynamically updated | 230 // this code should test that the accessible info is dynamically updated |
225 // if the selection or value changes. | 231 // if the selection or value changes. |
226 } | 232 } |
227 | 233 |
228 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 234 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
229 SelectedEditableTextAccessibility) { | 235 SelectedEditableTextAccessibility) { |
230 // Create a data url and load it. | 236 // Create a data url and load it. |
231 const char url_str[] = | 237 const char url_str[] = |
232 "data:text/html," | 238 "data:text/html," |
233 "<!doctype html>" | 239 "<!doctype html>" |
234 "<body onload=\"document.body.children[0].select();\">" | 240 "<body onload=\"document.body.children[0].select();\">" |
235 "<input value=\"Hello, world.\"/>" | 241 "<input value=\"Hello, world.\"/>" |
236 "</body></html>"; | 242 "</body></html>"; |
237 GURL url(url_str); | 243 GURL url(url_str); |
238 NavigateToURL(shell(), url); | 244 NavigateToURL(shell(), url); |
239 | 245 |
240 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 246 const ui::AXTree& tree = GetAXTree(); |
241 ASSERT_EQ(1U, tree.children.size()); | 247 const ui::AXNode* root = tree.GetRoot(); |
242 const AccessibilityNodeDataTreeNode& body = tree.children[0]; | 248 ASSERT_EQ(1, root->child_count()); |
243 ASSERT_EQ(1U, body.children.size()); | 249 const ui::AXNode* body = root->ChildAtIndex(0); |
244 const AccessibilityNodeDataTreeNode& text = body.children[0]; | 250 ASSERT_EQ(1, body->child_count()); |
245 EXPECT_EQ(blink::WebAXRoleTextField, text.role); | 251 const ui::AXNode* text = body->ChildAtIndex(0); |
| 252 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, text->data().role); |
246 EXPECT_STREQ( | 253 EXPECT_STREQ( |
247 "input", GetAttr(text, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); | 254 "input", GetAttr(text, ui::AX_ATTR_HTML_TAG).c_str()); |
248 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_START)); | 255 EXPECT_EQ(0, GetIntAttr(text, ui::AX_ATTR_TEXT_SEL_START)); |
249 EXPECT_EQ(13, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_END)); | 256 EXPECT_EQ(13, GetIntAttr(text, ui::AX_ATTR_TEXT_SEL_END)); |
250 EXPECT_STREQ( | 257 EXPECT_STREQ( |
251 "Hello, world.", | 258 "Hello, world.", |
252 GetAttr(text, AccessibilityNodeData::ATTR_VALUE).c_str()); | 259 GetAttr(text, ui::AX_ATTR_VALUE).c_str()); |
253 } | 260 } |
254 | 261 |
255 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 262 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
256 MultipleInheritanceAccessibility) { | 263 MultipleInheritanceAccessibility) { |
257 // In a WebKit accessibility render tree for a table, each cell is a | 264 // In a WebKit accessibility render tree for a table, each cell is a |
258 // child of both a row and a column, so it appears to use multiple | 265 // child of both a row and a column, so it appears to use multiple |
259 // inheritance. Make sure that the AccessibilityNodeDataObject tree only | 266 // inheritance. Make sure that the ui::AXNodeDataObject tree only |
260 // keeps one copy of each cell, and uses an indirect child id for the | 267 // keeps one copy of each cell, and uses an indirect child id for the |
261 // additional reference to it. | 268 // additional reference to it. |
262 const char url_str[] = | 269 const char url_str[] = |
263 "data:text/html," | 270 "data:text/html," |
264 "<!doctype html>" | 271 "<!doctype html>" |
265 "<table border=1><tr><td>1</td><td>2</td></tr></table>"; | 272 "<table border=1><tr><td>1</td><td>2</td></tr></table>"; |
266 GURL url(url_str); | 273 GURL url(url_str); |
267 NavigateToURL(shell(), url); | 274 NavigateToURL(shell(), url); |
268 | 275 |
269 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 276 const ui::AXTree& tree = GetAXTree(); |
270 ASSERT_EQ(1U, tree.children.size()); | 277 const ui::AXNode* root = tree.GetRoot(); |
271 const AccessibilityNodeDataTreeNode& table = tree.children[0]; | 278 ASSERT_EQ(1, root->child_count()); |
272 EXPECT_EQ(blink::WebAXRoleTable, table.role); | 279 const ui::AXNode* table = root->ChildAtIndex(0); |
273 const AccessibilityNodeDataTreeNode& row = table.children[0]; | 280 EXPECT_EQ(ui::AX_ROLE_TABLE, table->data().role); |
274 EXPECT_EQ(blink::WebAXRoleRow, row.role); | 281 const ui::AXNode* row = table->ChildAtIndex(0); |
275 const AccessibilityNodeDataTreeNode& cell1 = row.children[0]; | 282 EXPECT_EQ(ui::AX_ROLE_ROW, row->data().role); |
276 EXPECT_EQ(blink::WebAXRoleCell, cell1.role); | 283 const ui::AXNode* cell1 = row->ChildAtIndex(0); |
277 const AccessibilityNodeDataTreeNode& cell2 = row.children[1]; | 284 EXPECT_EQ(ui::AX_ROLE_CELL, cell1->data().role); |
278 EXPECT_EQ(blink::WebAXRoleCell, cell2.role); | 285 const ui::AXNode* cell2 = row->ChildAtIndex(1); |
279 const AccessibilityNodeDataTreeNode& column1 = table.children[1]; | 286 EXPECT_EQ(ui::AX_ROLE_CELL, cell2->data().role); |
280 EXPECT_EQ(blink::WebAXRoleColumn, column1.role); | 287 const ui::AXNode* column1 = table->ChildAtIndex(1); |
281 EXPECT_EQ(0U, column1.children.size()); | 288 EXPECT_EQ(ui::AX_ROLE_COLUMN, column1->data().role); |
282 EXPECT_EQ(1U, column1.intlist_attributes.size()); | 289 EXPECT_EQ(0, column1->child_count()); |
283 EXPECT_EQ(AccessibilityNodeData::ATTR_INDIRECT_CHILD_IDS, | 290 EXPECT_EQ(1U, column1->data().intlist_attributes.size()); |
284 column1.intlist_attributes[0].first); | 291 EXPECT_EQ(ui::AX_ATTR_INDIRECT_CHILD_IDS, |
| 292 column1->data().intlist_attributes[0].first); |
285 const std::vector<int32> column1_indirect_child_ids = | 293 const std::vector<int32> column1_indirect_child_ids = |
286 column1.intlist_attributes[0].second; | 294 column1->data().intlist_attributes[0].second; |
287 EXPECT_EQ(1U, column1_indirect_child_ids.size()); | 295 EXPECT_EQ(1U, column1_indirect_child_ids.size()); |
288 EXPECT_EQ(cell1.id, column1_indirect_child_ids[0]); | 296 EXPECT_EQ(cell1->id(), column1_indirect_child_ids[0]); |
289 const AccessibilityNodeDataTreeNode& column2 = table.children[2]; | 297 const ui::AXNode* column2 = table->ChildAtIndex(2); |
290 EXPECT_EQ(blink::WebAXRoleColumn, column2.role); | 298 EXPECT_EQ(ui::AX_ROLE_COLUMN, column2->data().role); |
291 EXPECT_EQ(0U, column2.children.size()); | 299 EXPECT_EQ(0, column2->child_count()); |
292 EXPECT_EQ(AccessibilityNodeData::ATTR_INDIRECT_CHILD_IDS, | 300 EXPECT_EQ(ui::AX_ATTR_INDIRECT_CHILD_IDS, |
293 column2.intlist_attributes[0].first); | 301 column2->data().intlist_attributes[0].first); |
294 const std::vector<int32> column2_indirect_child_ids = | 302 const std::vector<int32> column2_indirect_child_ids = |
295 column2.intlist_attributes[0].second; | 303 column2->data().intlist_attributes[0].second; |
296 EXPECT_EQ(1U, column2_indirect_child_ids.size()); | 304 EXPECT_EQ(1U, column2_indirect_child_ids.size()); |
297 EXPECT_EQ(cell2.id, column2_indirect_child_ids[0]); | 305 EXPECT_EQ(cell2->id(), column2_indirect_child_ids[0]); |
298 } | 306 } |
299 | 307 |
300 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 308 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
301 MultipleInheritanceAccessibility2) { | 309 MultipleInheritanceAccessibility2) { |
302 // Here's another html snippet where WebKit puts the same node as a child | 310 // Here's another html snippet where WebKit puts the same node as a child |
303 // of two different parents. Instead of checking the exact output, just | 311 // of two different parents. Instead of checking the exact output, just |
304 // make sure that no id is reused in the resulting tree. | 312 // make sure that no id is reused in the resulting tree. |
305 const char url_str[] = | 313 const char url_str[] = |
306 "data:text/html," | 314 "data:text/html," |
307 "<!doctype html>" | 315 "<!doctype html>" |
308 "<script>\n" | 316 "<script>\n" |
309 " document.writeln('<q><section></section></q><q><li>');\n" | 317 " document.writeln('<q><section></section></q><q><li>');\n" |
310 " setTimeout(function() {\n" | 318 " setTimeout(function() {\n" |
311 " document.close();\n" | 319 " document.close();\n" |
312 " }, 1);\n" | 320 " }, 1);\n" |
313 "</script>"; | 321 "</script>"; |
314 GURL url(url_str); | 322 GURL url(url_str); |
315 NavigateToURL(shell(), url); | 323 NavigateToURL(shell(), url); |
316 | 324 |
317 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 325 const ui::AXTree& tree = GetAXTree(); |
| 326 const ui::AXNode* root = tree.GetRoot(); |
318 base::hash_set<int> ids; | 327 base::hash_set<int> ids; |
319 RecursiveAssertUniqueIds(tree, &ids); | 328 RecursiveAssertUniqueIds(root, &ids); |
320 } | 329 } |
321 | 330 |
322 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 331 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
323 IframeAccessibility) { | 332 IframeAccessibility) { |
324 // Create a data url and load it. | 333 // Create a data url and load it. |
325 const char url_str[] = | 334 const char url_str[] = |
326 "data:text/html," | 335 "data:text/html," |
327 "<!doctype html><html><body>" | 336 "<!doctype html><html><body>" |
328 "<button>Button 1</button>" | 337 "<button>Button 1</button>" |
329 "<iframe src='data:text/html," | 338 "<iframe src='data:text/html," |
330 "<!doctype html><html><body><button>Button 2</button></body></html>" | 339 "<!doctype html><html><body><button>Button 2</button></body></html>" |
331 "'></iframe>" | 340 "'></iframe>" |
332 "<button>Button 3</button>" | 341 "<button>Button 3</button>" |
333 "</body></html>"; | 342 "</body></html>"; |
334 GURL url(url_str); | 343 GURL url(url_str); |
335 NavigateToURL(shell(), url); | 344 NavigateToURL(shell(), url); |
336 | 345 |
337 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 346 const ui::AXTree& tree = GetAXTree(); |
338 ASSERT_EQ(1U, tree.children.size()); | 347 const ui::AXNode* root = tree.GetRoot(); |
339 const AccessibilityNodeDataTreeNode& body = tree.children[0]; | 348 ASSERT_EQ(1, root->child_count()); |
340 ASSERT_EQ(3U, body.children.size()); | 349 const ui::AXNode* body = root->ChildAtIndex(0); |
| 350 ASSERT_EQ(3, body->child_count()); |
341 | 351 |
342 const AccessibilityNodeDataTreeNode& button1 = body.children[0]; | 352 const ui::AXNode* button1 = body->ChildAtIndex(0); |
343 EXPECT_EQ(blink::WebAXRoleButton, button1.role); | 353 EXPECT_EQ(ui::AX_ROLE_BUTTON, button1->data().role); |
344 EXPECT_STREQ( | 354 EXPECT_STREQ( |
345 "Button 1", | 355 "Button 1", |
346 GetAttr(button1, AccessibilityNodeData::ATTR_NAME).c_str()); | 356 GetAttr(button1, ui::AX_ATTR_NAME).c_str()); |
347 | 357 |
348 const AccessibilityNodeDataTreeNode& iframe = body.children[1]; | 358 const ui::AXNode* iframe = body->ChildAtIndex(1); |
349 EXPECT_STREQ("iframe", | 359 EXPECT_STREQ("iframe", |
350 GetAttr(iframe, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); | 360 GetAttr(iframe, ui::AX_ATTR_HTML_TAG).c_str()); |
351 ASSERT_EQ(1U, iframe.children.size()); | 361 ASSERT_EQ(1, iframe->child_count()); |
352 | 362 |
353 const AccessibilityNodeDataTreeNode& scroll_area = iframe.children[0]; | 363 const ui::AXNode* scroll_area = iframe->ChildAtIndex(0); |
354 EXPECT_EQ(blink::WebAXRoleScrollArea, scroll_area.role); | 364 EXPECT_EQ(ui::AX_ROLE_SCROLL_AREA, scroll_area->data().role); |
355 ASSERT_EQ(1U, scroll_area.children.size()); | 365 ASSERT_EQ(1, scroll_area->child_count()); |
356 | 366 |
357 const AccessibilityNodeDataTreeNode& sub_document = scroll_area.children[0]; | 367 const ui::AXNode* sub_document = scroll_area->ChildAtIndex(0); |
358 EXPECT_EQ(blink::WebAXRoleWebArea, sub_document.role); | 368 EXPECT_EQ(ui::AX_ROLE_WEB_AREA, sub_document->data().role); |
359 ASSERT_EQ(1U, sub_document.children.size()); | 369 ASSERT_EQ(1, sub_document->child_count()); |
360 | 370 |
361 const AccessibilityNodeDataTreeNode& sub_body = sub_document.children[0]; | 371 const ui::AXNode* sub_body = sub_document->ChildAtIndex(0); |
362 ASSERT_EQ(1U, sub_body.children.size()); | 372 ASSERT_EQ(1, sub_body->child_count()); |
363 | 373 |
364 const AccessibilityNodeDataTreeNode& button2 = sub_body.children[0]; | 374 const ui::AXNode* button2 = sub_body->ChildAtIndex(0); |
365 EXPECT_EQ(blink::WebAXRoleButton, button2.role); | 375 EXPECT_EQ(ui::AX_ROLE_BUTTON, button2->data().role); |
366 EXPECT_STREQ("Button 2", | 376 EXPECT_STREQ("Button 2", |
367 GetAttr(button2, AccessibilityNodeData::ATTR_NAME).c_str()); | 377 GetAttr(button2, ui::AX_ATTR_NAME).c_str()); |
368 | 378 |
369 const AccessibilityNodeDataTreeNode& button3 = body.children[2]; | 379 const ui::AXNode* button3 = body->ChildAtIndex(2); |
370 EXPECT_EQ(blink::WebAXRoleButton, button3.role); | 380 EXPECT_EQ(ui::AX_ROLE_BUTTON, button3->data().role); |
371 EXPECT_STREQ("Button 3", | 381 EXPECT_STREQ("Button 3", |
372 GetAttr(button3, AccessibilityNodeData::ATTR_NAME).c_str()); | 382 GetAttr(button3, ui::AX_ATTR_NAME).c_str()); |
373 } | 383 } |
374 | 384 |
375 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 385 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
376 DuplicateChildrenAccessibility) { | 386 DuplicateChildrenAccessibility) { |
377 // Here's another html snippet where WebKit has a parent node containing | 387 // Here's another html snippet where WebKit has a parent node containing |
378 // two duplicate child nodes. Instead of checking the exact output, just | 388 // two duplicate child nodes. Instead of checking the exact output, just |
379 // make sure that no id is reused in the resulting tree. | 389 // make sure that no id is reused in the resulting tree. |
380 const char url_str[] = | 390 const char url_str[] = |
381 "data:text/html," | 391 "data:text/html," |
382 "<!doctype html>" | 392 "<!doctype html>" |
383 "<em><code ><h4 ></em>"; | 393 "<em><code ><h4 ></em>"; |
384 GURL url(url_str); | 394 GURL url(url_str); |
385 NavigateToURL(shell(), url); | 395 NavigateToURL(shell(), url); |
386 | 396 |
387 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 397 const ui::AXTree& tree = GetAXTree(); |
| 398 const ui::AXNode* root = tree.GetRoot(); |
388 base::hash_set<int> ids; | 399 base::hash_set<int> ids; |
389 RecursiveAssertUniqueIds(tree, &ids); | 400 RecursiveAssertUniqueIds(root, &ids); |
390 } | 401 } |
391 | 402 |
392 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 403 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
393 MAYBE_TableSpan) { | 404 MAYBE_TableSpan) { |
394 // +---+---+---+ | 405 // +---+---+---+ |
395 // | 1 | 2 | | 406 // | 1 | 2 | |
396 // +---+---+---+ | 407 // +---+---+---+ |
397 // | 3 | 4 | | 408 // | 3 | 4 | |
398 // +---+---+---+ | 409 // +---+---+---+ |
399 | 410 |
400 const char url_str[] = | 411 const char url_str[] = |
401 "data:text/html," | 412 "data:text/html," |
402 "<!doctype html>" | 413 "<!doctype html>" |
403 "<table border=1>" | 414 "<table border=1>" |
404 " <tr>" | 415 " <tr>" |
405 " <td colspan=2>1</td><td>2</td>" | 416 " <td colspan=2>1</td><td>2</td>" |
406 " </tr>" | 417 " </tr>" |
407 " <tr>" | 418 " <tr>" |
408 " <td>3</td><td colspan=2>4</td>" | 419 " <td>3</td><td colspan=2>4</td>" |
409 " </tr>" | 420 " </tr>" |
410 "</table>"; | 421 "</table>"; |
411 GURL url(url_str); | 422 GURL url(url_str); |
412 NavigateToURL(shell(), url); | 423 NavigateToURL(shell(), url); |
413 | 424 |
414 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 425 const ui::AXTree& tree = GetAXTree(); |
415 const AccessibilityNodeDataTreeNode& table = tree.children[0]; | 426 const ui::AXNode* root = tree.GetRoot(); |
416 EXPECT_EQ(blink::WebAXRoleTable, table.role); | 427 const ui::AXNode* table = root->ChildAtIndex(0); |
417 ASSERT_GE(table.children.size(), 5U); | 428 EXPECT_EQ(ui::AX_ROLE_TABLE, table->data().role); |
418 EXPECT_EQ(blink::WebAXRoleRow, table.children[0].role); | 429 ASSERT_GE(table->child_count(), 5); |
419 EXPECT_EQ(blink::WebAXRoleRow, table.children[1].role); | 430 EXPECT_EQ(ui::AX_ROLE_ROW, table->ChildAtIndex(0)->data().role); |
420 EXPECT_EQ(blink::WebAXRoleColumn, table.children[2].role); | 431 EXPECT_EQ(ui::AX_ROLE_ROW, table->ChildAtIndex(1)->data().role); |
421 EXPECT_EQ(blink::WebAXRoleColumn, table.children[3].role); | 432 EXPECT_EQ(ui::AX_ROLE_COLUMN, table->ChildAtIndex(2)->data().role); |
422 EXPECT_EQ(blink::WebAXRoleColumn, table.children[4].role); | 433 EXPECT_EQ(ui::AX_ROLE_COLUMN, table->ChildAtIndex(3)->data().role); |
| 434 EXPECT_EQ(ui::AX_ROLE_COLUMN, table->ChildAtIndex(4)->data().role); |
423 EXPECT_EQ(3, | 435 EXPECT_EQ(3, |
424 GetIntAttr(table, AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT)); | 436 GetIntAttr(table, ui::AX_ATTR_TABLE_COLUMN_COUNT)); |
425 EXPECT_EQ(2, GetIntAttr(table, AccessibilityNodeData::ATTR_TABLE_ROW_COUNT)); | 437 EXPECT_EQ(2, GetIntAttr(table, ui::AX_ATTR_TABLE_ROW_COUNT)); |
426 | 438 |
427 const AccessibilityNodeDataTreeNode& cell1 = table.children[0].children[0]; | 439 const ui::AXNode* cell1 = table->ChildAtIndex(0)->ChildAtIndex(0); |
428 const AccessibilityNodeDataTreeNode& cell2 = table.children[0].children[1]; | 440 const ui::AXNode* cell2 = table->ChildAtIndex(0)->ChildAtIndex(1); |
429 const AccessibilityNodeDataTreeNode& cell3 = table.children[1].children[0]; | 441 const ui::AXNode* cell3 = table->ChildAtIndex(1)->ChildAtIndex(0); |
430 const AccessibilityNodeDataTreeNode& cell4 = table.children[1].children[1]; | 442 const ui::AXNode* cell4 = table->ChildAtIndex(1)->ChildAtIndex(1); |
431 | 443 |
432 ASSERT_EQ(AccessibilityNodeData::ATTR_CELL_IDS, | 444 ASSERT_EQ(ui::AX_ATTR_CELL_IDS, |
433 table.intlist_attributes[0].first); | 445 table->data().intlist_attributes[0].first); |
434 const std::vector<int32>& table_cell_ids = | 446 const std::vector<int32>& table_cell_ids = |
435 table.intlist_attributes[0].second; | 447 table->data().intlist_attributes[0].second; |
436 ASSERT_EQ(6U, table_cell_ids.size()); | 448 ASSERT_EQ(6U, table_cell_ids.size()); |
437 EXPECT_EQ(cell1.id, table_cell_ids[0]); | 449 EXPECT_EQ(cell1->id(), table_cell_ids[0]); |
438 EXPECT_EQ(cell1.id, table_cell_ids[1]); | 450 EXPECT_EQ(cell1->id(), table_cell_ids[1]); |
439 EXPECT_EQ(cell2.id, table_cell_ids[2]); | 451 EXPECT_EQ(cell2->id(), table_cell_ids[2]); |
440 EXPECT_EQ(cell3.id, table_cell_ids[3]); | 452 EXPECT_EQ(cell3->id(), table_cell_ids[3]); |
441 EXPECT_EQ(cell4.id, table_cell_ids[4]); | 453 EXPECT_EQ(cell4->id(), table_cell_ids[4]); |
442 EXPECT_EQ(cell4.id, table_cell_ids[5]); | 454 EXPECT_EQ(cell4->id(), table_cell_ids[5]); |
443 | 455 |
444 EXPECT_EQ(0, GetIntAttr(cell1, | 456 EXPECT_EQ(0, GetIntAttr(cell1, |
445 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX)); | 457 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX)); |
446 EXPECT_EQ(0, GetIntAttr(cell1, | 458 EXPECT_EQ(0, GetIntAttr(cell1, |
447 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_INDEX)); | 459 ui::AX_ATTR_TABLE_CELL_ROW_INDEX)); |
448 EXPECT_EQ(2, GetIntAttr(cell1, | 460 EXPECT_EQ(2, GetIntAttr(cell1, |
449 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_SPAN)); | 461 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN)); |
450 EXPECT_EQ(1, GetIntAttr(cell1, | 462 EXPECT_EQ(1, GetIntAttr(cell1, |
451 AccessibilityNodeData::ATTR_TABLE_CELL_ROW_SPAN)); | 463 ui::AX_ATTR_TABLE_CELL_ROW_SPAN)); |
452 EXPECT_EQ(2, GetIntAttr(cell2, | 464 EXPECT_EQ(2, GetIntAttr(cell2, |
453 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX)); | 465 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX)); |
454 EXPECT_EQ(1, GetIntAttr(cell2, | 466 EXPECT_EQ(1, GetIntAttr(cell2, |
455 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_SPAN)); | 467 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN)); |
456 EXPECT_EQ(0, GetIntAttr(cell3, | 468 EXPECT_EQ(0, GetIntAttr(cell3, |
457 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX)); | 469 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX)); |
458 EXPECT_EQ(1, GetIntAttr(cell3, | 470 EXPECT_EQ(1, GetIntAttr(cell3, |
459 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_SPAN)); | 471 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN)); |
460 EXPECT_EQ(1, GetIntAttr(cell4, | 472 EXPECT_EQ(1, GetIntAttr(cell4, |
461 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_INDEX)); | 473 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX)); |
462 EXPECT_EQ(2, GetIntAttr(cell4, | 474 EXPECT_EQ(2, GetIntAttr(cell4, |
463 AccessibilityNodeData::ATTR_TABLE_CELL_COLUMN_SPAN)); | 475 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN)); |
464 } | 476 } |
465 | 477 |
466 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 478 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
467 WritableElement) { | 479 WritableElement) { |
468 const char url_str[] = | 480 const char url_str[] = |
469 "data:text/html," | 481 "data:text/html," |
470 "<!doctype html>" | 482 "<!doctype html>" |
471 "<div role='textbox' tabindex=0>" | 483 "<div role='textbox' tabindex=0>" |
472 " Some text" | 484 " Some text" |
473 "</div>"; | 485 "</div>"; |
474 GURL url(url_str); | 486 GURL url(url_str); |
475 NavigateToURL(shell(), url); | 487 NavigateToURL(shell(), url); |
476 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 488 const ui::AXTree& tree = GetAXTree(); |
477 | 489 const ui::AXNode* root = tree.GetRoot(); |
478 ASSERT_EQ(1U, tree.children.size()); | 490 ASSERT_EQ(1, root->child_count()); |
479 const AccessibilityNodeDataTreeNode& textbox = tree.children[0]; | 491 const ui::AXNode* textbox = root->ChildAtIndex(0); |
480 | 492 EXPECT_EQ(true, GetBoolAttr(textbox, ui::AX_ATTR_CAN_SET_VALUE)); |
481 EXPECT_EQ( | |
482 true, GetBoolAttr(textbox, AccessibilityNodeData::ATTR_CAN_SET_VALUE)); | |
483 } | 493 } |
484 | 494 |
485 } // namespace content | 495 } // namespace content |
OLD | NEW |