| Index: content/browser/accessibility/dump_accessibility_tree_helper_win.cc
|
| diff --git a/content/browser/accessibility/dump_accessibility_tree_helper_win.cc b/content/browser/accessibility/dump_accessibility_tree_helper_win.cc
|
| index 6d75527b197bbf9cbb6a5a2427059d90807465ee..6aae2becc2f19c6ba9213b50ed915bf828f10b90 100644
|
| --- a/content/browser/accessibility/dump_accessibility_tree_helper_win.cc
|
| +++ b/content/browser/accessibility/dump_accessibility_tree_helper_win.cc
|
| @@ -12,38 +12,60 @@
|
| #include "base/string_util.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "content/browser/accessibility/browser_accessibility_win.h"
|
| +#include "content/common/accessibility_node_data.h"
|
| #include "content/public/test/accessibility_test_utils_win.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "third_party/iaccessible2/ia2_api_all.h"
|
| +#include "ui/base/win/atl_module.h"
|
|
|
|
|
| +void DumpAccessibilityTreeHelper::Initialize() {
|
| + ui::win::CreateATLModuleIfNeeded();
|
| +}
|
| +
|
| string16 DumpAccessibilityTreeHelper::ToString(
|
| BrowserAccessibility* node, char* prefix) {
|
| BrowserAccessibilityWin* acc_obj = node->ToBrowserAccessibilityWin();
|
|
|
| - // Get state string.
|
| + // Get the computed name.
|
| VARIANT variant_self;
|
| variant_self.vt = VT_I4;
|
| variant_self.lVal = CHILDID_SELF;
|
| - VARIANT msaa_state_variant;
|
| - HRESULT hresult = acc_obj->get_accState(variant_self, &msaa_state_variant);
|
| - EXPECT_EQ(S_OK, hresult);
|
| - EXPECT_EQ(VT_I4, msaa_state_variant.vt);
|
| - string16 state_str = IAccessibleStateToString(msaa_state_variant.lVal);
|
| - string16 state2_str = IAccessible2StateToString(acc_obj->ia2_state());
|
| - if (!state2_str.empty()) {
|
| - if (!state_str.empty())
|
| - state_str += L",";
|
| - state_str += state2_str;
|
| - }
|
| + CComBSTR msaa_name_variant;
|
| + HRESULT hresult = acc_obj->get_accName(variant_self, &msaa_name_variant);
|
| + string16 name;
|
| + if (S_OK == hresult)
|
| + name = msaa_name_variant.m_str;
|
|
|
| - // Get role string.
|
| - string16 role_str = IAccessible2RoleToString(acc_obj->ia2_role());
|
| + // Get state strings.
|
| + std::vector<string16> state_strings;
|
| + IAccessibleStateToStringVector(acc_obj->ia_state(), &state_strings);
|
| + IAccessible2StateToStringVector(acc_obj->ia2_state(), &state_strings);
|
|
|
| - return UTF8ToUTF16(prefix) +
|
| - role_str +
|
| - L" name='" + acc_obj->name() +
|
| - L"' state=" + state_str + L"\n";
|
| + // Get the description and attributes.
|
| + string16 description;
|
| + acc_obj->GetStringAttribute(content::AccessibilityNodeData::ATTR_DESCRIPTION,
|
| + &description);
|
| + const std::vector<string16>& ia2_attributes = acc_obj->ia2_attributes();
|
| +
|
| + // Build the line.
|
| + StartLine();
|
| + Add(true, IAccessible2RoleToString(acc_obj->ia2_role()));
|
| + Add(true, L"name='" + name + L"'");
|
| + for (std::vector<string16>::const_iterator it = state_strings.begin();
|
| + it != state_strings.end();
|
| + ++it) {
|
| + Add(false, *it);
|
| + }
|
| + for (std::vector<string16>::const_iterator it = ia2_attributes.begin();
|
| + it != ia2_attributes.end();
|
| + ++it) {
|
| + Add(false, *it);
|
| + }
|
| + Add(false, L"role_name='" + acc_obj->role_name() + L"'");
|
| + Add(false, L"value='" + acc_obj->value() + L"'");
|
| + Add(false, L"description='" + description + L"'");
|
| + return UTF8ToUTF16(prefix) + FinishLine() + ASCIIToUTF16("\n");
|
| }
|
|
|
| const FilePath::StringType DumpAccessibilityTreeHelper::GetActualFileSuffix()
|
| @@ -55,3 +77,12 @@ const FilePath::StringType DumpAccessibilityTreeHelper::GetExpectedFileSuffix()
|
| const {
|
| return FILE_PATH_LITERAL("-expected-win.txt");
|
| }
|
| +
|
| +
|
| +const std::string DumpAccessibilityTreeHelper::GetAllowString() const {
|
| + return "@WIN-ALLOW:";
|
| +}
|
| +
|
| +const std::string DumpAccessibilityTreeHelper::GetDenyString() const {
|
| + return "@WIN-DENY:";
|
| +}
|
|
|