Accessibility Testing

DumpAccessibilityTree

Our new preferred system for testing accessibility functionality is DumpAccessibilityTree.

It's loosely patterned after DumpRenderTree and WebKit layout tests, so if you've ever written a layout test, you already understand the idea behind an accessibility test!

To run the DumpAccessibilityTree tests, build content_browsertests and then run it with --gtest_filter="DumpAccessibilityTree*", like this:

> ninja -C out/Debug content_browsertests
> out/Debug/content_browsertests --gtest_filter="DumpAccessibilityTree*"

DumpAccessibilityTree tests are platform-specific. They're specifically designed to test the platform-native accessibility tree exposed by a given html page. However, it isn't that hard to write a DumpAccessibilityTree test for a platform other than your primary platform using the trybots.

The code for DumpAccessibilityTree is found in these source files;

content/browser/accessibility/dump_accessibility_tree_browsertest.cc
content/browser/accessibility/dump_accessibility_tree_helper.h
content/browser/accessibility/dump_accessibility_tree_helper.cc
content/browser/accessibility/dump_accessibility_tree_helper_mac.mm
content/browser/accessibility/dump_accessibility_tree_helper_win.cc

Each individual test has a set of data files: an html files, and expectation files for each platform, e.g.:

 content/test/data/accessibility/footer.html
 content/test/data/accessibility/footer-expected-mac.txt
 content/test/data/accessibility/footer-expected-win.txt

For each test, DumpAccessibilityTree loads the html file into a browser window, recursively explores the whole accessibility tree, then dumps the result in a text format (subject to some filters that you can customize, so you don't dump every attribute), and compares the result to the expectation file.

WebKit Layout Tests

Another really important aspect of testing Chromium accessibility is WebKit layout tests. There are a number of accessibility tests in these directories:

 third_party/WebKit/LayoutTests/accessibility/
 third_party/WebKit/LayoutTests/platform/chromium/accessibility/

These tests are critically important for testing WebKit's implementation of accessibility at a low-level, including parsing html and sending notifications. However, for Chromium these tests are not very useful for testing the attributes that are exposed to the native platform API, because Chromium extracts basically the same data from WebKit's accessibility tree on all platforms, and implements the platform-native accessibility APIs in Chromium code in the browser process, which is a couple of abstractions removed from WebKit.

If you want to test that changing a given ARIA attribute sends a notification, write a WebKit Layout test. If you want to test that an ARIA checkbox maps to the ROLE_SYSTEM_CHECKBOX role on Windows, write a DumpAccessibilityTree test.

Other Browser Tests

TODO

Renderer Tests

TODO
Comments