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

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

Issue 9617019: Improve formatting of accessibility tests that dump the tree. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Linux build error, tolerate different line endings Created 8 years, 9 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 "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "content/browser/accessibility/browser_accessibility.h" 11 #include "content/browser/accessibility/browser_accessibility.h"
12 12
13 // A utility class for retrieving platform specific accessibility information. 13 // A utility class for retrieving platform specific accessibility information.
14 // This is extended by a subclass for each platform where accessibility is
15 // implemented.
14 class DumpAccessibilityTreeHelper { 16 class DumpAccessibilityTreeHelper {
15 public: 17 public:
16 // Dumps a BrowserAccessibility tree into a string. 18 // Dumps a BrowserAccessibility tree into a string.
17 void DumpAccessibilityTree(BrowserAccessibility* node, 19 void DumpAccessibilityTree(BrowserAccessibility* node,
18 string16* contents) { 20 string16* contents);
19 *contents += ToString(node) + GetLineEnding();
20 for (size_t i = 0; i < node->children().size(); ++i)
21 DumpAccessibilityTree(node->children()[i], contents);
22 }
23 21
24 // Suffix of the expectation file corresponding to html file. 22 // Suffix of the expectation file corresponding to html file.
25 // Example: 23 // Example:
26 // HTML test: test-file.html 24 // HTML test: test-file.html
27 // Expected: test-file-expected-mac.txt. 25 // Expected: test-file-expected-mac.txt.
28 // Auto-generated: test-file-actual-mac.txt 26 // Auto-generated: test-file-actual-mac.txt
29 const FilePath::StringType GetActualFileSuffix() const; 27 const FilePath::StringType GetActualFileSuffix() const;
30 const FilePath::StringType GetExpectedFileSuffix() const; 28 const FilePath::StringType GetExpectedFileSuffix() const;
31 29
32 // Line ending to use in our dump. 30 protected:
33 const string16 GetLineEnding() const; 31 void RecursiveDumpAccessibilityTree(BrowserAccessibility* node,
32 string16* contents,
33 int indent);
34 34
35 protected:
36 // Returns a platform specific representation of a BrowserAccessibility. 35 // Returns a platform specific representation of a BrowserAccessibility.
37 string16 ToString(BrowserAccessibility* node); 36 // Should be zero or more complete lines, each with |prefix| prepended
37 // (to indent each line).
38 string16 ToString(BrowserAccessibility* node, char* prefix);
38 39
39 void Initialize(); 40 void Initialize();
40 }; 41 };
41 42
42 #endif // CONTENT_BROWSER_ACCESSIBILITY_DUMP_ACCESSIBILITY_TREE_HELPER_H_ 43 #endif // CONTENT_BROWSER_ACCESSIBILITY_DUMP_ACCESSIBILITY_TREE_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698