Commit de193c79 authored by Kevin Babbitt's avatar Kevin Babbitt Committed by Commit Bot

Fixes and tests for UIA table interfaces

- Fix ITableItemProvider implementation to retrieve column/row header
items from the containing table.
- Eliminate S_FALSE return from ITableItemProvider methods.
- Return empty SAFEARRAYs as nullptr across all properties and control
patterns. This is the same behavior as EdgeHTML.
- Add missing tests for ITableItemProvider and update ITableProvider
tests to cover paths checking for invalid item references. To assist
with this, I split apart the SAFEARRAY testing macros to take either a
property ID or a SAFEARRAY directly.

Bug: 847971
Change-Id: If6f38d7ac7526fa374840f5755eb5aeb99a1b6d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1601633
Commit-Queue: Kevin Babbitt <kbabbitt@microsoft.com>
Reviewed-by: default avatarKurt Catti-Schmidt <kschmi@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#659147}
parent 732841e7
...@@ -172,8 +172,14 @@ IN_PROC_BROWSER_TEST_F(AXPlatformNodeWinBrowserTest, ...@@ -172,8 +172,14 @@ IN_PROC_BROWSER_TEST_F(AXPlatformNodeWinBrowserTest,
LoadInitialAccessibilityTreeFromHtmlFilePath( LoadInitialAccessibilityTreeFromHtmlFilePath(
"/accessibility/aria/aria-label.html"); "/accessibility/aria/aria-label.html");
UIAGetPropertyValueFlowsFromBrowserTestTemplate( base::win::ScopedVariant flows_from_variant;
FindNode(ax::mojom::Role::kCheckBox, "aria label"), {}); ComPtr<IRawElementProviderSimple> node_provider =
QueryInterfaceFromNode<IRawElementProviderSimple>(
FindNode(ax::mojom::Role::kCheckBox, "aria label"));
node_provider->GetPropertyValue(UIA_FlowsFromPropertyId,
flows_from_variant.Receive());
ASSERT_EQ(VT_ARRAY | VT_UNKNOWN, flows_from_variant.type());
ASSERT_EQ(nullptr, V_ARRAY(flows_from_variant.ptr()));
} }
IN_PROC_BROWSER_TEST_F(AXPlatformNodeWinBrowserTest, IN_PROC_BROWSER_TEST_F(AXPlatformNodeWinBrowserTest,
......
...@@ -399,6 +399,9 @@ SAFEARRAY* AXPlatformNodeWin::CreateUIAElementsArrayForReverseRelation( ...@@ -399,6 +399,9 @@ SAFEARRAY* AXPlatformNodeWin::CreateUIAElementsArrayForReverseRelation(
SAFEARRAY* AXPlatformNodeWin::CreateUIAElementsArrayFromIdVector( SAFEARRAY* AXPlatformNodeWin::CreateUIAElementsArrayFromIdVector(
std::vector<int32_t>& ids) { std::vector<int32_t>& ids) {
if (ids.size() == 0)
return nullptr;
SAFEARRAY* uia_array = SafeArrayCreateVector(VT_UNKNOWN, 0, ids.size()); SAFEARRAY* uia_array = SafeArrayCreateVector(VT_UNKNOWN, 0, ids.size());
LONG i = 0; LONG i = 0;
...@@ -2080,12 +2083,10 @@ IFACEMETHODIMP AXPlatformNodeWin::GetColumnHeaderItems(SAFEARRAY** result) { ...@@ -2080,12 +2083,10 @@ IFACEMETHODIMP AXPlatformNodeWin::GetColumnHeaderItems(SAFEARRAY** result) {
return E_FAIL; return E_FAIL;
std::vector<int32_t> column_header_ids = std::vector<int32_t> column_header_ids =
GetDelegate()->GetColHeaderNodeIds(GetTableColumn()); GetTable()->GetDelegate()->GetColHeaderNodeIds(GetTableColumn());
base::EraseIf(column_header_ids, [&](int32_t node_id) { base::EraseIf(column_header_ids, [&](int32_t node_id) {
return !IsValidUiaRelationTarget(GetDelegate()->GetFromNodeID(node_id)); return !IsValidUiaRelationTarget(GetDelegate()->GetFromNodeID(node_id));
}); });
if (column_header_ids.empty())
return S_FALSE;
*result = CreateUIAElementsArrayFromIdVector(column_header_ids); *result = CreateUIAElementsArrayFromIdVector(column_header_ids);
return S_OK; return S_OK;
} }
...@@ -2098,12 +2099,10 @@ IFACEMETHODIMP AXPlatformNodeWin::GetRowHeaderItems(SAFEARRAY** result) { ...@@ -2098,12 +2099,10 @@ IFACEMETHODIMP AXPlatformNodeWin::GetRowHeaderItems(SAFEARRAY** result) {
return E_FAIL; return E_FAIL;
std::vector<int32_t> row_header_ids = std::vector<int32_t> row_header_ids =
GetDelegate()->GetRowHeaderNodeIds(GetTableRow()); GetTable()->GetDelegate()->GetRowHeaderNodeIds(GetTableRow());
base::EraseIf(row_header_ids, [&](int32_t node_id) { base::EraseIf(row_header_ids, [&](int32_t node_id) {
return !IsValidUiaRelationTarget(GetDelegate()->GetFromNodeID(node_id)); return !IsValidUiaRelationTarget(GetDelegate()->GetFromNodeID(node_id));
}); });
if (row_header_ids.empty())
return S_FALSE;
*result = CreateUIAElementsArrayFromIdVector(row_header_ids); *result = CreateUIAElementsArrayFromIdVector(row_header_ids);
return S_OK; return S_OK;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment