chromium/third_party/blink/web_tests/accessibility/table-with-grid-roles.html

<!DOCTYPE HTML>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<div id="container">
  <table id="table1" role="grid">
    <tr>
      <td>1, 1</td><td>2, 1</td>
    </tr>
    <tr>
      <td>1, 1</td><td>2, 1</td>
    </tr>
  </table>

  <table id="table2" role="grid">
    <tr role="row">
      <td>1, 1</td><td>2, 1</td>
    </tr>
    <tr role="row">
      <td>1, 1</td><td>2, 1</td>
    </tr>
  </table>

  <table id="table3" role="grid">
    <tr role="row">
      <td role="gridcell">1, 1</td><td role="gridcell">2, 1</td>
    </tr>
    <tr role="row">
      <td role="gridcell">1, 1</td><td role="gridcell">2, 1</td>
    </tr>
  </table>
</div>

<div id="console"></div>

<script>
test(function(t) {
  var axTable = accessibilityController.accessibleElementById('table1');
  assert_equals(axTable.role, "AXRole: AXGrid");

  assert_equals(axTable.rowCount, 2);
  assert_equals(axTable.columnCount, 2);
}, "Test table with ARIA grid role on just table element.");

test(function(t) {
  var axTable = accessibilityController.accessibleElementById('table2');
  assert_equals(axTable.role, "AXRole: AXGrid");

  assert_equals(axTable.rowCount, 2);
  assert_equals(axTable.columnCount, 2);
}, "Test table with ARIA grid role on table and row role on rows.");

test(function(t) {
  var axTable = accessibilityController.accessibleElementById('table3');
  assert_equals(axTable.role, "AXRole: AXGrid");

  assert_equals(axTable.rowCount, 2);
  assert_equals(axTable.columnCount, 2);
}, "Test table with ARIA grid roles on all elements.");

</script>