| 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 <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
| 5 #include <string> | 8 #include <string> |
| 6 #include <vector> | 9 #include <vector> |
| 7 | 10 |
| 11 #include "base/macros.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "build/build_config.h" |
| 9 #include "content/browser/renderer_host/render_view_host_impl.h" | 14 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 10 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
| 11 #include "content/public/browser/notification_types.h" | 16 #include "content/public/browser/notification_types.h" |
| 12 #include "content/public/browser/render_widget_host_view.h" | 17 #include "content/public/browser/render_widget_host_view.h" |
| 13 #include "content/public/test/content_browser_test.h" | 18 #include "content/public/test/content_browser_test.h" |
| 14 #include "content/public/test/content_browser_test_utils.h" | 19 #include "content/public/test/content_browser_test_utils.h" |
| 15 #include "content/shell/browser/shell.h" | 20 #include "content/shell/browser/shell.h" |
| 16 #include "content/test/accessibility_browser_test_utils.h" | 21 #include "content/test/accessibility_browser_test_utils.h" |
| 17 #include "ui/accessibility/ax_node.h" | 22 #include "ui/accessibility/ax_node.h" |
| 18 #include "ui/accessibility/ax_tree.h" | 23 #include "ui/accessibility/ax_tree.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 const ui::AXNode* cell1 = row->ChildAtIndex(0); | 285 const ui::AXNode* cell1 = row->ChildAtIndex(0); |
| 281 EXPECT_EQ(ui::AX_ROLE_CELL, cell1->data().role); | 286 EXPECT_EQ(ui::AX_ROLE_CELL, cell1->data().role); |
| 282 const ui::AXNode* cell2 = row->ChildAtIndex(1); | 287 const ui::AXNode* cell2 = row->ChildAtIndex(1); |
| 283 EXPECT_EQ(ui::AX_ROLE_CELL, cell2->data().role); | 288 EXPECT_EQ(ui::AX_ROLE_CELL, cell2->data().role); |
| 284 const ui::AXNode* column1 = table->ChildAtIndex(1); | 289 const ui::AXNode* column1 = table->ChildAtIndex(1); |
| 285 EXPECT_EQ(ui::AX_ROLE_COLUMN, column1->data().role); | 290 EXPECT_EQ(ui::AX_ROLE_COLUMN, column1->data().role); |
| 286 EXPECT_EQ(0, column1->child_count()); | 291 EXPECT_EQ(0, column1->child_count()); |
| 287 EXPECT_EQ(1U, column1->data().intlist_attributes.size()); | 292 EXPECT_EQ(1U, column1->data().intlist_attributes.size()); |
| 288 EXPECT_EQ(ui::AX_ATTR_INDIRECT_CHILD_IDS, | 293 EXPECT_EQ(ui::AX_ATTR_INDIRECT_CHILD_IDS, |
| 289 column1->data().intlist_attributes[0].first); | 294 column1->data().intlist_attributes[0].first); |
| 290 const std::vector<int32> column1_indirect_child_ids = | 295 const std::vector<int32_t> column1_indirect_child_ids = |
| 291 column1->data().intlist_attributes[0].second; | 296 column1->data().intlist_attributes[0].second; |
| 292 EXPECT_EQ(1U, column1_indirect_child_ids.size()); | 297 EXPECT_EQ(1U, column1_indirect_child_ids.size()); |
| 293 EXPECT_EQ(cell1->id(), column1_indirect_child_ids[0]); | 298 EXPECT_EQ(cell1->id(), column1_indirect_child_ids[0]); |
| 294 const ui::AXNode* column2 = table->ChildAtIndex(2); | 299 const ui::AXNode* column2 = table->ChildAtIndex(2); |
| 295 EXPECT_EQ(ui::AX_ROLE_COLUMN, column2->data().role); | 300 EXPECT_EQ(ui::AX_ROLE_COLUMN, column2->data().role); |
| 296 EXPECT_EQ(0, column2->child_count()); | 301 EXPECT_EQ(0, column2->child_count()); |
| 297 EXPECT_EQ(ui::AX_ATTR_INDIRECT_CHILD_IDS, | 302 EXPECT_EQ(ui::AX_ATTR_INDIRECT_CHILD_IDS, |
| 298 column2->data().intlist_attributes[0].first); | 303 column2->data().intlist_attributes[0].first); |
| 299 const std::vector<int32> column2_indirect_child_ids = | 304 const std::vector<int32_t> column2_indirect_child_ids = |
| 300 column2->data().intlist_attributes[0].second; | 305 column2->data().intlist_attributes[0].second; |
| 301 EXPECT_EQ(1U, column2_indirect_child_ids.size()); | 306 EXPECT_EQ(1U, column2_indirect_child_ids.size()); |
| 302 EXPECT_EQ(cell2->id(), column2_indirect_child_ids[0]); | 307 EXPECT_EQ(cell2->id(), column2_indirect_child_ids[0]); |
| 303 } | 308 } |
| 304 | 309 |
| 305 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, | 310 IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest, |
| 306 MultipleInheritanceAccessibility2) { | 311 MultipleInheritanceAccessibility2) { |
| 307 // Here's another html snippet where WebKit puts the same node as a child | 312 // Here's another html snippet where WebKit puts the same node as a child |
| 308 // of two different parents. Instead of checking the exact output, just | 313 // of two different parents. Instead of checking the exact output, just |
| 309 // make sure that no id is reused in the resulting tree. | 314 // make sure that no id is reused in the resulting tree. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 GetIntAttr(table, ui::AX_ATTR_TABLE_COLUMN_COUNT)); | 439 GetIntAttr(table, ui::AX_ATTR_TABLE_COLUMN_COUNT)); |
| 435 EXPECT_EQ(2, GetIntAttr(table, ui::AX_ATTR_TABLE_ROW_COUNT)); | 440 EXPECT_EQ(2, GetIntAttr(table, ui::AX_ATTR_TABLE_ROW_COUNT)); |
| 436 | 441 |
| 437 const ui::AXNode* cell1 = table->ChildAtIndex(0)->ChildAtIndex(0); | 442 const ui::AXNode* cell1 = table->ChildAtIndex(0)->ChildAtIndex(0); |
| 438 const ui::AXNode* cell2 = table->ChildAtIndex(0)->ChildAtIndex(1); | 443 const ui::AXNode* cell2 = table->ChildAtIndex(0)->ChildAtIndex(1); |
| 439 const ui::AXNode* cell3 = table->ChildAtIndex(1)->ChildAtIndex(0); | 444 const ui::AXNode* cell3 = table->ChildAtIndex(1)->ChildAtIndex(0); |
| 440 const ui::AXNode* cell4 = table->ChildAtIndex(1)->ChildAtIndex(1); | 445 const ui::AXNode* cell4 = table->ChildAtIndex(1)->ChildAtIndex(1); |
| 441 | 446 |
| 442 ASSERT_EQ(ui::AX_ATTR_CELL_IDS, | 447 ASSERT_EQ(ui::AX_ATTR_CELL_IDS, |
| 443 table->data().intlist_attributes[0].first); | 448 table->data().intlist_attributes[0].first); |
| 444 const std::vector<int32>& table_cell_ids = | 449 const std::vector<int32_t>& table_cell_ids = |
| 445 table->data().intlist_attributes[0].second; | 450 table->data().intlist_attributes[0].second; |
| 446 ASSERT_EQ(6U, table_cell_ids.size()); | 451 ASSERT_EQ(6U, table_cell_ids.size()); |
| 447 EXPECT_EQ(cell1->id(), table_cell_ids[0]); | 452 EXPECT_EQ(cell1->id(), table_cell_ids[0]); |
| 448 EXPECT_EQ(cell1->id(), table_cell_ids[1]); | 453 EXPECT_EQ(cell1->id(), table_cell_ids[1]); |
| 449 EXPECT_EQ(cell2->id(), table_cell_ids[2]); | 454 EXPECT_EQ(cell2->id(), table_cell_ids[2]); |
| 450 EXPECT_EQ(cell3->id(), table_cell_ids[3]); | 455 EXPECT_EQ(cell3->id(), table_cell_ids[3]); |
| 451 EXPECT_EQ(cell4->id(), table_cell_ids[4]); | 456 EXPECT_EQ(cell4->id(), table_cell_ids[4]); |
| 452 EXPECT_EQ(cell4->id(), table_cell_ids[5]); | 457 EXPECT_EQ(cell4->id(), table_cell_ids[5]); |
| 453 | 458 |
| 454 EXPECT_EQ(0, GetIntAttr(cell1, | 459 EXPECT_EQ(0, GetIntAttr(cell1, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 484 GURL url(url_str); | 489 GURL url(url_str); |
| 485 NavigateToURL(shell(), url); | 490 NavigateToURL(shell(), url); |
| 486 const ui::AXTree& tree = GetAXTree(); | 491 const ui::AXTree& tree = GetAXTree(); |
| 487 const ui::AXNode* root = tree.root(); | 492 const ui::AXNode* root = tree.root(); |
| 488 ASSERT_EQ(1, root->child_count()); | 493 ASSERT_EQ(1, root->child_count()); |
| 489 const ui::AXNode* textbox = root->ChildAtIndex(0); | 494 const ui::AXNode* textbox = root->ChildAtIndex(0); |
| 490 EXPECT_EQ(true, GetBoolAttr(textbox, ui::AX_ATTR_CAN_SET_VALUE)); | 495 EXPECT_EQ(true, GetBoolAttr(textbox, ui::AX_ATTR_CAN_SET_VALUE)); |
| 491 } | 496 } |
| 492 | 497 |
| 493 } // namespace content | 498 } // namespace content |
| OLD | NEW |