| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 class CrossPlatformAccessibilityBrowserTest : public ContentBrowserTest { | 34 class CrossPlatformAccessibilityBrowserTest : public ContentBrowserTest { |
| 35 public: | 35 public: |
| 36 CrossPlatformAccessibilityBrowserTest() {} | 36 CrossPlatformAccessibilityBrowserTest() {} |
| 37 | 37 |
| 38 // Tell the renderer to send an accessibility tree, then wait for the | 38 // Tell the renderer to send an accessibility tree, then wait for the |
| 39 // notification that it's been received. | 39 // notification that it's been received. |
| 40 const AccessibilityNodeDataTreeNode& GetAccessibilityNodeDataTree( | 40 const AccessibilityNodeDataTreeNode& GetAccessibilityNodeDataTree( |
| 41 AccessibilityMode accessibility_mode = AccessibilityModeComplete) { | 41 AccessibilityMode accessibility_mode = AccessibilityModeComplete) { |
| 42 AccessibilityNotificationWaiter waiter( | 42 AccessibilityNotificationWaiter waiter( |
| 43 shell(), accessibility_mode, WebKit::WebAXEventLayoutComplete); | 43 shell(), accessibility_mode, blink::WebAXEventLayoutComplete); |
| 44 waiter.WaitForNotification(); | 44 waiter.WaitForNotification(); |
| 45 return waiter.GetAccessibilityNodeDataTree(); | 45 return waiter.GetAccessibilityNodeDataTree(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Make sure each node in the tree has an unique id. | 48 // Make sure each node in the tree has an unique id. |
| 49 void RecursiveAssertUniqueIds( | 49 void RecursiveAssertUniqueIds( |
| 50 const AccessibilityNodeDataTreeNode& node, base::hash_set<int>* ids) { | 50 const AccessibilityNodeDataTreeNode& node, base::hash_set<int>* ids) { |
| 51 ASSERT_TRUE(ids->find(node.id) == ids->end()); | 51 ASSERT_TRUE(ids->find(node.id) == ids->end()); |
| 52 ids->insert(node.id); | 52 ids->insert(node.id); |
| 53 for (size_t i = 0; i < node.children.size(); i++) | 53 for (size_t i = 0; i < node.children.size(); i++) |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 "Accessibility Test", | 145 "Accessibility Test", |
| 146 GetAttr(tree, AccessibilityNodeData::ATTR_DOC_TITLE).c_str()); | 146 GetAttr(tree, AccessibilityNodeData::ATTR_DOC_TITLE).c_str()); |
| 147 EXPECT_STREQ( | 147 EXPECT_STREQ( |
| 148 "html", GetAttr(tree, AccessibilityNodeData::ATTR_DOC_DOCTYPE).c_str()); | 148 "html", GetAttr(tree, AccessibilityNodeData::ATTR_DOC_DOCTYPE).c_str()); |
| 149 EXPECT_STREQ( | 149 EXPECT_STREQ( |
| 150 "text/html", | 150 "text/html", |
| 151 GetAttr(tree, AccessibilityNodeData::ATTR_DOC_MIMETYPE).c_str()); | 151 GetAttr(tree, AccessibilityNodeData::ATTR_DOC_MIMETYPE).c_str()); |
| 152 EXPECT_STREQ( | 152 EXPECT_STREQ( |
| 153 "Accessibility Test", | 153 "Accessibility Test", |
| 154 GetAttr(tree, AccessibilityNodeData::ATTR_NAME).c_str()); | 154 GetAttr(tree, AccessibilityNodeData::ATTR_NAME).c_str()); |
| 155 EXPECT_EQ(WebKit::WebAXRoleRootWebArea, tree.role); | 155 EXPECT_EQ(blink::WebAXRoleRootWebArea, tree.role); |
| 156 | 156 |
| 157 // Check properites of the BODY element. | 157 // Check properites of the BODY element. |
| 158 ASSERT_EQ(1U, tree.children.size()); | 158 ASSERT_EQ(1U, tree.children.size()); |
| 159 const AccessibilityNodeDataTreeNode& body = tree.children[0]; | 159 const AccessibilityNodeDataTreeNode& body = tree.children[0]; |
| 160 EXPECT_EQ(WebKit::WebAXRoleGroup, body.role); | 160 EXPECT_EQ(blink::WebAXRoleGroup, body.role); |
| 161 EXPECT_STREQ("body", | 161 EXPECT_STREQ("body", |
| 162 GetAttr(body, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); | 162 GetAttr(body, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); |
| 163 EXPECT_STREQ("block", | 163 EXPECT_STREQ("block", |
| 164 GetAttr(body, AccessibilityNodeData::ATTR_DISPLAY).c_str()); | 164 GetAttr(body, AccessibilityNodeData::ATTR_DISPLAY).c_str()); |
| 165 | 165 |
| 166 // Check properties of the two children of the BODY element. | 166 // Check properties of the two children of the BODY element. |
| 167 ASSERT_EQ(2U, body.children.size()); | 167 ASSERT_EQ(2U, body.children.size()); |
| 168 | 168 |
| 169 const AccessibilityNodeDataTreeNode& button = body.children[0]; | 169 const AccessibilityNodeDataTreeNode& button = body.children[0]; |
| 170 EXPECT_EQ(WebKit::WebAXRoleButton, button.role); | 170 EXPECT_EQ(blink::WebAXRoleButton, button.role); |
| 171 EXPECT_STREQ( | 171 EXPECT_STREQ( |
| 172 "input", GetAttr(button, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); | 172 "input", GetAttr(button, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); |
| 173 EXPECT_STREQ( | 173 EXPECT_STREQ( |
| 174 "push", | 174 "push", |
| 175 GetAttr(button, AccessibilityNodeData::ATTR_NAME).c_str()); | 175 GetAttr(button, AccessibilityNodeData::ATTR_NAME).c_str()); |
| 176 EXPECT_STREQ( | 176 EXPECT_STREQ( |
| 177 "inline-block", | 177 "inline-block", |
| 178 GetAttr(button, AccessibilityNodeData::ATTR_DISPLAY).c_str()); | 178 GetAttr(button, AccessibilityNodeData::ATTR_DISPLAY).c_str()); |
| 179 ASSERT_EQ(2U, button.html_attributes.size()); | 179 ASSERT_EQ(2U, button.html_attributes.size()); |
| 180 EXPECT_STREQ("type", button.html_attributes[0].first.c_str()); | 180 EXPECT_STREQ("type", button.html_attributes[0].first.c_str()); |
| 181 EXPECT_STREQ("button", button.html_attributes[0].second.c_str()); | 181 EXPECT_STREQ("button", button.html_attributes[0].second.c_str()); |
| 182 EXPECT_STREQ("value", button.html_attributes[1].first.c_str()); | 182 EXPECT_STREQ("value", button.html_attributes[1].first.c_str()); |
| 183 EXPECT_STREQ("push", button.html_attributes[1].second.c_str()); | 183 EXPECT_STREQ("push", button.html_attributes[1].second.c_str()); |
| 184 | 184 |
| 185 const AccessibilityNodeDataTreeNode& checkbox = body.children[1]; | 185 const AccessibilityNodeDataTreeNode& checkbox = body.children[1]; |
| 186 EXPECT_EQ(WebKit::WebAXRoleCheckBox, checkbox.role); | 186 EXPECT_EQ(blink::WebAXRoleCheckBox, checkbox.role); |
| 187 EXPECT_STREQ( | 187 EXPECT_STREQ( |
| 188 "input", GetAttr(checkbox, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); | 188 "input", GetAttr(checkbox, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); |
| 189 EXPECT_STREQ( | 189 EXPECT_STREQ( |
| 190 "inline-block", | 190 "inline-block", |
| 191 GetAttr(checkbox, AccessibilityNodeData::ATTR_DISPLAY).c_str()); | 191 GetAttr(checkbox, AccessibilityNodeData::ATTR_DISPLAY).c_str()); |
| 192 ASSERT_EQ(1U, checkbox.html_attributes.size()); | 192 ASSERT_EQ(1U, checkbox.html_attributes.size()); |
| 193 EXPECT_STREQ("type", checkbox.html_attributes[0].first.c_str()); | 193 EXPECT_STREQ("type", checkbox.html_attributes[0].first.c_str()); |
| 194 EXPECT_STREQ("checkbox", checkbox.html_attributes[0].second.c_str()); | 194 EXPECT_STREQ("checkbox", checkbox.html_attributes[0].second.c_str()); |
| 195 } | 195 } |
| 196 | 196 |
| 197 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 197 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
| 198 UnselectedEditableTextAccessibility) { | 198 UnselectedEditableTextAccessibility) { |
| 199 // Create a data url and load it. | 199 // Create a data url and load it. |
| 200 const char url_str[] = | 200 const char url_str[] = |
| 201 "data:text/html," | 201 "data:text/html," |
| 202 "<!doctype html>" | 202 "<!doctype html>" |
| 203 "<body>" | 203 "<body>" |
| 204 "<input value=\"Hello, world.\"/>" | 204 "<input value=\"Hello, world.\"/>" |
| 205 "</body></html>"; | 205 "</body></html>"; |
| 206 GURL url(url_str); | 206 GURL url(url_str); |
| 207 NavigateToURL(shell(), url); | 207 NavigateToURL(shell(), url); |
| 208 | 208 |
| 209 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 209 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); |
| 210 ASSERT_EQ(1U, tree.children.size()); | 210 ASSERT_EQ(1U, tree.children.size()); |
| 211 const AccessibilityNodeDataTreeNode& body = tree.children[0]; | 211 const AccessibilityNodeDataTreeNode& body = tree.children[0]; |
| 212 ASSERT_EQ(1U, body.children.size()); | 212 ASSERT_EQ(1U, body.children.size()); |
| 213 const AccessibilityNodeDataTreeNode& text = body.children[0]; | 213 const AccessibilityNodeDataTreeNode& text = body.children[0]; |
| 214 EXPECT_EQ(WebKit::WebAXRoleTextField, text.role); | 214 EXPECT_EQ(blink::WebAXRoleTextField, text.role); |
| 215 EXPECT_STREQ( | 215 EXPECT_STREQ( |
| 216 "input", GetAttr(text, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); | 216 "input", GetAttr(text, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); |
| 217 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_START)); | 217 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_START)); |
| 218 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_END)); | 218 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_END)); |
| 219 EXPECT_STREQ( | 219 EXPECT_STREQ( |
| 220 "Hello, world.", | 220 "Hello, world.", |
| 221 GetAttr(text, AccessibilityNodeData::ATTR_VALUE).c_str()); | 221 GetAttr(text, AccessibilityNodeData::ATTR_VALUE).c_str()); |
| 222 | 222 |
| 223 // TODO(dmazzoni): as soon as more accessibility code is cross-platform, | 223 // TODO(dmazzoni): as soon as more accessibility code is cross-platform, |
| 224 // this code should test that the accessible info is dynamically updated | 224 // this code should test that the accessible info is dynamically updated |
| (...skipping 10 matching lines...) Expand all Loading... |
| 235 "<input value=\"Hello, world.\"/>" | 235 "<input value=\"Hello, world.\"/>" |
| 236 "</body></html>"; | 236 "</body></html>"; |
| 237 GURL url(url_str); | 237 GURL url(url_str); |
| 238 NavigateToURL(shell(), url); | 238 NavigateToURL(shell(), url); |
| 239 | 239 |
| 240 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 240 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); |
| 241 ASSERT_EQ(1U, tree.children.size()); | 241 ASSERT_EQ(1U, tree.children.size()); |
| 242 const AccessibilityNodeDataTreeNode& body = tree.children[0]; | 242 const AccessibilityNodeDataTreeNode& body = tree.children[0]; |
| 243 ASSERT_EQ(1U, body.children.size()); | 243 ASSERT_EQ(1U, body.children.size()); |
| 244 const AccessibilityNodeDataTreeNode& text = body.children[0]; | 244 const AccessibilityNodeDataTreeNode& text = body.children[0]; |
| 245 EXPECT_EQ(WebKit::WebAXRoleTextField, text.role); | 245 EXPECT_EQ(blink::WebAXRoleTextField, text.role); |
| 246 EXPECT_STREQ( | 246 EXPECT_STREQ( |
| 247 "input", GetAttr(text, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); | 247 "input", GetAttr(text, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); |
| 248 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_START)); | 248 EXPECT_EQ(0, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_START)); |
| 249 EXPECT_EQ(13, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_END)); | 249 EXPECT_EQ(13, GetIntAttr(text, AccessibilityNodeData::ATTR_TEXT_SEL_END)); |
| 250 EXPECT_STREQ( | 250 EXPECT_STREQ( |
| 251 "Hello, world.", | 251 "Hello, world.", |
| 252 GetAttr(text, AccessibilityNodeData::ATTR_VALUE).c_str()); | 252 GetAttr(text, AccessibilityNodeData::ATTR_VALUE).c_str()); |
| 253 } | 253 } |
| 254 | 254 |
| 255 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 255 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
| 256 MultipleInheritanceAccessibility) { | 256 MultipleInheritanceAccessibility) { |
| 257 // In a WebKit accessibility render tree for a table, each cell is a | 257 // 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 | 258 // child of both a row and a column, so it appears to use multiple |
| 259 // inheritance. Make sure that the AccessibilityNodeDataObject tree only | 259 // inheritance. Make sure that the AccessibilityNodeDataObject tree only |
| 260 // keeps one copy of each cell, and uses an indirect child id for the | 260 // keeps one copy of each cell, and uses an indirect child id for the |
| 261 // additional reference to it. | 261 // additional reference to it. |
| 262 const char url_str[] = | 262 const char url_str[] = |
| 263 "data:text/html," | 263 "data:text/html," |
| 264 "<!doctype html>" | 264 "<!doctype html>" |
| 265 "<table border=1><tr><td>1</td><td>2</td></tr></table>"; | 265 "<table border=1><tr><td>1</td><td>2</td></tr></table>"; |
| 266 GURL url(url_str); | 266 GURL url(url_str); |
| 267 NavigateToURL(shell(), url); | 267 NavigateToURL(shell(), url); |
| 268 | 268 |
| 269 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 269 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); |
| 270 ASSERT_EQ(1U, tree.children.size()); | 270 ASSERT_EQ(1U, tree.children.size()); |
| 271 const AccessibilityNodeDataTreeNode& table = tree.children[0]; | 271 const AccessibilityNodeDataTreeNode& table = tree.children[0]; |
| 272 EXPECT_EQ(WebKit::WebAXRoleTable, table.role); | 272 EXPECT_EQ(blink::WebAXRoleTable, table.role); |
| 273 const AccessibilityNodeDataTreeNode& row = table.children[0]; | 273 const AccessibilityNodeDataTreeNode& row = table.children[0]; |
| 274 EXPECT_EQ(WebKit::WebAXRoleRow, row.role); | 274 EXPECT_EQ(blink::WebAXRoleRow, row.role); |
| 275 const AccessibilityNodeDataTreeNode& cell1 = row.children[0]; | 275 const AccessibilityNodeDataTreeNode& cell1 = row.children[0]; |
| 276 EXPECT_EQ(WebKit::WebAXRoleCell, cell1.role); | 276 EXPECT_EQ(blink::WebAXRoleCell, cell1.role); |
| 277 const AccessibilityNodeDataTreeNode& cell2 = row.children[1]; | 277 const AccessibilityNodeDataTreeNode& cell2 = row.children[1]; |
| 278 EXPECT_EQ(WebKit::WebAXRoleCell, cell2.role); | 278 EXPECT_EQ(blink::WebAXRoleCell, cell2.role); |
| 279 const AccessibilityNodeDataTreeNode& column1 = table.children[1]; | 279 const AccessibilityNodeDataTreeNode& column1 = table.children[1]; |
| 280 EXPECT_EQ(WebKit::WebAXRoleColumn, column1.role); | 280 EXPECT_EQ(blink::WebAXRoleColumn, column1.role); |
| 281 EXPECT_EQ(0U, column1.children.size()); | 281 EXPECT_EQ(0U, column1.children.size()); |
| 282 EXPECT_EQ(1U, column1.intlist_attributes.size()); | 282 EXPECT_EQ(1U, column1.intlist_attributes.size()); |
| 283 EXPECT_EQ(AccessibilityNodeData::ATTR_INDIRECT_CHILD_IDS, | 283 EXPECT_EQ(AccessibilityNodeData::ATTR_INDIRECT_CHILD_IDS, |
| 284 column1.intlist_attributes[0].first); | 284 column1.intlist_attributes[0].first); |
| 285 const std::vector<int32> column1_indirect_child_ids = | 285 const std::vector<int32> column1_indirect_child_ids = |
| 286 column1.intlist_attributes[0].second; | 286 column1.intlist_attributes[0].second; |
| 287 EXPECT_EQ(1U, column1_indirect_child_ids.size()); | 287 EXPECT_EQ(1U, column1_indirect_child_ids.size()); |
| 288 EXPECT_EQ(cell1.id, column1_indirect_child_ids[0]); | 288 EXPECT_EQ(cell1.id, column1_indirect_child_ids[0]); |
| 289 const AccessibilityNodeDataTreeNode& column2 = table.children[2]; | 289 const AccessibilityNodeDataTreeNode& column2 = table.children[2]; |
| 290 EXPECT_EQ(WebKit::WebAXRoleColumn, column2.role); | 290 EXPECT_EQ(blink::WebAXRoleColumn, column2.role); |
| 291 EXPECT_EQ(0U, column2.children.size()); | 291 EXPECT_EQ(0U, column2.children.size()); |
| 292 EXPECT_EQ(AccessibilityNodeData::ATTR_INDIRECT_CHILD_IDS, | 292 EXPECT_EQ(AccessibilityNodeData::ATTR_INDIRECT_CHILD_IDS, |
| 293 column2.intlist_attributes[0].first); | 293 column2.intlist_attributes[0].first); |
| 294 const std::vector<int32> column2_indirect_child_ids = | 294 const std::vector<int32> column2_indirect_child_ids = |
| 295 column2.intlist_attributes[0].second; | 295 column2.intlist_attributes[0].second; |
| 296 EXPECT_EQ(1U, column2_indirect_child_ids.size()); | 296 EXPECT_EQ(1U, column2_indirect_child_ids.size()); |
| 297 EXPECT_EQ(cell2.id, column2_indirect_child_ids[0]); | 297 EXPECT_EQ(cell2.id, column2_indirect_child_ids[0]); |
| 298 } | 298 } |
| 299 | 299 |
| 300 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 300 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 "</body></html>"; | 333 "</body></html>"; |
| 334 GURL url(url_str); | 334 GURL url(url_str); |
| 335 NavigateToURL(shell(), url); | 335 NavigateToURL(shell(), url); |
| 336 | 336 |
| 337 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 337 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); |
| 338 ASSERT_EQ(1U, tree.children.size()); | 338 ASSERT_EQ(1U, tree.children.size()); |
| 339 const AccessibilityNodeDataTreeNode& body = tree.children[0]; | 339 const AccessibilityNodeDataTreeNode& body = tree.children[0]; |
| 340 ASSERT_EQ(3U, body.children.size()); | 340 ASSERT_EQ(3U, body.children.size()); |
| 341 | 341 |
| 342 const AccessibilityNodeDataTreeNode& button1 = body.children[0]; | 342 const AccessibilityNodeDataTreeNode& button1 = body.children[0]; |
| 343 EXPECT_EQ(WebKit::WebAXRoleButton, button1.role); | 343 EXPECT_EQ(blink::WebAXRoleButton, button1.role); |
| 344 EXPECT_STREQ( | 344 EXPECT_STREQ( |
| 345 "Button 1", | 345 "Button 1", |
| 346 GetAttr(button1, AccessibilityNodeData::ATTR_NAME).c_str()); | 346 GetAttr(button1, AccessibilityNodeData::ATTR_NAME).c_str()); |
| 347 | 347 |
| 348 const AccessibilityNodeDataTreeNode& iframe = body.children[1]; | 348 const AccessibilityNodeDataTreeNode& iframe = body.children[1]; |
| 349 EXPECT_STREQ("iframe", | 349 EXPECT_STREQ("iframe", |
| 350 GetAttr(iframe, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); | 350 GetAttr(iframe, AccessibilityNodeData::ATTR_HTML_TAG).c_str()); |
| 351 ASSERT_EQ(1U, iframe.children.size()); | 351 ASSERT_EQ(1U, iframe.children.size()); |
| 352 | 352 |
| 353 const AccessibilityNodeDataTreeNode& scroll_area = iframe.children[0]; | 353 const AccessibilityNodeDataTreeNode& scroll_area = iframe.children[0]; |
| 354 EXPECT_EQ(WebKit::WebAXRoleScrollArea, scroll_area.role); | 354 EXPECT_EQ(blink::WebAXRoleScrollArea, scroll_area.role); |
| 355 ASSERT_EQ(1U, scroll_area.children.size()); | 355 ASSERT_EQ(1U, scroll_area.children.size()); |
| 356 | 356 |
| 357 const AccessibilityNodeDataTreeNode& sub_document = scroll_area.children[0]; | 357 const AccessibilityNodeDataTreeNode& sub_document = scroll_area.children[0]; |
| 358 EXPECT_EQ(WebKit::WebAXRoleWebArea, sub_document.role); | 358 EXPECT_EQ(blink::WebAXRoleWebArea, sub_document.role); |
| 359 ASSERT_EQ(1U, sub_document.children.size()); | 359 ASSERT_EQ(1U, sub_document.children.size()); |
| 360 | 360 |
| 361 const AccessibilityNodeDataTreeNode& sub_body = sub_document.children[0]; | 361 const AccessibilityNodeDataTreeNode& sub_body = sub_document.children[0]; |
| 362 ASSERT_EQ(1U, sub_body.children.size()); | 362 ASSERT_EQ(1U, sub_body.children.size()); |
| 363 | 363 |
| 364 const AccessibilityNodeDataTreeNode& button2 = sub_body.children[0]; | 364 const AccessibilityNodeDataTreeNode& button2 = sub_body.children[0]; |
| 365 EXPECT_EQ(WebKit::WebAXRoleButton, button2.role); | 365 EXPECT_EQ(blink::WebAXRoleButton, button2.role); |
| 366 EXPECT_STREQ("Button 2", | 366 EXPECT_STREQ("Button 2", |
| 367 GetAttr(button2, AccessibilityNodeData::ATTR_NAME).c_str()); | 367 GetAttr(button2, AccessibilityNodeData::ATTR_NAME).c_str()); |
| 368 | 368 |
| 369 const AccessibilityNodeDataTreeNode& button3 = body.children[2]; | 369 const AccessibilityNodeDataTreeNode& button3 = body.children[2]; |
| 370 EXPECT_EQ(WebKit::WebAXRoleButton, button3.role); | 370 EXPECT_EQ(blink::WebAXRoleButton, button3.role); |
| 371 EXPECT_STREQ("Button 3", | 371 EXPECT_STREQ("Button 3", |
| 372 GetAttr(button3, AccessibilityNodeData::ATTR_NAME).c_str()); | 372 GetAttr(button3, AccessibilityNodeData::ATTR_NAME).c_str()); |
| 373 } | 373 } |
| 374 | 374 |
| 375 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 375 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
| 376 DuplicateChildrenAccessibility) { | 376 DuplicateChildrenAccessibility) { |
| 377 // Here's another html snippet where WebKit has a parent node containing | 377 // Here's another html snippet where WebKit has a parent node containing |
| 378 // two duplicate child nodes. Instead of checking the exact output, just | 378 // two duplicate child nodes. Instead of checking the exact output, just |
| 379 // make sure that no id is reused in the resulting tree. | 379 // make sure that no id is reused in the resulting tree. |
| 380 const char url_str[] = | 380 const char url_str[] = |
| (...skipping 25 matching lines...) Expand all Loading... |
| 406 " </tr>" | 406 " </tr>" |
| 407 " <tr>" | 407 " <tr>" |
| 408 " <td>3</td><td colspan=2>4</td>" | 408 " <td>3</td><td colspan=2>4</td>" |
| 409 " </tr>" | 409 " </tr>" |
| 410 "</table>"; | 410 "</table>"; |
| 411 GURL url(url_str); | 411 GURL url(url_str); |
| 412 NavigateToURL(shell(), url); | 412 NavigateToURL(shell(), url); |
| 413 | 413 |
| 414 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 414 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); |
| 415 const AccessibilityNodeDataTreeNode& table = tree.children[0]; | 415 const AccessibilityNodeDataTreeNode& table = tree.children[0]; |
| 416 EXPECT_EQ(WebKit::WebAXRoleTable, table.role); | 416 EXPECT_EQ(blink::WebAXRoleTable, table.role); |
| 417 ASSERT_GE(table.children.size(), 5U); | 417 ASSERT_GE(table.children.size(), 5U); |
| 418 EXPECT_EQ(WebKit::WebAXRoleRow, table.children[0].role); | 418 EXPECT_EQ(blink::WebAXRoleRow, table.children[0].role); |
| 419 EXPECT_EQ(WebKit::WebAXRoleRow, table.children[1].role); | 419 EXPECT_EQ(blink::WebAXRoleRow, table.children[1].role); |
| 420 EXPECT_EQ(WebKit::WebAXRoleColumn, table.children[2].role); | 420 EXPECT_EQ(blink::WebAXRoleColumn, table.children[2].role); |
| 421 EXPECT_EQ(WebKit::WebAXRoleColumn, table.children[3].role); | 421 EXPECT_EQ(blink::WebAXRoleColumn, table.children[3].role); |
| 422 EXPECT_EQ(WebKit::WebAXRoleColumn, table.children[4].role); | 422 EXPECT_EQ(blink::WebAXRoleColumn, table.children[4].role); |
| 423 EXPECT_EQ(3, | 423 EXPECT_EQ(3, |
| 424 GetIntAttr(table, AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT)); | 424 GetIntAttr(table, AccessibilityNodeData::ATTR_TABLE_COLUMN_COUNT)); |
| 425 EXPECT_EQ(2, GetIntAttr(table, AccessibilityNodeData::ATTR_TABLE_ROW_COUNT)); | 425 EXPECT_EQ(2, GetIntAttr(table, AccessibilityNodeData::ATTR_TABLE_ROW_COUNT)); |
| 426 | 426 |
| 427 const AccessibilityNodeDataTreeNode& cell1 = table.children[0].children[0]; | 427 const AccessibilityNodeDataTreeNode& cell1 = table.children[0].children[0]; |
| 428 const AccessibilityNodeDataTreeNode& cell2 = table.children[0].children[1]; | 428 const AccessibilityNodeDataTreeNode& cell2 = table.children[0].children[1]; |
| 429 const AccessibilityNodeDataTreeNode& cell3 = table.children[1].children[0]; | 429 const AccessibilityNodeDataTreeNode& cell3 = table.children[1].children[0]; |
| 430 const AccessibilityNodeDataTreeNode& cell4 = table.children[1].children[1]; | 430 const AccessibilityNodeDataTreeNode& cell4 = table.children[1].children[1]; |
| 431 | 431 |
| 432 ASSERT_EQ(AccessibilityNodeData::ATTR_CELL_IDS, | 432 ASSERT_EQ(AccessibilityNodeData::ATTR_CELL_IDS, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); | 476 const AccessibilityNodeDataTreeNode& tree = GetAccessibilityNodeDataTree(); |
| 477 | 477 |
| 478 ASSERT_EQ(1U, tree.children.size()); | 478 ASSERT_EQ(1U, tree.children.size()); |
| 479 const AccessibilityNodeDataTreeNode& textbox = tree.children[0]; | 479 const AccessibilityNodeDataTreeNode& textbox = tree.children[0]; |
| 480 | 480 |
| 481 EXPECT_EQ( | 481 EXPECT_EQ( |
| 482 true, GetBoolAttr(textbox, AccessibilityNodeData::ATTR_CAN_SET_VALUE)); | 482 true, GetBoolAttr(textbox, AccessibilityNodeData::ATTR_CAN_SET_VALUE)); |
| 483 } | 483 } |
| 484 | 484 |
| 485 } // namespace content | 485 } // namespace content |
| OLD | NEW |