| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "content/browser/accessibility/accessibility_tree_formatter.h" | 9 #include "content/browser/accessibility/accessibility_tree_formatter.h" |
| 10 #include "content/public/test/content_browser_test.h" | 10 #include "content/public/test/content_browser_test.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 // Base class for an accessibility browsertest that takes an HTML file as | 14 // Base class for an accessibility browsertest that takes an HTML file as |
| 15 // input, loads it into a tab, dumps some accessibility data in text format, | 15 // input, loads it into a tab, dumps some accessibility data in text format, |
| 16 // then compares that text to an expectation file in the same directory. | 16 // then compares that text to an expectation file in the same directory. |
| 17 // | 17 // |
| 18 // The system was inspired by WebKit/Blink LayoutTests, but customized for | 18 // The system was inspired by WebKit/Blink LayoutTests, but customized for |
| 19 // testing accessibility in Chromium. | 19 // testing accessibility in Chromium. |
| 20 class DumpAccessibilityTestBase : public ContentBrowserTest { | 20 class DumpAccessibilityTestBase : public ContentBrowserTest { |
| 21 public: | 21 public: |
| 22 DumpAccessibilityTestBase(); | 22 DumpAccessibilityTestBase(); |
| 23 ~DumpAccessibilityTestBase() override; | 23 ~DumpAccessibilityTestBase() override; |
| 24 | 24 |
| 25 // Given a path to an HTML file relative to the test directory, | 25 // Given a path to an HTML file relative to the test directory, |
| 26 // loads the HTML, loads the accessibility tree, calls Dump(), then | 26 // loads the HTML, loads the accessibility tree, calls Dump(), then |
| 27 // compares the output to the expected result and has the test succeed | 27 // compares the output to the expected result and has the test succeed |
| 28 // or fail based on the diff. | 28 // or fail based on the diff. |
| 29 void RunTest(const base::FilePath::CharType* file_path); | 29 void RunTest(const base::FilePath file_path, const char* file_dir); |
| 30 | 30 |
| 31 protected: | 31 protected: |
| 32 // | 32 // |
| 33 // For subclasses to override: | 33 // For subclasses to override: |
| 34 // | 34 // |
| 35 | 35 |
| 36 // This is called by RunTest after the document has finished loading, | 36 // This is called by RunTest after the document has finished loading, |
| 37 // including the load complete accessibility event. The subclass should | 37 // including the load complete accessibility event. The subclass should |
| 38 // dump whatever that specific test wants to dump, returning the result | 38 // dump whatever that specific test wants to dump, returning the result |
| 39 // as a sequence of strings. | 39 // as a sequence of strings. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 void ParseHtmlForExtraDirectives( | 81 void ParseHtmlForExtraDirectives( |
| 82 const std::string& test_html, | 82 const std::string& test_html, |
| 83 std::vector<AccessibilityTreeFormatter::Filter>* filters, | 83 std::vector<AccessibilityTreeFormatter::Filter>* filters, |
| 84 std::string* wait_for); | 84 std::string* wait_for); |
| 85 | 85 |
| 86 // The default filters plus the filters loaded from the test file. | 86 // The default filters plus the filters loaded from the test file. |
| 87 std::vector<AccessibilityTreeFormatter::Filter> filters_; | 87 std::vector<AccessibilityTreeFormatter::Filter> filters_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace content | 90 } // namespace content |
| OLD | NEW |