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/accessibility_tree_formatter.h" |
6 | 6 |
7 #include <oleacc.h> | 7 #include <oleacc.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "content/browser/accessibility/accessibility_tree_formatter_utils_win.h
" |
15 #include "content/browser/accessibility/browser_accessibility_manager.h" | 16 #include "content/browser/accessibility/browser_accessibility_manager.h" |
16 #include "content/browser/accessibility/browser_accessibility_win.h" | 17 #include "content/browser/accessibility/browser_accessibility_win.h" |
17 #include "content/common/accessibility_node_data.h" | 18 #include "content/common/accessibility_node_data.h" |
18 #include "content/public/test/accessibility_test_utils_win.h" | |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "third_party/iaccessible2/ia2_api_all.h" | 20 #include "third_party/iaccessible2/ia2_api_all.h" |
21 #include "ui/base/win/atl_module.h" | 21 #include "ui/base/win/atl_module.h" |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 void DumpAccessibilityTreeHelper::Initialize() { | 25 void AccessibilityTreeFormatter::Initialize() { |
26 ui::win::CreateATLModuleIfNeeded(); | 26 ui::win::CreateATLModuleIfNeeded(); |
27 } | 27 } |
28 | 28 |
29 string16 DumpAccessibilityTreeHelper::ToString( | 29 string16 AccessibilityTreeFormatter::ToString( |
30 BrowserAccessibility* node, char* prefix) { | 30 BrowserAccessibility* node, char* prefix) { |
31 BrowserAccessibilityWin* acc_obj = node->ToBrowserAccessibilityWin(); | 31 BrowserAccessibilityWin* acc_obj = node->ToBrowserAccessibilityWin(); |
32 | 32 |
33 // Get the computed name. | 33 // Get the computed name. |
34 VARIANT variant_self; | 34 VARIANT variant_self; |
35 variant_self.vt = VT_I4; | 35 variant_self.vt = VT_I4; |
36 variant_self.lVal = CHILDID_SELF; | 36 variant_self.lVal = CHILDID_SELF; |
37 CComBSTR msaa_variant; | 37 CComBSTR msaa_variant; |
38 HRESULT hresult = acc_obj->get_accName(variant_self, &msaa_variant); | 38 HRESULT hresult = acc_obj->get_accName(variant_self, &msaa_variant); |
39 string16 name; | 39 string16 name; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 if (acc_obj->get_selection(0, &start, &end) == S_OK) { | 153 if (acc_obj->get_selection(0, &start, &end) == S_OK) { |
154 Add(false, StringPrintf(L"selection_start=%d", start)); | 154 Add(false, StringPrintf(L"selection_start=%d", start)); |
155 Add(false, StringPrintf(L"selection_end=%d", end)); | 155 Add(false, StringPrintf(L"selection_end=%d", end)); |
156 } | 156 } |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 return UTF8ToUTF16(prefix) + FinishLine() + ASCIIToUTF16("\n"); | 160 return UTF8ToUTF16(prefix) + FinishLine() + ASCIIToUTF16("\n"); |
161 } | 161 } |
162 | 162 |
| 163 // static |
163 const base::FilePath::StringType | 164 const base::FilePath::StringType |
164 DumpAccessibilityTreeHelper::GetActualFileSuffix() const { | 165 AccessibilityTreeFormatter::GetActualFileSuffix() { |
165 return FILE_PATH_LITERAL("-actual-win.txt"); | 166 return FILE_PATH_LITERAL("-actual-win.txt"); |
166 } | 167 } |
167 | 168 |
| 169 // static |
168 const base::FilePath::StringType | 170 const base::FilePath::StringType |
169 DumpAccessibilityTreeHelper::GetExpectedFileSuffix() const { | 171 AccessibilityTreeFormatter::GetExpectedFileSuffix() { |
170 return FILE_PATH_LITERAL("-expected-win.txt"); | 172 return FILE_PATH_LITERAL("-expected-win.txt"); |
171 } | 173 } |
172 | 174 |
173 const std::string DumpAccessibilityTreeHelper::GetAllowEmptyString() const { | 175 // static |
| 176 const std::string AccessibilityTreeFormatter::GetAllowEmptyString() { |
174 return "@WIN-ALLOW-EMPTY:"; | 177 return "@WIN-ALLOW-EMPTY:"; |
175 } | 178 } |
176 | 179 |
177 const std::string DumpAccessibilityTreeHelper::GetAllowString() const { | 180 // static |
| 181 const std::string AccessibilityTreeFormatter::GetAllowString() { |
178 return "@WIN-ALLOW:"; | 182 return "@WIN-ALLOW:"; |
179 } | 183 } |
180 | 184 |
181 const std::string DumpAccessibilityTreeHelper::GetDenyString() const { | 185 // static |
| 186 const std::string AccessibilityTreeFormatter::GetDenyString() { |
182 return "@WIN-DENY:"; | 187 return "@WIN-DENY:"; |
183 } | 188 } |
184 | 189 |
185 } // namespace content | 190 } // namespace content |
OLD | NEW |