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

Unified Diff: content/browser/accessibility/accessibility_tree_formatter.h

Issue 790943002: Add DumpAccessibilityEvents test framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dump_acc_events_1
Patch Set: Fix compile errors Created 6 years 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/accessibility_tree_formatter.h
diff --git a/content/browser/accessibility/accessibility_tree_formatter.h b/content/browser/accessibility/accessibility_tree_formatter.h
index 39c6a4aa283c5473bad3c24ccbcfeb2a8346a49c..8db914a9fa5433b24957ce55b8934d56819dfdbb 100644
--- a/content/browser/accessibility/accessibility_tree_formatter.h
+++ b/content/browser/accessibility/accessibility_tree_formatter.h
@@ -27,8 +27,28 @@ class CONTENT_EXPORT AccessibilityTreeFormatter {
explicit AccessibilityTreeFormatter(BrowserAccessibility* root);
virtual ~AccessibilityTreeFormatter();
+ // A single filter specification. See GetAllowString() and GetDenyString()
+ // for more information.
+ struct Filter {
+ enum Type {
+ ALLOW,
+ ALLOW_EMPTY,
+ DENY
+ };
+ base::string16 match_str;
+ Type type;
+
+ Filter(base::string16 match_str, Type type)
+ : match_str(match_str), type(type) {}
+ };
+
static AccessibilityTreeFormatter* Create(WebContents* wc);
+ static bool MatchesFilters(
+ const std::vector<Filter>& filters,
+ const base::string16& text,
+ bool default_result);
+
// Populates the given DictionaryValue with the accessibility tree.
// The dictionary contains a key/value pair for each attribute of the node,
// plus a "children" attribute containing a list of all child nodes.
@@ -54,25 +74,14 @@ class CONTENT_EXPORT AccessibilityTreeFormatter {
// Dumps a BrowserAccessibility tree into a string.
void FormatAccessibilityTree(base::string16* contents);
- // A single filter specification. See GetAllowString() and GetDenyString()
- // for more information.
- struct Filter {
- enum Type {
- ALLOW,
- ALLOW_EMPTY,
- DENY
- };
- base::string16 match_str;
- Type type;
-
- Filter(base::string16 match_str, Type type)
- : match_str(match_str), type(type) {}
- };
-
// Set regular expression filters that apply to each component of every
// line before it's output.
void SetFilters(const std::vector<Filter>& filters);
+ // If true, the internal accessibility id of each node will be included
+ // in its output.
+ void set_show_ids(bool show_ids) { show_ids_ = show_ids; }
+
// Suffix of the expectation file corresponding to html file.
// Example:
// HTML test: test-file.html
@@ -119,10 +128,7 @@ class CONTENT_EXPORT AccessibilityTreeFormatter {
const base::DictionaryValue& value);
// Returns a platform specific representation of a BrowserAccessibility.
- // Should be zero or more complete lines, each with |prefix| prepended
- // (to indent each line).
- base::string16 ToString(const base::DictionaryValue& node,
- const base::string16& indent);
+ base::string16 ToString(const base::DictionaryValue& node);
void Initialize();
@@ -141,6 +147,9 @@ class CONTENT_EXPORT AccessibilityTreeFormatter {
// Filters used when formatting the accessibility tree as text.
std::vector<Filter> filters_;
+ // Whether or not node ids should be included in the dump.
+ bool show_ids_;
+
DISALLOW_COPY_AND_ASSIGN(AccessibilityTreeFormatter);
};

Powered by Google App Engine
This is Rietveld 408576698