dump_accessibility_tree_browsertest.cc revision 5f1c94371a64b3196d4be9466099bb892df9b88e
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include <set>
6d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include <string>
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <vector>
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/command_line.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/file_util.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/logging.h"
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/path_service.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/strings/string16.h"
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/strings/string_split.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/strings/string_util.h"
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/strings/utf_string_conversions.h"
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/browser/accessibility/accessibility_tree_formatter.h"
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/browser/accessibility/browser_accessibility.h"
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/browser/accessibility/browser_accessibility_manager.h"
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/browser/renderer_host/render_view_host_impl.h"
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/browser/renderer_host/render_widget_host_view_base.h"
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/browser/web_contents/web_contents_impl.h"
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/web_contents.h"
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/common/content_paths.h"
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/common/content_switches.h"
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/common/url_constants.h"
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/test/content_browser_test.h"
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/test/content_browser_test_utils.h"
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/shell/browser/shell.h"
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/test/accessibility_browser_test_utils.h"
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "testing/gtest/include/gtest/gtest.h"
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// TODO(aboxhall): Create expectations on Android for these
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(OS_ANDROID)
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define MAYBE(x) DISABLED_##x
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#else
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define MAYBE(x) x
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace content {
4146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
4246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)namespace {
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const char kCommentToken = '#';
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const char kMarkSkipFile[] = "#<skip";
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const char kMarkEndOfFile[] = "<-- End-of-file -->";
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const char kSignalDiff[] = "*";
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
49cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}  // namespace
50cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
51cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)typedef AccessibilityTreeFormatter::Filter Filter;
52cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
531e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// This test takes a snapshot of the platform BrowserAccessibility tree and
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// tests it against an expected baseline.
555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)//
565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// The flow of the test is as outlined below.
575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// 1. Load an html file from chrome/test/data/accessibility.
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 2. Read the expectation.
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 3. Browse to the page and serialize the platform specific tree into a human
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//    readable string.
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 4. Perform a comparison between actual and expected and fail if they do not
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//    exactly match.
63a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class DumpAccessibilityTreeTest : public ContentBrowserTest {
642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public:
652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Utility helper that does a comment aware equality check.
662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Returns array of lines from expected file which are different.
672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  std::vector<int> DiffLines(const std::vector<std::string>& expected_lines,
682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                             const std::vector<std::string>& actual_lines) {
69eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    int actual_lines_count = actual_lines.size();
70eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    int expected_lines_count = expected_lines.size();
71eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    std::vector<int> diff_lines;
72eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    int i = 0, j = 0;
732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    while (i < actual_lines_count && j < expected_lines_count) {
742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      if (expected_lines[j].size() == 0 ||
752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          expected_lines[j][0] == kCommentToken) {
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        // Skip comment lines and blank lines in expected output.
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        ++j;
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        continue;
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      }
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      if (actual_lines[i] != expected_lines[j])
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        diff_lines.push_back(j);
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      ++i;
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      ++j;
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    }
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // Actual file has been fully checked.
88010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)    return diff_lines;
89010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  }
90010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void AddDefaultFilters(std::vector<Filter>* filters) {
927d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)    filters->push_back(Filter(base::ASCIIToUTF16("FOCUSABLE"), Filter::ALLOW));
93a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)    filters->push_back(Filter(base::ASCIIToUTF16("READONLY"), Filter::ALLOW));
94c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch    filters->push_back(Filter(base::ASCIIToUTF16("*=''"), Filter::DENY));
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
970529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // Parse the test html file and parse special directives, usually
980529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // beginning with an '@' and inside an HTML comment, that control how the
990529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // test is run and how the results are interpreted.
1005c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  //
1015c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  // When the accessibility tree is dumped as text, each attribute is
1025c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  // run through filters before being appended to the string. An "allow"
10346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // filter specifies attribute strings that should be dumped, and a "deny"
10446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // filter specifies strings that should be suppressed. As an example,
1055f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // @MAC-ALLOW:AXSubrole=* means that the AXSubrole attribute should be
1065f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // printed, while @MAC-ALLOW:AXSubrole=AXList* means that any subrole
1070529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // beginning with the text "AXList" should be printed.
1080529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  //
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The @WAIT-FOR:text directive allows the test to specify that the document
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // may dynamically change after initial load, and the test is to wait
111cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // until the given string (e.g., "text") appears in the resulting dump.
112cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // A test can make some changes to the document, then append a magic string
113cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // indicating that the test is done, and this framework will wait for that
114cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // string to appear before comparing the results.
115cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void ParseHtmlForExtraDirectives(const std::string& test_html,
116cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                                   std::vector<Filter>* filters,
117cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                                   std::string* wait_for) {
1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    std::vector<std::string> lines;
1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    base::SplitString(test_html, '\n', &lines);
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    for (std::vector<std::string>::const_iterator iter = lines.begin();
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)         iter != lines.end();
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)         ++iter) {
1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const std::string& line = *iter;
1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const std::string& allow_empty_str =
1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)          AccessibilityTreeFormatter::GetAllowEmptyString();
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const std::string& allow_str =
1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)          AccessibilityTreeFormatter::GetAllowString();
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const std::string& deny_str =
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)          AccessibilityTreeFormatter::GetDenyString();
1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const std::string& wait_str = "@WAIT-FOR:";
1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      if (StartsWithASCII(line, allow_empty_str, true)) {
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        filters->push_back(
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)          Filter(base::UTF8ToUTF16(line.substr(allow_empty_str.size())),
1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                 Filter::ALLOW_EMPTY));
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      } else if (StartsWithASCII(line, allow_str, true)) {
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        filters->push_back(Filter(base::UTF8ToUTF16(
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                      line.substr(allow_str.size())),
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                  Filter::ALLOW));
139116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      } else if (StartsWithASCII(line, deny_str, true)) {
140116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch        filters->push_back(Filter(base::UTF8ToUTF16(
141116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                                      line.substr(deny_str.size())),
142116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                                  Filter::DENY));
143116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      } else if (StartsWithASCII(line, wait_str, true)) {
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        *wait_for = line.substr(wait_str.size());
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      }
146d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)    }
147  }
148
149  virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
150    ContentBrowserTest::SetUpCommandLine(command_line);
151    // Enable <dialog>, which is used in some tests.
152    CommandLine::ForCurrentProcess()->AppendSwitch(
153        switches::kEnableExperimentalWebPlatformFeatures);
154  }
155
156  void RunTest(const base::FilePath::CharType* file_path);
157};
158
159void DumpAccessibilityTreeTest::RunTest(
160    const base::FilePath::CharType* file_path) {
161  NavigateToURL(shell(), GURL(url::kAboutBlankURL));
162
163  // Setup test paths.
164  base::FilePath dir_test_data;
165  ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data));
166  base::FilePath test_path(
167      dir_test_data.Append(FILE_PATH_LITERAL("accessibility")));
168  ASSERT_TRUE(base::PathExists(test_path))
169      << test_path.LossyDisplayName();
170
171  base::FilePath html_file = test_path.Append(base::FilePath(file_path));
172  // Output the test path to help anyone who encounters a failure and needs
173  // to know where to look.
174  printf("Testing: %s\n", html_file.MaybeAsASCII().c_str());
175
176  std::string html_contents;
177  base::ReadFileToString(html_file, &html_contents);
178
179  // Read the expected file.
180  std::string expected_contents_raw;
181  base::FilePath expected_file =
182    base::FilePath(html_file.RemoveExtension().value() +
183                   AccessibilityTreeFormatter::GetExpectedFileSuffix());
184  base::ReadFileToString(expected_file, &expected_contents_raw);
185
186  // Tolerate Windows-style line endings (\r\n) in the expected file:
187  // normalize by deleting all \r from the file (if any) to leave only \n.
188  std::string expected_contents;
189  base::RemoveChars(expected_contents_raw, "\r", &expected_contents);
190
191  if (!expected_contents.compare(0, strlen(kMarkSkipFile), kMarkSkipFile)) {
192    printf("Skipping this test on this platform.\n");
193    return;
194  }
195
196  // Parse filters and other directives in the test file.
197  std::vector<Filter> filters;
198  std::string wait_for;
199  AddDefaultFilters(&filters);
200  ParseHtmlForExtraDirectives(html_contents, &filters, &wait_for);
201
202  // Load the page.
203  base::string16 html_contents16;
204  html_contents16 = base::UTF8ToUTF16(html_contents);
205  GURL url = GetTestUrl("accessibility",
206                        html_file.BaseName().MaybeAsASCII().c_str());
207
208  // If there's a @WAIT-FOR directive, set up an accessibility notification
209  // waiter that returns on any event; we'll stop when we get the text we're
210  // waiting for, or time out. Otherwise just wait specifically for
211  // the "load complete" event.
212  scoped_ptr<AccessibilityNotificationWaiter> waiter;
213  if (!wait_for.empty()) {
214    waiter.reset(new AccessibilityNotificationWaiter(
215        shell(), AccessibilityModeComplete, ui::AX_EVENT_NONE));
216  } else {
217    waiter.reset(new AccessibilityNotificationWaiter(
218        shell(), AccessibilityModeComplete, ui::AX_EVENT_LOAD_COMPLETE));
219  }
220
221  // Load the test html.
222  NavigateToURL(shell(), url);
223
224  // Wait for notifications. If there's a @WAIT-FOR directive, break when
225  // the text we're waiting for appears in the dump, otherwise break after
226  // the first notification, which will be a load complete.
227  WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
228      shell()->web_contents());
229  std::string actual_contents;
230  do {
231    waiter->WaitForNotification();
232    base::string16 actual_contents_utf16;
233    AccessibilityTreeFormatter formatter(
234        web_contents->GetRootBrowserAccessibilityManager()->GetRoot());
235    formatter.SetFilters(filters);
236    formatter.FormatAccessibilityTree(&actual_contents_utf16);
237    actual_contents = base::UTF16ToUTF8(actual_contents_utf16);
238  } while (!wait_for.empty() &&
239           actual_contents.find(wait_for) == std::string::npos);
240
241  // Perform a diff (or write the initial baseline).
242  std::vector<std::string> actual_lines, expected_lines;
243  Tokenize(actual_contents, "\n", &actual_lines);
244  Tokenize(expected_contents, "\n", &expected_lines);
245  // Marking the end of the file with a line of text ensures that
246  // file length differences are found.
247  expected_lines.push_back(kMarkEndOfFile);
248  actual_lines.push_back(kMarkEndOfFile);
249
250  std::vector<int> diff_lines = DiffLines(expected_lines, actual_lines);
251  bool is_different = diff_lines.size() > 0;
252  EXPECT_FALSE(is_different);
253  if (is_different) {
254    // Mark the expected lines which did not match actual output with a *.
255    printf("* Line Expected\n");
256    printf("- ---- --------\n");
257    for (int line = 0, diff_index = 0;
258         line < static_cast<int>(expected_lines.size());
259         ++line) {
260      bool is_diff = false;
261      if (diff_index < static_cast<int>(diff_lines.size()) &&
262          diff_lines[diff_index] == line) {
263        is_diff = true;
264        ++diff_index;
265      }
266      printf("%1s %4d %s\n", is_diff? kSignalDiff : "", line + 1,
267             expected_lines[line].c_str());
268    }
269    printf("\nActual\n");
270    printf("------\n");
271    printf("%s\n", actual_contents.c_str());
272  }
273
274  if (!base::PathExists(expected_file)) {
275    base::FilePath actual_file =
276        base::FilePath(html_file.RemoveExtension().value() +
277                       AccessibilityTreeFormatter::GetActualFileSuffix());
278
279    EXPECT_TRUE(base::WriteFile(
280        actual_file, actual_contents.c_str(), actual_contents.size()));
281
282    ADD_FAILURE() << "No expectation found. Create it by doing:\n"
283                  << "mv " << actual_file.LossyDisplayName() << " "
284                  << expected_file.LossyDisplayName();
285  }
286}
287
288IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityA) {
289  RunTest(FILE_PATH_LITERAL("a.html"));
290}
291
292IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAddress) {
293  RunTest(FILE_PATH_LITERAL("address.html"));
294}
295
296IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAName) {
297  RunTest(FILE_PATH_LITERAL("a-name.html"));
298}
299
300IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityANoText) {
301  RunTest(FILE_PATH_LITERAL("a-no-text.html"));
302}
303
304IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAOnclick) {
305  RunTest(FILE_PATH_LITERAL("a-onclick.html"));
306}
307
308IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
309                       AccessibilityAriaApplication) {
310  RunTest(FILE_PATH_LITERAL("aria-application.html"));
311}
312
313IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
314                       AccessibilityAriaAutocomplete) {
315  RunTest(FILE_PATH_LITERAL("aria-autocomplete.html"));
316}
317
318// crbug.com/98976 will cause new elements to be added to the Blink a11y tree
319// Re-baseline after the Blink change goes in
320IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
321                       DISABLED_AccessibilityAriaCombobox) {
322  RunTest(FILE_PATH_LITERAL("aria-combobox.html"));
323}
324
325IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
326                       MAYBE(AccessibilityAriaFlowto)) {
327  RunTest(FILE_PATH_LITERAL("aria-flowto.html"));
328}
329
330IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaInvalid) {
331  RunTest(FILE_PATH_LITERAL("aria-invalid.html"));
332}
333
334IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
335                       AccessibilityAriaLabelledByHeading) {
336  RunTest(FILE_PATH_LITERAL("aria-labelledby-heading.html"));
337}
338
339IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaLevel) {
340  RunTest(FILE_PATH_LITERAL("aria-level.html"));
341}
342
343IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaList) {
344  RunTest(FILE_PATH_LITERAL("aria-list.html"));
345}
346
347IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
348                       AccessibilityAriaListBoxActiveDescendant) {
349  RunTest(FILE_PATH_LITERAL("aria-listbox-activedescendant.html"));
350}
351
352IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
353                       AccessibilityAriaListBoxAriaSelected) {
354  RunTest(FILE_PATH_LITERAL("aria-listbox-aria-selected.html"));
355}
356
357IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
358                       AccessibilityAriaListBoxChildFocus) {
359  RunTest(FILE_PATH_LITERAL("aria-listbox-childfocus.html"));
360}
361
362IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaMenu) {
363  RunTest(FILE_PATH_LITERAL("aria-menu.html"));
364}
365
366IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
367                       AccessibilityAriaMenuitemradio) {
368  RunTest(FILE_PATH_LITERAL("aria-menuitemradio.html"));
369}
370
371IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
372                       AccessibilityAriaPressed) {
373  RunTest(FILE_PATH_LITERAL("aria-pressed.html"));
374}
375
376IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
377                       AccessibilityAriaProgressbar) {
378  RunTest(FILE_PATH_LITERAL("aria-progressbar.html"));
379}
380
381IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
382                       AccessibilityAriaToolbar) {
383  RunTest(FILE_PATH_LITERAL("toolbar.html"));
384}
385
386IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
387                       AccessibilityAriaValueMin) {
388  RunTest(FILE_PATH_LITERAL("aria-valuemin.html"));
389}
390
391IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
392                       AccessibilityAriaValueMax) {
393  RunTest(FILE_PATH_LITERAL("aria-valuemax.html"));
394}
395
396IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityArticle) {
397  RunTest(FILE_PATH_LITERAL("article.html"));
398}
399
400IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAWithImg) {
401  RunTest(FILE_PATH_LITERAL("a-with-img.html"));
402}
403
404IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityBdo) {
405  RunTest(FILE_PATH_LITERAL("bdo.html"));
406}
407
408IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityBR) {
409  RunTest(FILE_PATH_LITERAL("br.html"));
410}
411
412IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityButtonNameCalc) {
413  RunTest(FILE_PATH_LITERAL("button-name-calc.html"));
414}
415
416IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCanvas) {
417  RunTest(FILE_PATH_LITERAL("canvas.html"));
418}
419
420IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
421                       AccessibilityCheckboxNameCalc) {
422  RunTest(FILE_PATH_LITERAL("checkbox-name-calc.html"));
423}
424
425IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityDialog) {
426  RunTest(FILE_PATH_LITERAL("dialog.html"));
427}
428
429IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityDiv) {
430  RunTest(FILE_PATH_LITERAL("div.html"));
431}
432
433IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityDl) {
434  RunTest(FILE_PATH_LITERAL("dl.html"));
435}
436
437IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
438                       AccessibilityContenteditableDescendants) {
439  RunTest(FILE_PATH_LITERAL("contenteditable-descendants.html"));
440}
441
442IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityEm) {
443  RunTest(FILE_PATH_LITERAL("em.html"));
444}
445
446IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityFooter) {
447  RunTest(FILE_PATH_LITERAL("footer.html"));
448}
449
450IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityForm) {
451  RunTest(FILE_PATH_LITERAL("form.html"));
452}
453
454IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityHeading) {
455  RunTest(FILE_PATH_LITERAL("heading.html"));
456}
457
458IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityHR) {
459  RunTest(FILE_PATH_LITERAL("hr.html"));
460}
461
462IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
463                       AccessibilityIframeCoordinates) {
464  RunTest(FILE_PATH_LITERAL("iframe-coordinates.html"));
465}
466
467IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityInputButton) {
468  RunTest(FILE_PATH_LITERAL("input-button.html"));
469}
470
471IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
472                       AccessibilityInputButtonInMenu) {
473  RunTest(FILE_PATH_LITERAL("input-button-in-menu.html"));
474}
475
476IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityInputColor) {
477  RunTest(FILE_PATH_LITERAL("input-color.html"));
478}
479
480IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
481                       AccessibilityInputImageButtonInMenu) {
482  RunTest(FILE_PATH_LITERAL("input-image-button-in-menu.html"));
483}
484
485IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityInputRange) {
486  RunTest(FILE_PATH_LITERAL("input-range.html"));
487}
488
489IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
490                       AccessibilityInputTextNameCalc) {
491  RunTest(FILE_PATH_LITERAL("input-text-name-calc.html"));
492}
493
494// crbug.com/98976 will cause new elements to be added to the Blink a11y tree
495// Re-baseline after the Blink change goes in
496IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
497                       DISABLED_AccessibilityInputTypes) {
498  RunTest(FILE_PATH_LITERAL("input-types.html"));
499}
500
501IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityLabel) {
502  RunTest(FILE_PATH_LITERAL("label.html"));
503}
504
505IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityLandmark) {
506  RunTest(FILE_PATH_LITERAL("landmark.html"));
507}
508
509IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityListMarkers) {
510  RunTest(FILE_PATH_LITERAL("list-markers.html"));
511}
512
513IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
514                       AccessibilityModalDialogClosed) {
515  RunTest(FILE_PATH_LITERAL("modal-dialog-closed.html"));
516}
517
518IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
519                       AccessibilityModalDialogOpened) {
520  RunTest(FILE_PATH_LITERAL("modal-dialog-opened.html"));
521}
522
523IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
524                       AccessibilityModalDialogInIframeClosed) {
525  RunTest(FILE_PATH_LITERAL("modal-dialog-in-iframe-closed.html"));
526}
527
528IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
529                       AccessibilityModalDialogInIframeOpened) {
530  RunTest(FILE_PATH_LITERAL("modal-dialog-in-iframe-opened.html"));
531}
532
533IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
534                       AccessibilityModalDialogStack) {
535  RunTest(FILE_PATH_LITERAL("modal-dialog-stack.html"));
536}
537
538IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityP) {
539  RunTest(FILE_PATH_LITERAL("p.html"));
540}
541
542IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityRegion) {
543  RunTest(FILE_PATH_LITERAL("region.html"));
544}
545
546IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilitySelect) {
547  RunTest(FILE_PATH_LITERAL("select.html"));
548}
549
550IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilitySpan) {
551  RunTest(FILE_PATH_LITERAL("span.html"));
552}
553
554IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilitySpinButton) {
555  RunTest(FILE_PATH_LITERAL("spinbutton.html"));
556}
557
558// TODO(dmazzoni): Rebaseline this test after Blink rolls past r155083.
559// See http://crbug.com/265619
560IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, DISABLED_AccessibilitySvg) {
561  RunTest(FILE_PATH_LITERAL("svg.html"));
562}
563
564IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityTab) {
565  RunTest(FILE_PATH_LITERAL("tab.html"));
566}
567
568IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityTableSimple) {
569  RunTest(FILE_PATH_LITERAL("table-simple.html"));
570}
571
572IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityTableSpans) {
573  RunTest(FILE_PATH_LITERAL("table-spans.html"));
574}
575
576IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityTransition) {
577  RunTest(FILE_PATH_LITERAL("transition.html"));
578}
579
580IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
581                       AccessibilityToggleButton) {
582  RunTest(FILE_PATH_LITERAL("togglebutton.html"));
583}
584
585IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityUl) {
586  RunTest(FILE_PATH_LITERAL("ul.html"));
587}
588
589IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) {
590  RunTest(FILE_PATH_LITERAL("wbr.html"));
591}
592
593IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
594                       AccessibilityAriaActivedescendant) {
595  RunTest(FILE_PATH_LITERAL("aria-activedescendant.html"));
596}
597
598}  // namespace content
599