OLD | NEW |
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 #include "content/browser/accessibility/dump_accessibility_tree_helper.h" | 5 #include "content/browser/accessibility/dump_accessibility_tree_helper.h" |
6 | 6 |
7 #include <oleacc.h> | 7 #include <oleacc.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 STATE_MAP(IA2_STATE_OPAQUE) | 148 STATE_MAP(IA2_STATE_OPAQUE) |
149 STATE_MAP(IA2_STATE_REQUIRED) | 149 STATE_MAP(IA2_STATE_REQUIRED) |
150 STATE_MAP(IA2_STATE_SELECTABLE_TEXT) | 150 STATE_MAP(IA2_STATE_SELECTABLE_TEXT) |
151 STATE_MAP(IA2_STATE_SINGLE_LINE) | 151 STATE_MAP(IA2_STATE_SINGLE_LINE) |
152 STATE_MAP(IA2_STATE_STALE) | 152 STATE_MAP(IA2_STATE_STALE) |
153 STATE_MAP(IA2_STATE_SUPPORTS_AUTOCOMPLETION) | 153 STATE_MAP(IA2_STATE_SUPPORTS_AUTOCOMPLETION) |
154 STATE_MAP(IA2_STATE_TRANSIENT) | 154 STATE_MAP(IA2_STATE_TRANSIENT) |
155 // STATE_MAP(IA2_STATE_VERTICAL) // Untested. | 155 // STATE_MAP(IA2_STATE_VERTICAL) // Untested. |
156 } | 156 } |
157 | 157 |
158 string16 DumpAccessibilityTreeHelper::ToString(BrowserAccessibility* node) { | 158 string16 DumpAccessibilityTreeHelper::ToString( |
| 159 BrowserAccessibility* node, char* prefix) { |
159 if (role_string_map.empty()) | 160 if (role_string_map.empty()) |
160 Initialize(); | 161 Initialize(); |
161 | 162 |
162 BrowserAccessibilityWin* acc_obj = node->toBrowserAccessibilityWin(); | 163 BrowserAccessibilityWin* acc_obj = node->toBrowserAccessibilityWin(); |
163 string16 state; | 164 string16 state; |
164 std::map<int32, string16>::iterator it; | 165 std::map<int32, string16>::iterator it; |
165 | 166 |
166 for (it = state_string_map.begin(); it != state_string_map.end(); ++it) { | 167 for (it = state_string_map.begin(); it != state_string_map.end(); ++it) { |
167 if (it->first & acc_obj->ia2_state()) | 168 if (it->first & acc_obj->ia2_state()) { |
168 state += it->second + L"|"; | 169 if (!state.empty()) |
| 170 state += L","; |
| 171 state += it->second; |
| 172 } |
169 } | 173 } |
170 return acc_obj->name() + L"|" + role_string_map[acc_obj->ia2_role()] + L"|" + | 174 return UTF8ToUTF16(prefix) + |
171 state; | 175 role_string_map[acc_obj->ia2_role()] + |
| 176 L" name='" + acc_obj->name() + |
| 177 L"' state=" + state + L"\n"; |
172 } | 178 } |
173 | 179 |
174 const FilePath::StringType DumpAccessibilityTreeHelper::GetActualFileSuffix() | 180 const FilePath::StringType DumpAccessibilityTreeHelper::GetActualFileSuffix() |
175 const { | 181 const { |
176 return FILE_PATH_LITERAL("-actual-win.txt"); | 182 return FILE_PATH_LITERAL("-actual-win.txt"); |
177 } | 183 } |
178 | 184 |
179 const FilePath::StringType DumpAccessibilityTreeHelper::GetExpectedFileSuffix() | 185 const FilePath::StringType DumpAccessibilityTreeHelper::GetExpectedFileSuffix() |
180 const { | 186 const { |
181 return FILE_PATH_LITERAL("-expected-win.txt"); | 187 return FILE_PATH_LITERAL("-expected-win.txt"); |
182 } | 188 } |
183 | |
184 const string16 DumpAccessibilityTreeHelper::GetLineEnding() const { | |
185 return L"\r\n"; | |
186 } | |
OLD | NEW |