OLD | NEW |
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/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // normalize by deleting all \r from the file (if any) to leave only \n. | 162 // normalize by deleting all \r from the file (if any) to leave only \n. |
163 std::string expected_contents; | 163 std::string expected_contents; |
164 RemoveChars(expected_contents_raw, "\r", &expected_contents); | 164 RemoveChars(expected_contents_raw, "\r", &expected_contents); |
165 | 165 |
166 if (!expected_contents.compare(0, strlen(kMarkSkipFile), kMarkSkipFile)) { | 166 if (!expected_contents.compare(0, strlen(kMarkSkipFile), kMarkSkipFile)) { |
167 printf("Skipping this test on this platform.\n"); | 167 printf("Skipping this test on this platform.\n"); |
168 return; | 168 return; |
169 } | 169 } |
170 | 170 |
171 // Load the page. | 171 // Load the page. |
172 string16 html_contents16; | 172 base::string16 html_contents16; |
173 html_contents16 = UTF8ToUTF16(html_contents); | 173 html_contents16 = UTF8ToUTF16(html_contents); |
174 GURL url = GetTestUrl("accessibility", | 174 GURL url = GetTestUrl("accessibility", |
175 html_file.BaseName().MaybeAsASCII().c_str()); | 175 html_file.BaseName().MaybeAsASCII().c_str()); |
176 AccessibilityNotificationWaiter waiter( | 176 AccessibilityNotificationWaiter waiter( |
177 shell(), AccessibilityModeComplete, | 177 shell(), AccessibilityModeComplete, |
178 blink::WebAXEventLoadComplete); | 178 blink::WebAXEventLoadComplete); |
179 NavigateToURL(shell(), url); | 179 NavigateToURL(shell(), url); |
180 waiter.WaitForNotification(); | 180 waiter.WaitForNotification(); |
181 | 181 |
182 RenderWidgetHostViewPort* host_view = RenderWidgetHostViewPort::FromRWHV( | 182 RenderWidgetHostViewPort* host_view = RenderWidgetHostViewPort::FromRWHV( |
183 shell()->web_contents()->GetRenderWidgetHostView()); | 183 shell()->web_contents()->GetRenderWidgetHostView()); |
184 AccessibilityTreeFormatter formatter( | 184 AccessibilityTreeFormatter formatter( |
185 host_view->GetBrowserAccessibilityManager()->GetRoot()); | 185 host_view->GetBrowserAccessibilityManager()->GetRoot()); |
186 | 186 |
187 // Parse filters in the test file. | 187 // Parse filters in the test file. |
188 std::vector<Filter> filters; | 188 std::vector<Filter> filters; |
189 AddDefaultFilters(&filters); | 189 AddDefaultFilters(&filters); |
190 ParseFilters(html_contents, &filters); | 190 ParseFilters(html_contents, &filters); |
191 formatter.SetFilters(filters); | 191 formatter.SetFilters(filters); |
192 | 192 |
193 // Perform a diff (or write the initial baseline). | 193 // Perform a diff (or write the initial baseline). |
194 string16 actual_contents_utf16; | 194 base::string16 actual_contents_utf16; |
195 formatter.FormatAccessibilityTree(&actual_contents_utf16); | 195 formatter.FormatAccessibilityTree(&actual_contents_utf16); |
196 std::string actual_contents = UTF16ToUTF8(actual_contents_utf16); | 196 std::string actual_contents = UTF16ToUTF8(actual_contents_utf16); |
197 std::vector<std::string> actual_lines, expected_lines; | 197 std::vector<std::string> actual_lines, expected_lines; |
198 Tokenize(actual_contents, "\n", &actual_lines); | 198 Tokenize(actual_contents, "\n", &actual_lines); |
199 Tokenize(expected_contents, "\n", &expected_lines); | 199 Tokenize(expected_contents, "\n", &expected_lines); |
200 // Marking the end of the file with a line of text ensures that | 200 // Marking the end of the file with a line of text ensures that |
201 // file length differences are found. | 201 // file length differences are found. |
202 expected_lines.push_back(kMarkEndOfFile); | 202 expected_lines.push_back(kMarkEndOfFile); |
203 actual_lines.push_back(kMarkEndOfFile); | 203 actual_lines.push_back(kMarkEndOfFile); |
204 | 204 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 | 485 |
486 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityUl) { | 486 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityUl) { |
487 RunTest(FILE_PATH_LITERAL("ul.html")); | 487 RunTest(FILE_PATH_LITERAL("ul.html")); |
488 } | 488 } |
489 | 489 |
490 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) { | 490 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) { |
491 RunTest(FILE_PATH_LITERAL("wbr.html")); | 491 RunTest(FILE_PATH_LITERAL("wbr.html")); |
492 } | 492 } |
493 | 493 |
494 } // namespace content | 494 } // namespace content |
OLD | NEW |