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/debug/leak_annotations.h" | 8 #include "base/debug/leak_annotations.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 DumpAccessibilityTestBase(); | 24 DumpAccessibilityTestBase(); |
25 ~DumpAccessibilityTestBase() override; | 25 ~DumpAccessibilityTestBase() override; |
26 | 26 |
27 // Given a path to an HTML file relative to the test directory, | 27 // Given a path to an HTML file relative to the test directory, |
28 // loads the HTML, loads the accessibility tree, calls Dump(), then | 28 // loads the HTML, loads the accessibility tree, calls Dump(), then |
29 // compares the output to the expected result and has the test succeed | 29 // compares the output to the expected result and has the test succeed |
30 // or fail based on the diff. | 30 // or fail based on the diff. |
31 void RunTest(const base::FilePath file_path, const char* file_dir); | 31 void RunTest(const base::FilePath file_path, const char* file_dir); |
32 | 32 |
33 protected: | 33 protected: |
| 34 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 35 void SetUpOnMainThread() override; |
| 36 |
34 // | 37 // |
35 // For subclasses to override: | 38 // For subclasses to override: |
36 // | 39 // |
37 | 40 |
38 // This is called by RunTest after the document has finished loading, | 41 // This is called by RunTest after the document has finished loading, |
39 // including the load complete accessibility event. The subclass should | 42 // including the load complete accessibility event. The subclass should |
40 // dump whatever that specific test wants to dump, returning the result | 43 // dump whatever that specific test wants to dump, returning the result |
41 // as a sequence of strings. | 44 // as a sequence of strings. |
42 virtual std::vector<std::string> Dump() = 0; | 45 virtual std::vector<std::string> Dump() = 0; |
43 | 46 |
(...skipping 28 matching lines...) Expand all Loading... |
72 // filter specifies strings that should be suppressed. As an example, | 75 // filter specifies strings that should be suppressed. As an example, |
73 // @MAC-ALLOW:AXSubrole=* means that the AXSubrole attribute should be | 76 // @MAC-ALLOW:AXSubrole=* means that the AXSubrole attribute should be |
74 // printed, while @MAC-ALLOW:AXSubrole=AXList* means that any subrole | 77 // printed, while @MAC-ALLOW:AXSubrole=AXList* means that any subrole |
75 // beginning with the text "AXList" should be printed. | 78 // beginning with the text "AXList" should be printed. |
76 // | 79 // |
77 // The @WAIT-FOR:text directive allows the test to specify that the document | 80 // The @WAIT-FOR:text directive allows the test to specify that the document |
78 // may dynamically change after initial load, and the test is to wait | 81 // may dynamically change after initial load, and the test is to wait |
79 // until the given string (e.g., "text") appears in the resulting dump. | 82 // until the given string (e.g., "text") appears in the resulting dump. |
80 // A test can make some changes to the document, then append a magic string | 83 // A test can make some changes to the document, then append a magic string |
81 // indicating that the test is done, and this framework will wait for that | 84 // indicating that the test is done, and this framework will wait for that |
82 // string to appear before comparing the results. | 85 // string to appear before comparing the results. There can be multiple |
| 86 // @WAIT-FOR: directives. |
83 void ParseHtmlForExtraDirectives( | 87 void ParseHtmlForExtraDirectives( |
84 const std::string& test_html, | 88 const std::string& test_html, |
85 std::vector<AccessibilityTreeFormatter::Filter>* filters, | 89 std::vector<AccessibilityTreeFormatter::Filter>* filters, |
86 std::string* wait_for); | 90 std::vector<std::string>* wait_for); |
87 | 91 |
88 // Create the right AccessibilityTreeFormatter subclass. | 92 // Create the right AccessibilityTreeFormatter subclass. |
89 AccessibilityTreeFormatter* CreateAccessibilityTreeFormatter(); | 93 AccessibilityTreeFormatter* CreateAccessibilityTreeFormatter(); |
90 | 94 |
91 void RunTestForPlatform(const base::FilePath file_path, const char* file_dir); | 95 void RunTestForPlatform(const base::FilePath file_path, const char* file_dir); |
92 | 96 |
93 // The default filters plus the filters loaded from the test file. | 97 // The default filters plus the filters loaded from the test file. |
94 std::vector<AccessibilityTreeFormatter::Filter> filters_; | 98 std::vector<AccessibilityTreeFormatter::Filter> filters_; |
95 | 99 |
96 #if defined(LEAK_SANITIZER) && !defined(OS_NACL) | 100 #if defined(LEAK_SANITIZER) && !defined(OS_NACL) |
97 // http://crbug.com/568674 | 101 // http://crbug.com/568674 |
98 ScopedLeakSanitizerDisabler lsan_disabler; | 102 ScopedLeakSanitizerDisabler lsan_disabler; |
99 #endif | 103 #endif |
100 | 104 |
101 // The current AccessibilityTreeFormatter. | 105 // The current AccessibilityTreeFormatter. |
102 scoped_ptr<AccessibilityTreeFormatter> formatter_; | 106 scoped_ptr<AccessibilityTreeFormatter> formatter_; |
103 | 107 |
104 // Whether we're doing a native pass or internal/blink tree pass. | 108 // Whether we're doing a native pass or internal/blink tree pass. |
105 bool is_blink_pass_; | 109 bool is_blink_pass_; |
106 }; | 110 }; |
107 | 111 |
108 } // namespace content | 112 } // namespace content |
OLD | NEW |