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" | |
20 #include "third_party/iaccessible2/ia2_api_all.h" | 19 #include "third_party/iaccessible2/ia2_api_all.h" |
21 #include "ui/base/win/atl_module.h" | 20 #include "ui/base/win/atl_module.h" |
22 | 21 |
23 namespace content { | 22 namespace content { |
24 | 23 |
25 void DumpAccessibilityTreeHelper::Initialize() { | 24 void AccessibilityTreeFormatter::Initialize() { |
26 ui::win::CreateATLModuleIfNeeded(); | 25 ui::win::CreateATLModuleIfNeeded(); |
27 } | 26 } |
28 | 27 |
29 string16 DumpAccessibilityTreeHelper::ToString( | 28 string16 AccessibilityTreeFormatter::ToString( |
30 BrowserAccessibility* node, char* prefix) { | 29 BrowserAccessibility* node, char* prefix) { |
31 BrowserAccessibilityWin* acc_obj = node->ToBrowserAccessibilityWin(); | 30 BrowserAccessibilityWin* acc_obj = node->ToBrowserAccessibilityWin(); |
32 | 31 |
33 // Get the computed name. | 32 // Get the computed name. |
34 VARIANT variant_self; | 33 VARIANT variant_self; |
35 variant_self.vt = VT_I4; | 34 variant_self.vt = VT_I4; |
36 variant_self.lVal = CHILDID_SELF; | 35 variant_self.lVal = CHILDID_SELF; |
37 CComBSTR msaa_variant; | 36 CComBSTR msaa_variant; |
38 HRESULT hresult = acc_obj->get_accName(variant_self, &msaa_variant); | 37 HRESULT hresult = acc_obj->get_accName(variant_self, &msaa_variant); |
39 string16 name; | 38 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) { | 152 if (acc_obj->get_selection(0, &start, &end) == S_OK) { |
154 Add(false, StringPrintf(L"selection_start=%d", start)); | 153 Add(false, StringPrintf(L"selection_start=%d", start)); |
155 Add(false, StringPrintf(L"selection_end=%d", end)); | 154 Add(false, StringPrintf(L"selection_end=%d", end)); |
156 } | 155 } |
157 } | 156 } |
158 } | 157 } |
159 | 158 |
160 return UTF8ToUTF16(prefix) + FinishLine() + ASCIIToUTF16("\n"); | 159 return UTF8ToUTF16(prefix) + FinishLine() + ASCIIToUTF16("\n"); |
161 } | 160 } |
162 | 161 |
| 162 // static |
163 const base::FilePath::StringType | 163 const base::FilePath::StringType |
164 DumpAccessibilityTreeHelper::GetActualFileSuffix() const { | 164 AccessibilityTreeFormatter::GetActualFileSuffix() { |
165 return FILE_PATH_LITERAL("-actual-win.txt"); | 165 return FILE_PATH_LITERAL("-actual-win.txt"); |
166 } | 166 } |
167 | 167 |
| 168 // static |
168 const base::FilePath::StringType | 169 const base::FilePath::StringType |
169 DumpAccessibilityTreeHelper::GetExpectedFileSuffix() const { | 170 AccessibilityTreeFormatter::GetExpectedFileSuffix() { |
170 return FILE_PATH_LITERAL("-expected-win.txt"); | 171 return FILE_PATH_LITERAL("-expected-win.txt"); |
171 } | 172 } |
172 | 173 |
173 const std::string DumpAccessibilityTreeHelper::GetAllowEmptyString() const { | 174 // static |
| 175 const std::string AccessibilityTreeFormatter::GetAllowEmptyString() { |
174 return "@WIN-ALLOW-EMPTY:"; | 176 return "@WIN-ALLOW-EMPTY:"; |
175 } | 177 } |
176 | 178 |
177 const std::string DumpAccessibilityTreeHelper::GetAllowString() const { | 179 // static |
| 180 const std::string AccessibilityTreeFormatter::GetAllowString() { |
178 return "@WIN-ALLOW:"; | 181 return "@WIN-ALLOW:"; |
179 } | 182 } |
180 | 183 |
181 const std::string DumpAccessibilityTreeHelper::GetDenyString() const { | 184 // static |
| 185 const std::string AccessibilityTreeFormatter::GetDenyString() { |
182 return "@WIN-DENY:"; | 186 return "@WIN-DENY:"; |
183 } | 187 } |
184 | 188 |
185 } // namespace content | 189 } // namespace content |
OLD | NEW |