Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: content/browser/accessibility/dump_accessibility_tree_browsertest.cc

Issue 2787843003: Add Accessibility Object Model to content features, and add a browser test. (Closed)
Patch Set: Update webexposed Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/child/runtime_features.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/test/scoped_feature_list.h"
15 #include "base/threading/thread_restrictions.h" 16 #include "base/threading/thread_restrictions.h"
16 #include "build/build_config.h" 17 #include "build/build_config.h"
17 #include "content/browser/accessibility/accessibility_tree_formatter.h" 18 #include "content/browser/accessibility/accessibility_tree_formatter.h"
18 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" 19 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h"
19 #include "content/browser/accessibility/browser_accessibility.h" 20 #include "content/browser/accessibility/browser_accessibility.h"
20 #include "content/browser/accessibility/browser_accessibility_manager.h" 21 #include "content/browser/accessibility/browser_accessibility_manager.h"
21 #include "content/browser/accessibility/dump_accessibility_browsertest_base.h" 22 #include "content/browser/accessibility/dump_accessibility_browsertest_base.h"
22 #include "content/browser/web_contents/web_contents_impl.h" 23 #include "content/browser/web_contents/web_contents_impl.h"
23 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
25 #include "content/public/common/content_features.h"
24 #include "content/public/common/content_paths.h" 26 #include "content/public/common/content_paths.h"
25 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
26 #include "content/public/test/content_browser_test_utils.h" 28 #include "content/public/test/content_browser_test_utils.h"
27 #include "content/shell/browser/shell.h" 29 #include "content/shell/browser/shell.h"
28 #include "content/test/accessibility_browser_test_utils.h" 30 #include "content/test/accessibility_browser_test_utils.h"
29 31
30 #if defined(OS_MACOSX) 32 #if defined(OS_MACOSX)
31 #include "base/mac/mac_util.h" 33 #include "base/mac/mac_util.h"
32 #endif 34 #endif
33 35
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 base::FilePath test_path = GetTestFilePath("accessibility", "aria"); 76 base::FilePath test_path = GetTestFilePath("accessibility", "aria");
75 { 77 {
76 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_setup; 78 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_setup;
77 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); 79 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName();
78 } 80 }
79 base::FilePath aria_file = test_path.Append(base::FilePath(file_path)); 81 base::FilePath aria_file = test_path.Append(base::FilePath(file_path));
80 82
81 RunTest(aria_file, "accessibility/aria"); 83 RunTest(aria_file, "accessibility/aria");
82 } 84 }
83 85
86 void RunAomTest(const base::FilePath::CharType* file_path) {
87 scoped_feature_list_.InitAndEnableFeature(
88 features::kAccessibilityObjectModel);
89
90 base::FilePath test_path = GetTestFilePath("accessibility", "aom");
91 {
92 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_setup;
93 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName();
94 }
95 base::FilePath aom_file = test_path.Append(base::FilePath(file_path));
96
97 RunTest(aom_file, "accessibility/aom");
98 }
99
84 void RunCSSTest(const base::FilePath::CharType* file_path) { 100 void RunCSSTest(const base::FilePath::CharType* file_path) {
85 base::FilePath test_path = GetTestFilePath("accessibility", "css"); 101 base::FilePath test_path = GetTestFilePath("accessibility", "css");
86 { 102 {
87 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_setup; 103 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_setup;
88 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); 104 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName();
89 } 105 }
90 base::FilePath css_file = test_path.Append(base::FilePath(file_path)); 106 base::FilePath css_file = test_path.Append(base::FilePath(file_path));
91 107
92 RunTest(css_file, "accessibility/css"); 108 RunTest(css_file, "accessibility/css");
93 } 109 }
(...skipping 17 matching lines...) Expand all
111 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( 127 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
112 shell()->web_contents()); 128 shell()->web_contents());
113 formatter->FormatAccessibilityTree( 129 formatter->FormatAccessibilityTree(
114 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(), 130 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(),
115 &actual_contents_utf16); 131 &actual_contents_utf16);
116 std::string actual_contents = base::UTF16ToUTF8(actual_contents_utf16); 132 std::string actual_contents = base::UTF16ToUTF8(actual_contents_utf16);
117 return base::SplitString( 133 return base::SplitString(
118 actual_contents, "\n", 134 actual_contents, "\n",
119 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); 135 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
120 } 136 }
137
138 protected:
139 base::test::ScopedFeatureList scoped_feature_list_;
121 }; 140 };
122 141
123 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSColor) { 142 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSColor) {
124 RunCSSTest(FILE_PATH_LITERAL("color.html")); 143 RunCSSTest(FILE_PATH_LITERAL("color.html"));
125 } 144 }
126 145
127 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSFontStyle) { 146 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSFontStyle) {
128 RunCSSTest(FILE_PATH_LITERAL("font-style.html")); 147 RunCSSTest(FILE_PATH_LITERAL("font-style.html"));
129 } 148 }
130 149
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 184 }
166 185
167 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityANoText) { 186 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityANoText) {
168 RunHtmlTest(FILE_PATH_LITERAL("a-no-text.html")); 187 RunHtmlTest(FILE_PATH_LITERAL("a-no-text.html"));
169 } 188 }
170 189
171 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAOnclick) { 190 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAOnclick) {
172 RunHtmlTest(FILE_PATH_LITERAL("a-onclick.html")); 191 RunHtmlTest(FILE_PATH_LITERAL("a-onclick.html"));
173 } 192 }
174 193
194 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAomChecked) {
195 RunAomTest(FILE_PATH_LITERAL("aom-checked.html"));
196 }
197
175 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, 198 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
176 AccessibilityAriaActivedescendant) { 199 AccessibilityAriaActivedescendant) {
177 RunAriaTest(FILE_PATH_LITERAL("aria-activedescendant.html")); 200 RunAriaTest(FILE_PATH_LITERAL("aria-activedescendant.html"));
178 } 201 }
179 202
180 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaAlert) { 203 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaAlert) {
181 RunAriaTest(FILE_PATH_LITERAL("aria-alert.html")); 204 RunAriaTest(FILE_PATH_LITERAL("aria-alert.html"));
182 } 205 }
183 206
184 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, 207 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest,
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 // crbug.com/281952 1480 // crbug.com/281952
1458 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, DISABLED_AccessibilityVideo) { 1481 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, DISABLED_AccessibilityVideo) {
1459 RunHtmlTest(FILE_PATH_LITERAL("video.html")); 1482 RunHtmlTest(FILE_PATH_LITERAL("video.html"));
1460 } 1483 }
1461 1484
1462 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) { 1485 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) {
1463 RunHtmlTest(FILE_PATH_LITERAL("wbr.html")); 1486 RunHtmlTest(FILE_PATH_LITERAL("wbr.html"));
1464 } 1487 }
1465 1488
1466 } // namespace content 1489 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/child/runtime_features.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698