| 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/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" | |
| 16 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
| 17 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 18 #include "content/browser/accessibility/accessibility_tree_formatter.h" | 17 #include "content/browser/accessibility/accessibility_tree_formatter.h" |
| 19 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" | 18 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" |
| 20 #include "content/browser/accessibility/browser_accessibility.h" | 19 #include "content/browser/accessibility/browser_accessibility.h" |
| 21 #include "content/browser/accessibility/browser_accessibility_manager.h" | 20 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 22 #include "content/browser/accessibility/dump_accessibility_browsertest_base.h" | 21 #include "content/browser/accessibility/dump_accessibility_browsertest_base.h" |
| 23 #include "content/browser/web_contents/web_contents_impl.h" | 22 #include "content/browser/web_contents/web_contents_impl.h" |
| 24 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 25 #include "content/public/common/content_features.h" | 24 #include "content/public/common/content_features.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // After denying empty values, because we want to allow name='' | 64 // After denying empty values, because we want to allow name='' |
| 66 filters->push_back( | 65 filters->push_back( |
| 67 Filter(base::ASCIIToUTF16("name=*"), Filter::ALLOW_EMPTY)); | 66 Filter(base::ASCIIToUTF16("name=*"), Filter::ALLOW_EMPTY)); |
| 68 } | 67 } |
| 69 | 68 |
| 70 void SetUpCommandLine(base::CommandLine* command_line) override { | 69 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 71 DumpAccessibilityTestBase::SetUpCommandLine(command_line); | 70 DumpAccessibilityTestBase::SetUpCommandLine(command_line); |
| 72 // Enable <dialog>, which is used in some tests. | 71 // Enable <dialog>, which is used in some tests. |
| 73 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 72 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 74 switches::kEnableExperimentalWebPlatformFeatures); | 73 switches::kEnableExperimentalWebPlatformFeatures); |
| 74 // Enable accessibility object model, used in other tests. |
| 75 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 76 switches::kEnableBlinkFeatures, "AccessibilityObjectModel"); |
| 75 } | 77 } |
| 76 | 78 |
| 77 void RunAriaTest(const base::FilePath::CharType* file_path) { | 79 void RunAriaTest(const base::FilePath::CharType* file_path) { |
| 78 base::FilePath test_path = GetTestFilePath("accessibility", "aria"); | 80 base::FilePath test_path = GetTestFilePath("accessibility", "aria"); |
| 79 { | 81 { |
| 80 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_setup; | 82 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_setup; |
| 81 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); | 83 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); |
| 82 } | 84 } |
| 83 base::FilePath aria_file = test_path.Append(base::FilePath(file_path)); | 85 base::FilePath aria_file = test_path.Append(base::FilePath(file_path)); |
| 84 | 86 |
| 85 RunTest(aria_file, "accessibility/aria"); | 87 RunTest(aria_file, "accessibility/aria"); |
| 86 } | 88 } |
| 87 | 89 |
| 88 void RunAomTest(const base::FilePath::CharType* file_path) { | 90 void RunAomTest(const base::FilePath::CharType* file_path) { |
| 89 scoped_feature_list_.InitAndEnableFeature( | |
| 90 features::kAccessibilityObjectModel); | |
| 91 | |
| 92 base::FilePath test_path = GetTestFilePath("accessibility", "aom"); | 91 base::FilePath test_path = GetTestFilePath("accessibility", "aom"); |
| 93 { | 92 { |
| 94 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_setup; | 93 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_setup; |
| 95 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); | 94 ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); |
| 96 } | 95 } |
| 97 base::FilePath aom_file = test_path.Append(base::FilePath(file_path)); | 96 base::FilePath aom_file = test_path.Append(base::FilePath(file_path)); |
| 98 | 97 |
| 99 RunTest(aom_file, "accessibility/aom"); | 98 RunTest(aom_file, "accessibility/aom"); |
| 100 } | 99 } |
| 101 | 100 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 129 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( | 128 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( |
| 130 shell()->web_contents()); | 129 shell()->web_contents()); |
| 131 formatter->FormatAccessibilityTree( | 130 formatter->FormatAccessibilityTree( |
| 132 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(), | 131 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(), |
| 133 &actual_contents_utf16); | 132 &actual_contents_utf16); |
| 134 std::string actual_contents = base::UTF16ToUTF8(actual_contents_utf16); | 133 std::string actual_contents = base::UTF16ToUTF8(actual_contents_utf16); |
| 135 return base::SplitString( | 134 return base::SplitString( |
| 136 actual_contents, "\n", | 135 actual_contents, "\n", |
| 137 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 136 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
| 138 } | 137 } |
| 139 | |
| 140 protected: | |
| 141 base::test::ScopedFeatureList scoped_feature_list_; | |
| 142 }; | 138 }; |
| 143 | 139 |
| 144 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSColor) { | 140 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSColor) { |
| 145 RunCSSTest(FILE_PATH_LITERAL("color.html")); | 141 RunCSSTest(FILE_PATH_LITERAL("color.html")); |
| 146 } | 142 } |
| 147 | 143 |
| 148 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSFontStyle) { | 144 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityCSSFontStyle) { |
| 149 RunCSSTest(FILE_PATH_LITERAL("font-style.html")); | 145 RunCSSTest(FILE_PATH_LITERAL("font-style.html")); |
| 150 } | 146 } |
| 151 | 147 |
| (...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 // crbug.com/281952 | 1491 // crbug.com/281952 |
| 1496 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, DISABLED_AccessibilityVideo) { | 1492 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, DISABLED_AccessibilityVideo) { |
| 1497 RunHtmlTest(FILE_PATH_LITERAL("video.html")); | 1493 RunHtmlTest(FILE_PATH_LITERAL("video.html")); |
| 1498 } | 1494 } |
| 1499 | 1495 |
| 1500 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) { | 1496 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityWbr) { |
| 1501 RunHtmlTest(FILE_PATH_LITERAL("wbr.html")); | 1497 RunHtmlTest(FILE_PATH_LITERAL("wbr.html")); |
| 1502 } | 1498 } |
| 1503 | 1499 |
| 1504 } // namespace content | 1500 } // namespace content |
| OLD | NEW |