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

Side by Side Diff: content/browser/accessibility/dump_accessibility_tree_helper.h

Issue 10662003: Allow filters in accessibility tests to specify which attributes to check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Work around missing webkit strings in content_browsertests for now Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CONTENT_BROWSER_ACCESSIBILITY_DUMP_ACCESSIBILITY_TREE_HELPER_H_ 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_DUMP_ACCESSIBILITY_TREE_HELPER_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_DUMP_ACCESSIBILITY_TREE_HELPER_H_ 6 #define CONTENT_BROWSER_ACCESSIBILITY_DUMP_ACCESSIBILITY_TREE_HELPER_H_
7 7
8 #include <set>
9
8 #include "base/file_path.h" 10 #include "base/file_path.h"
9 #include "base/string16.h" 11 #include "base/string16.h"
10 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
11 #include "content/browser/accessibility/browser_accessibility.h" 13 #include "content/browser/accessibility/browser_accessibility.h"
12 14
13 // A utility class for retrieving platform specific accessibility information. 15 // A utility class for retrieving platform specific accessibility information.
14 // This is extended by a subclass for each platform where accessibility is 16 // This is extended by a subclass for each platform where accessibility is
15 // implemented. 17 // implemented.
16 class DumpAccessibilityTreeHelper { 18 class DumpAccessibilityTreeHelper {
17 public: 19 public:
20 DumpAccessibilityTreeHelper();
21 virtual ~DumpAccessibilityTreeHelper();
22
18 // Dumps a BrowserAccessibility tree into a string. 23 // Dumps a BrowserAccessibility tree into a string.
19 void DumpAccessibilityTree(BrowserAccessibility* node, 24 void DumpAccessibilityTree(BrowserAccessibility* node,
20 string16* contents); 25 string16* contents);
21 26
27 // Set regular expression filters that apply to each component of every
28 // line before it's output.
29 void SetFilters(const std::set<string16>& allow_filters,
30 const std::set<string16>& deny_filters);
31
22 // Suffix of the expectation file corresponding to html file. 32 // Suffix of the expectation file corresponding to html file.
23 // Example: 33 // Example:
24 // HTML test: test-file.html 34 // HTML test: test-file.html
25 // Expected: test-file-expected-mac.txt. 35 // Expected: test-file-expected-mac.txt.
26 // Auto-generated: test-file-actual-mac.txt 36 // Auto-generated: test-file-actual-mac.txt
27 const FilePath::StringType GetActualFileSuffix() const; 37 const FilePath::StringType GetActualFileSuffix() const;
28 const FilePath::StringType GetExpectedFileSuffix() const; 38 const FilePath::StringType GetExpectedFileSuffix() const;
29 39
40 // A platform-specific string that indicates a given line in a file
41 // is an allow or deny filter. Example:
42 // Mac values:
43 // GetAllowString() -> "@MAC-ALLOW:"
44 // GetDenyString() -> "@MAC-DENY:"
45 // Example html:
46 // <!--
47 // @MAC-ALLOW:roleDescription*
48 // @MAC-DENY:subrole*
49 // -->
50 // <p>Text</p>
51 const std::string GetAllowString() const;
52 const std::string GetDenyString() const;
53
30 protected: 54 protected:
31 void RecursiveDumpAccessibilityTree(BrowserAccessibility* node, 55 void RecursiveDumpAccessibilityTree(BrowserAccessibility* node,
32 string16* contents, 56 string16* contents,
33 int indent); 57 int indent);
34 58
35 // Returns a platform specific representation of a BrowserAccessibility. 59 // Returns a platform specific representation of a BrowserAccessibility.
36 // Should be zero or more complete lines, each with |prefix| prepended 60 // Should be zero or more complete lines, each with |prefix| prepended
37 // (to indent each line). 61 // (to indent each line).
38 string16 ToString(BrowserAccessibility* node, char* prefix); 62 string16 ToString(BrowserAccessibility* node, char* prefix);
39 63
40 void Initialize(); 64 void Initialize();
65
66 bool MatchesFilters(const string16& text, bool default_result);
67 void StartLine();
68 void Add(bool include_by_default, const string16& attr);
69 string16 FinishLine();
70
71 std::set<string16> allow_filters_;
72 std::set<string16> deny_filters_;
73 string16 line_;
74
75 DISALLOW_COPY_AND_ASSIGN(DumpAccessibilityTreeHelper);
41 }; 76 };
42 77
43 #endif // CONTENT_BROWSER_ACCESSIBILITY_DUMP_ACCESSIBILITY_TREE_HELPER_H_ 78 #endif // CONTENT_BROWSER_ACCESSIBILITY_DUMP_ACCESSIBILITY_TREE_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698