Index: content/browser/accessibility/dump_accessibility_browsertest_base.cc |
diff --git a/content/browser/accessibility/dump_accessibility_browsertest_base.cc b/content/browser/accessibility/dump_accessibility_browsertest_base.cc |
index 40b52e02a2c15ff520096022b01672a9856e53c2..4123a59b29f78fa96ecac0c8e23d45f3121a1c90 100644 |
--- a/content/browser/accessibility/dump_accessibility_browsertest_base.cc |
+++ b/content/browser/accessibility/dump_accessibility_browsertest_base.cc |
@@ -119,30 +119,60 @@ void DumpAccessibilityTestBase::ParseHtmlForExtraDirectives( |
} |
} |
-void DumpAccessibilityTestBase::RunTest( |
+void DumpAccessibilityTestBase::RunAriaTest( |
const base::FilePath::CharType* file_path) { |
- NavigateToURL(shell(), GURL(url::kAboutBlankURL)); |
+ base::FilePath dir_test_data; |
+ ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); |
+ base::FilePath test_path( |
+ dir_test_data.AppendASCII("accessibility/aria")); |
+ ASSERT_TRUE(base::PathExists(test_path)) |
+ << test_path.LossyDisplayName(); |
+ |
+ base::FilePath aria_file = test_path.Append(base::FilePath(file_path)); |
+ RunTest(aria_file, "accessibility/aria"); |
+} |
+ |
+void DumpAccessibilityTestBase::RunEventTest( |
+ const base::FilePath::CharType* file_path) { |
+ base::FilePath dir_test_data; |
+ ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); |
+ base::FilePath test_path( |
+ dir_test_data.AppendASCII("accessibility/event")); |
+ ASSERT_TRUE(base::PathExists(test_path)) |
+ << test_path.LossyDisplayName(); |
+ |
+ base::FilePath event_file = test_path.Append(base::FilePath(file_path)); |
+ RunTest(event_file, "accessibility/event"); |
+} |
- // Setup test paths. |
+void DumpAccessibilityTestBase::RunHtmlTest( |
+ const base::FilePath::CharType* file_path) { |
base::FilePath dir_test_data; |
ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); |
base::FilePath test_path( |
- dir_test_data.Append(FILE_PATH_LITERAL("accessibility"))); |
+ dir_test_data.AppendASCII("accessibility/html")); |
ASSERT_TRUE(base::PathExists(test_path)) |
<< test_path.LossyDisplayName(); |
base::FilePath html_file = test_path.Append(base::FilePath(file_path)); |
+ RunTest(html_file, "accessibility/html"); |
+} |
+ |
+void DumpAccessibilityTestBase::RunTest( |
+ const base::FilePath file_path, const char* file_dir) { |
+ NavigateToURL(shell(), GURL(url::kAboutBlankURL)); |
+ |
// Output the test path to help anyone who encounters a failure and needs |
// to know where to look. |
- printf("Testing: %s\n", html_file.MaybeAsASCII().c_str()); |
+ printf("Testing: %s\n", file_path.MaybeAsASCII().c_str()); |
std::string html_contents; |
- base::ReadFileToString(html_file, &html_contents); |
+ base::ReadFileToString(file_path, &html_contents); |
// Read the expected file. |
std::string expected_contents_raw; |
base::FilePath expected_file = |
- base::FilePath(html_file.RemoveExtension().value() + |
+ base::FilePath(file_path.RemoveExtension().value() + |
AccessibilityTreeFormatter::GetExpectedFileSuffix()); |
base::ReadFileToString(expected_file, &expected_contents_raw); |
@@ -164,8 +194,7 @@ void DumpAccessibilityTestBase::RunTest( |
// Load the page. |
base::string16 html_contents16; |
html_contents16 = base::UTF8ToUTF16(html_contents); |
- GURL url = GetTestUrl("accessibility", |
- html_file.BaseName().MaybeAsASCII().c_str()); |
+ GURL url = GetTestUrl(file_dir, file_path.BaseName().MaybeAsASCII().c_str()); |
shreeramk
2014/12/19 18:18:27
file_dir is needed to get the test url using GetTe
|
// If there's a @WAIT-FOR directive, set up an accessibility notification |
// waiter that returns on any event; we'll stop when we get the text we're |
@@ -235,7 +264,7 @@ void DumpAccessibilityTestBase::RunTest( |
if (!base::PathExists(expected_file)) { |
base::FilePath actual_file = |
- base::FilePath(html_file.RemoveExtension().value() + |
+ base::FilePath(file_path.RemoveExtension().value() + |
AccessibilityTreeFormatter::GetActualFileSuffix()); |
EXPECT_TRUE(base::WriteFile( |