| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 RenderWidgetHostViewPort* host_view = static_cast<RenderWidgetHostViewPort*>( | 108 RenderWidgetHostViewPort* host_view = static_cast<RenderWidgetHostViewPort*>( |
| 109 shell()->web_contents()->GetRenderWidgetHostView()); | 109 shell()->web_contents()->GetRenderWidgetHostView()); |
| 110 RenderWidgetHostImpl* host = | 110 RenderWidgetHostImpl* host = |
| 111 RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost()); | 111 RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost()); |
| 112 RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host); | 112 RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host); |
| 113 view_host->set_save_accessibility_tree_for_testing(true); | 113 view_host->set_save_accessibility_tree_for_testing(true); |
| 114 view_host->SetAccessibilityMode(AccessibilityModeComplete); | 114 view_host->SetAccessibilityMode(AccessibilityModeComplete); |
| 115 | 115 |
| 116 // Setup test paths. | 116 // Setup test paths. |
| 117 FilePath dir_test_data; | 117 FilePath dir_test_data; |
| 118 EXPECT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); | 118 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); |
| 119 FilePath test_path(dir_test_data.Append(FILE_PATH_LITERAL("accessibility"))); | 119 FilePath test_path(dir_test_data.Append(FILE_PATH_LITERAL("accessibility"))); |
| 120 EXPECT_TRUE(file_util::PathExists(test_path)) | 120 ASSERT_TRUE(file_util::PathExists(test_path)) |
| 121 << test_path.LossyDisplayName(); | 121 << test_path.LossyDisplayName(); |
| 122 | 122 |
| 123 FilePath html_file = test_path.Append(FilePath(file_path)); | 123 FilePath html_file = test_path.Append(FilePath(file_path)); |
| 124 // Output the test path to help anyone who encounters a failure and needs | 124 // Output the test path to help anyone who encounters a failure and needs |
| 125 // to know where to look. | 125 // to know where to look. |
| 126 printf("Testing: %s\n", html_file.MaybeAsASCII().c_str()); | 126 printf("Testing: %s\n", html_file.MaybeAsASCII().c_str()); |
| 127 | 127 |
| 128 std::string html_contents; | 128 std::string html_contents; |
| 129 file_util::ReadFileToString(html_file, &html_contents); | 129 file_util::ReadFileToString(html_file, &html_contents); |
| 130 | 130 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 ADD_FAILURE() << "No expectation found. Create it by doing:\n" | 216 ADD_FAILURE() << "No expectation found. Create it by doing:\n" |
| 217 << "mv " << actual_file.LossyDisplayName() << " " | 217 << "mv " << actual_file.LossyDisplayName() << " " |
| 218 << expected_file.LossyDisplayName(); | 218 << expected_file.LossyDisplayName(); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityA) { | 222 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityA) { |
| 223 RunTest(FILE_PATH_LITERAL("a.html")); | 223 RunTest(FILE_PATH_LITERAL("a.html")); |
| 224 } | 224 } |
| 225 | 225 |
| 226 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAddress) { |
| 227 RunTest(FILE_PATH_LITERAL("address.html")); |
| 228 } |
| 229 |
| 226 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAName) { | 230 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAName) { |
| 227 RunTest(FILE_PATH_LITERAL("a-name.html")); | 231 RunTest(FILE_PATH_LITERAL("a-name.html")); |
| 228 } | 232 } |
| 229 | 233 |
| 230 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAOnclick) { | 234 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAOnclick) { |
| 231 RunTest(FILE_PATH_LITERAL("a-onclick.html")); | 235 RunTest(FILE_PATH_LITERAL("a-onclick.html")); |
| 232 } | 236 } |
| 233 | 237 |
| 234 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, | 238 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, |
| 235 AccessibilityAriaApplication) { | 239 AccessibilityAriaApplication) { |
| 236 RunTest(FILE_PATH_LITERAL("aria-application.html")); | 240 RunTest(FILE_PATH_LITERAL("aria-application.html")); |
| 237 } | 241 } |
| 238 | 242 |
| 243 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, |
| 244 AccessibilityAriaAutocomplete) { |
| 245 RunTest(FILE_PATH_LITERAL("aria-autocomplete.html")); |
| 246 } |
| 247 |
| 239 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaCombobox) { | 248 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaCombobox) { |
| 240 RunTest(FILE_PATH_LITERAL("aria-combobox.html")); | 249 RunTest(FILE_PATH_LITERAL("aria-combobox.html")); |
| 241 } | 250 } |
| 242 | 251 |
| 252 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaInvalid) { |
| 253 RunTest(FILE_PATH_LITERAL("aria-invalid.html")); |
| 254 } |
| 255 |
| 243 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaMenu) { | 256 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaMenu) { |
| 244 RunTest(FILE_PATH_LITERAL("aria-menu.html")); | 257 RunTest(FILE_PATH_LITERAL("aria-menu.html")); |
| 245 } | 258 } |
| 246 | 259 |
| 260 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, |
| 261 AccessibilityAriaMenuitemradio) { |
| 262 RunTest(FILE_PATH_LITERAL("aria-menuitemradio.html")); |
| 263 } |
| 264 |
| 265 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, |
| 266 AccessibilityAriaProgressbar) { |
| 267 RunTest(FILE_PATH_LITERAL("aria-progressbar.html")); |
| 268 } |
| 269 |
| 270 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, |
| 271 AccessibilityAriaToolbar) { |
| 272 RunTest(FILE_PATH_LITERAL("toolbar.html")); |
| 273 } |
| 274 |
| 247 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAWithImg) { | 275 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAWithImg) { |
| 248 RunTest(FILE_PATH_LITERAL("a-with-img.html")); | 276 RunTest(FILE_PATH_LITERAL("a-with-img.html")); |
| 249 } | 277 } |
| 250 | 278 |
| 279 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityBdo) { |
| 280 RunTest(FILE_PATH_LITERAL("bdo.html")); |
| 281 } |
| 282 |
| 283 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityBR) { |
| 284 RunTest(FILE_PATH_LITERAL("br.html")); |
| 285 } |
| 286 |
| 251 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityButtonNameCalc) { | 287 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityButtonNameCalc) { |
| 252 RunTest(FILE_PATH_LITERAL("button-name-calc.html")); | 288 RunTest(FILE_PATH_LITERAL("button-name-calc.html")); |
| 253 } | 289 } |
| 254 | 290 |
| 255 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCanvas) { | 291 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCanvas) { |
| 256 RunTest(FILE_PATH_LITERAL("canvas.html")); | 292 RunTest(FILE_PATH_LITERAL("canvas.html")); |
| 257 } | 293 } |
| 258 | 294 |
| 259 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, | 295 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, |
| 260 AccessibilityCheckboxNameCalc) { | 296 AccessibilityCheckboxNameCalc) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 275 } | 311 } |
| 276 | 312 |
| 277 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityForm) { | 313 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityForm) { |
| 278 RunTest(FILE_PATH_LITERAL("form.html")); | 314 RunTest(FILE_PATH_LITERAL("form.html")); |
| 279 } | 315 } |
| 280 | 316 |
| 281 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityHR) { | 317 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityHR) { |
| 282 RunTest(FILE_PATH_LITERAL("hr.html")); | 318 RunTest(FILE_PATH_LITERAL("hr.html")); |
| 283 } | 319 } |
| 284 | 320 |
| 321 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, |
| 322 AccessibilityInputButtonInMenu) { |
| 323 RunTest(FILE_PATH_LITERAL("input-button-in-menu.html")); |
| 324 } |
| 325 |
| 326 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, |
| 327 AccessibilityInputImageButtonInMenu) { |
| 328 RunTest(FILE_PATH_LITERAL("input-image-button-in-menu.html")); |
| 329 } |
| 330 |
| 285 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityInputRange) { | 331 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityInputRange) { |
| 286 RunTest(FILE_PATH_LITERAL("input-range.html")); | 332 RunTest(FILE_PATH_LITERAL("input-range.html")); |
| 287 } | 333 } |
| 288 | 334 |
| 289 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, | 335 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, |
| 290 AccessibilityInputTextNameCalc) { | 336 AccessibilityInputTextNameCalc) { |
| 291 RunTest(FILE_PATH_LITERAL("input-text-name-calc.html")); | 337 RunTest(FILE_PATH_LITERAL("input-text-name-calc.html")); |
| 292 } | 338 } |
| 293 | 339 |
| 294 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityLabel) { | 340 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityLabel) { |
| 295 RunTest(FILE_PATH_LITERAL("label.html")); | 341 RunTest(FILE_PATH_LITERAL("label.html")); |
| 296 } | 342 } |
| 297 | 343 |
| 298 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityListMarkers) { | 344 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityListMarkers) { |
| 299 RunTest(FILE_PATH_LITERAL("list-markers.html")); | 345 RunTest(FILE_PATH_LITERAL("list-markers.html")); |
| 300 } | 346 } |
| 301 | 347 |
| 302 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityP) { | 348 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityP) { |
| 303 RunTest(FILE_PATH_LITERAL("p.html")); | 349 RunTest(FILE_PATH_LITERAL("p.html")); |
| 304 } | 350 } |
| 305 | 351 |
| 352 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilitySelect) { |
| 353 RunTest(FILE_PATH_LITERAL("select.html")); |
| 354 } |
| 355 |
| 306 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilitySpinButton) { | 356 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilitySpinButton) { |
| 307 RunTest(FILE_PATH_LITERAL("spinbutton.html")); | 357 RunTest(FILE_PATH_LITERAL("spinbutton.html")); |
| 308 } | 358 } |
| 309 | 359 |
| 310 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, | 360 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, |
| 311 AccessibilityToggleButton) { | 361 AccessibilityToggleButton) { |
| 312 RunTest(FILE_PATH_LITERAL("togglebutton.html")); | 362 RunTest(FILE_PATH_LITERAL("togglebutton.html")); |
| 313 } | 363 } |
| 314 | 364 |
| 315 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityUl) { | 365 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityUl) { |
| 316 RunTest(FILE_PATH_LITERAL("ul.html")); | 366 RunTest(FILE_PATH_LITERAL("ul.html")); |
| 317 } | 367 } |
| 318 | 368 |
| 369 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) { |
| 370 RunTest(FILE_PATH_LITERAL("wbr.html")); |
| 371 } |
| 372 |
| 319 } // namespace content | 373 } // namespace content |
| OLD | NEW |