Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: content/browser/accessibility/dump_accessibility_tree_browsertest.cc

Issue 12389028: Rename DumpAccesibilityTreeHelper to AccessibilityTreeFormatter, pull into content/browser. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rename accessibility_test_utils_win -> accessibility_tree_formatter_utils_win and move into content… Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..0dddd267eee4aa7f06c0e6d98582308610511c36 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"
dmazzoni 2013/02/28 18:59:12 This doesn't exist anymore, right?
aboxhall 2013/02/28 22:12:59 Done.
#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 AccessibilityTreeFormatter::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 =
+ AccessibilityTreeFormatter::GetAllowEmptyString();
+ const std::string& allow_str =
+ AccessibilityTreeFormatter::GetAllowString();
+ const std::string& deny_str =
+ AccessibilityTreeFormatter::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(
@@ -122,7 +124,7 @@ void DumpAccessibilityTreeTest::RunTest(
RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost());
RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host);
view_host->set_save_accessibility_tree_for_testing(true);
- view_host->SetAccessibilityMode(AccessibilityModeComplete);
+ view_host->SetAccessibilityMode(ACCESSIBILITY_MODE_COMPLETE);
// Setup test paths.
base::FilePath dir_test_data;
@@ -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());
+ AccessibilityTreeFormatter::GetExpectedFileSuffix());
file_util::ReadFileToString(
expected_file,
&expected_contents_raw);
@@ -177,12 +173,18 @@ void DumpAccessibilityTreeTest::RunTest(
// Wait for the tree.
tree_updated_observer.Wait();
+ AccessibilityTreeFormatter 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());
+ AccessibilityTreeFormatter::GetActualFileSuffix());
EXPECT_TRUE(file_util::WriteFile(
actual_file, actual_contents.c_str(), actual_contents.size()));

Powered by Google App Engine
This is Rietveld 408576698