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

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

Issue 1768753003: Implemented the reporting of text style and language information on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test expectations. Created 4 years, 9 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
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"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 base::FilePath dir_test_data; 72 base::FilePath dir_test_data;
73 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); 73 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data));
74 base::FilePath test_path(dir_test_data.AppendASCII("accessibility") 74 base::FilePath test_path(dir_test_data.AppendASCII("accessibility")
75 .AppendASCII("aria")); 75 .AppendASCII("aria"));
76 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); 76 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName();
77 77
78 base::FilePath aria_file = test_path.Append(base::FilePath(file_path)); 78 base::FilePath aria_file = test_path.Append(base::FilePath(file_path));
79 RunTest(aria_file, "accessibility/aria"); 79 RunTest(aria_file, "accessibility/aria");
80 } 80 }
81 81
82 void RunCSSTest(const base::FilePath::CharType* file_path) {
83 base::FilePath dir_test_data;
84 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data));
85 base::FilePath test_path(
86 dir_test_data.AppendASCII("accessibility").AppendASCII("css"));
87 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName();
88
89 base::FilePath css_file = test_path.Append(base::FilePath(file_path));
90 RunTest(css_file, "accessibility/css");
91 }
92
82 void RunHtmlTest(const base::FilePath::CharType* file_path) { 93 void RunHtmlTest(const base::FilePath::CharType* file_path) {
83 base::FilePath dir_test_data; 94 base::FilePath dir_test_data;
84 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); 95 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data));
85 base::FilePath test_path(dir_test_data.AppendASCII("accessibility") 96 base::FilePath test_path(dir_test_data.AppendASCII("accessibility")
86 .AppendASCII("html")); 97 .AppendASCII("html"));
87 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); 98 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName();
88 99
89 base::FilePath html_file = test_path.Append(base::FilePath(file_path)); 100 base::FilePath html_file = test_path.Append(base::FilePath(file_path));
90 RunTest(html_file, "accessibility/html"); 101 RunTest(html_file, "accessibility/html");
91 } 102 }
92 103
93 std::vector<std::string> Dump() override { 104 std::vector<std::string> Dump() override {
94 scoped_ptr<AccessibilityTreeFormatter> formatter( 105 scoped_ptr<AccessibilityTreeFormatter> formatter(
95 CreateAccessibilityTreeFormatter()); 106 CreateAccessibilityTreeFormatter());
96 formatter->SetFilters(filters_); 107 formatter->SetFilters(filters_);
97 base::string16 actual_contents_utf16; 108 base::string16 actual_contents_utf16;
98 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( 109 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
99 shell()->web_contents()); 110 shell()->web_contents());
100 formatter->FormatAccessibilityTree( 111 formatter->FormatAccessibilityTree(
101 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(), 112 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(),
102 &actual_contents_utf16); 113 &actual_contents_utf16);
103 std::string actual_contents = base::UTF16ToUTF8(actual_contents_utf16); 114 std::string actual_contents = base::UTF16ToUTF8(actual_contents_utf16);
104 return base::SplitString( 115 return base::SplitString(
105 actual_contents, "\n", 116 actual_contents, "\n",
106 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); 117 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
107 } 118 }
108 }; 119 };
109 120
121 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSColor) {
122 RunCSSTest(FILE_PATH_LITERAL("color.html"));
123 }
124
125 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSFontStyle) {
126 RunCSSTest(FILE_PATH_LITERAL("font-style.html"));
127 }
128
129 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSLanguage) {
130 RunCSSTest(FILE_PATH_LITERAL("language.html"));
131 }
132
110 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityA) { 133 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityA) {
111 RunHtmlTest(FILE_PATH_LITERAL("a.html")); 134 RunHtmlTest(FILE_PATH_LITERAL("a.html"));
112 } 135 }
113 136
114 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAbbr) { 137 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAbbr) {
115 RunHtmlTest(FILE_PATH_LITERAL("abbr.html")); 138 RunHtmlTest(FILE_PATH_LITERAL("abbr.html"));
116 } 139 }
117 140
118 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAddress) { 141 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAddress) {
119 RunHtmlTest(FILE_PATH_LITERAL("address.html")); 142 RunHtmlTest(FILE_PATH_LITERAL("address.html"));
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 // crbug.com/281952 1308 // crbug.com/281952
1286 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, DISABLED_AccessibilityVideo) { 1309 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, DISABLED_AccessibilityVideo) {
1287 RunHtmlTest(FILE_PATH_LITERAL("video.html")); 1310 RunHtmlTest(FILE_PATH_LITERAL("video.html"));
1288 } 1311 }
1289 1312
1290 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) { 1313 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) {
1291 RunHtmlTest(FILE_PATH_LITERAL("wbr.html")); 1314 RunHtmlTest(FILE_PATH_LITERAL("wbr.html"));
1292 } 1315 }
1293 1316
1294 } // namespace content 1317 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698