| Index: content/browser/accessibility/dump_accessibility_tree_browsertest.cc
|
| diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
|
| index 84dce0aae2cc7e8edc72e44444ac797c186ec3fd..dcd0623ec58dccf0d7692dab9452a93bf932614c 100644
|
| --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
|
| +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
|
| @@ -13,14 +13,15 @@
|
| #include "base/string16.h"
|
| #include "base/strings/string_split.h"
|
| #include "base/utf_string_conversions.h"
|
| +#include "content/browser/accessibility/accessibility_tree_formatter_impl.h"
|
| #include "content/browser/accessibility/browser_accessibility.h"
|
| #include "content/browser/accessibility/browser_accessibility_manager.h"
|
| -#include "content/browser/accessibility/dump_accessibility_tree_helper.h"
|
| #include "content/browser/renderer_host/render_view_host_impl.h"
|
| #include "content/port/browser/render_widget_host_view_port.h"
|
| #include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/notification_types.h"
|
| #include "content/public/browser/web_contents.h"
|
| +#include "content/public/common/accessibility_mode.h"
|
| #include "content/public/common/content_paths.h"
|
| #include "content/public/test/test_utils.h"
|
| #include "content/shell/shell.h"
|
| @@ -37,7 +38,7 @@ namespace {
|
|
|
| namespace content {
|
|
|
| -typedef DumpAccessibilityTreeHelper::Filter Filter;
|
| +typedef AccessibilityTreeFormatterImpl::Filter Filter;
|
|
|
| // This test takes a snapshot of the platform BrowserAccessibility tree and
|
| // tests it against an expected baseline.
|
| @@ -91,9 +92,12 @@ class DumpAccessibilityTreeTest : public ContentBrowserTest {
|
| iter != lines.end();
|
| ++iter) {
|
| const std::string& line = *iter;
|
| - const std::string& allow_empty_str = helper_.GetAllowEmptyString();
|
| - const std::string& allow_str = helper_.GetAllowString();
|
| - const std::string& deny_str = helper_.GetDenyString();
|
| + const std::string& allow_empty_str =
|
| + AccessibilityTreeFormatterImpl::GetAllowEmptyString();
|
| + const std::string& allow_str =
|
| + AccessibilityTreeFormatterImpl::GetAllowString();
|
| + const std::string& deny_str =
|
| + AccessibilityTreeFormatterImpl::GetDenyString();
|
| if (StartsWithASCII(line, allow_empty_str, true)) {
|
| filters->push_back(
|
| Filter(UTF8ToUTF16(line.substr(allow_empty_str.size())),
|
| @@ -109,8 +113,6 @@ class DumpAccessibilityTreeTest : public ContentBrowserTest {
|
| }
|
|
|
| void RunTest(const base::FilePath::CharType* file_path);
|
| -
|
| - DumpAccessibilityTreeHelper helper_;
|
| };
|
|
|
| void DumpAccessibilityTreeTest::RunTest(
|
| @@ -140,17 +142,11 @@ void DumpAccessibilityTreeTest::RunTest(
|
| std::string html_contents;
|
| file_util::ReadFileToString(html_file, &html_contents);
|
|
|
| - // Parse filters in the test file.
|
| - std::vector<Filter> filters;
|
| - AddDefaultFilters(&filters);
|
| - ParseFilters(html_contents, &filters);
|
| - helper_.SetFilters(filters);
|
| -
|
| // Read the expected file.
|
| std::string expected_contents_raw;
|
| base::FilePath expected_file =
|
| base::FilePath(html_file.RemoveExtension().value() +
|
| - helper_.GetExpectedFileSuffix());
|
| + AccessibilityTreeFormatterImpl::GetExpectedFileSuffix());
|
| file_util::ReadFileToString(
|
| expected_file,
|
| &expected_contents_raw);
|
| @@ -177,12 +173,18 @@ void DumpAccessibilityTreeTest::RunTest(
|
|
|
| // Wait for the tree.
|
| tree_updated_observer.Wait();
|
| + AccessibilityTreeFormatterImpl formatter(
|
| + host_view->GetBrowserAccessibilityManager()->GetRoot());
|
| +
|
| + // Parse filters in the test file.
|
| + std::vector<Filter> filters;
|
| + AddDefaultFilters(&filters);
|
| + ParseFilters(html_contents, &filters);
|
| + formatter.SetFilters(filters);
|
|
|
| // Perform a diff (or write the initial baseline).
|
| string16 actual_contents_utf16;
|
| - helper_.DumpAccessibilityTree(
|
| - host_view->GetBrowserAccessibilityManager()->GetRoot(),
|
| - &actual_contents_utf16);
|
| + formatter.FormatAccessibilityTree(&actual_contents_utf16);
|
| std::string actual_contents = UTF16ToUTF8(actual_contents_utf16);
|
| std::vector<std::string> actual_lines, expected_lines;
|
| Tokenize(actual_contents, "\n", &actual_lines);
|
| @@ -219,7 +221,7 @@ void DumpAccessibilityTreeTest::RunTest(
|
| if (!file_util::PathExists(expected_file)) {
|
| base::FilePath actual_file =
|
| base::FilePath(html_file.RemoveExtension().value() +
|
| - helper_.GetActualFileSuffix());
|
| + AccessibilityTreeFormatterImpl::GetActualFileSuffix());
|
|
|
| EXPECT_TRUE(file_util::WriteFile(
|
| actual_file, actual_contents.c_str(), actual_contents.size()));
|
|
|