Flutter Engine
The Flutter Engine
Namespaces | Macros | Functions
ax_platform_node_win_unittest.cc File Reference
#include "ax_platform_node_win_unittest.h"
#include <oleacc.h>
#include <wrl/client.h>
#include <memory>
#include "ax_fragment_root_win.h"
#include "ax_platform_node_win.h"
#include "base/auto_reset.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "test_ax_node_wrapper.h"
#include "third_party/accessibility/ax/ax_enums.h"
#include "third_party/accessibility/ax/ax_node_data.h"
#include "third_party/accessibility/base/win/atl_module.h"
#include "third_party/accessibility/base/win/scoped_bstr.h"
#include "third_party/accessibility/base/win/scoped_safearray.h"
#include "third_party/accessibility/base/win/scoped_variant.h"

Go to the source code of this file.

Namespaces

namespace  ui
 

Macros

#define EXPECT_UIA_ELEMENTNOTAVAILABLE(expr)    EXPECT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTAVAILABLE), (expr))
 
#define EXPECT_UIA_INVALIDOPERATION(expr)    EXPECT_EQ(static_cast<HRESULT>(UIA_E_INVALIDOPERATION), (expr))
 
#define EXPECT_UIA_ELEMENTNOTENABLED(expr)    EXPECT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTENABLED), (expr))
 
#define EXPECT_UIA_NOTSUPPORTED(expr)    EXPECT_EQ(static_cast<HRESULT>(UIA_E_NOTSUPPORTED), (expr))
 
#define ASSERT_UIA_ELEMENTNOTAVAILABLE(expr)    ASSERT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTAVAILABLE), (expr))
 
#define ASSERT_UIA_INVALIDOPERATION(expr)    ASSERT_EQ(static_cast<HRESULT>(UIA_E_INVALIDOPERATION), (expr))
 
#define ASSERT_UIA_ELEMENTNOTENABLED(expr)    ASSERT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTENABLED), (expr))
 
#define ASSERT_UIA_NOTSUPPORTED(expr)    ASSERT_EQ(static_cast<HRESULT>(UIA_E_NOTSUPPORTED), (expr))
 
#define EXPECT_UIA_EMPTY(node, property_id)
 
#define EXPECT_UIA_VALUE_EQ(node, property_id, expectedVariant)
 
#define EXPECT_UIA_BSTR_EQ(node, property_id, expected)
 
#define EXPECT_UIA_BOOL_EQ(node, property_id, expected)
 
#define EXPECT_UIA_DOUBLE_ARRAY_EQ(node, array_property_id, expected_property_values)
 
#define EXPECT_UIA_INT_EQ(node, property_id, expected)
 
#define EXPECT_UIA_ELEMENT_ARRAY_BSTR_EQ(array, element_test_property_id, expected_property_values)
 
#define EXPECT_UIA_PROPERTY_ELEMENT_ARRAY_BSTR_EQ(node, array_property_id, element_test_property_id, expected_property_values)
 
#define EXPECT_UIA_PROPERTY_UNORDERED_ELEMENT_ARRAY_BSTR_EQ( node, array_property_id, element_test_property_id, expected_property_values)
 

Functions

 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleDetachedObject)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleHitTest)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleHitTestDoesNotLoopForever)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleName)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleDescription)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleAccValue)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleShortcut)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleSelectionListBoxOptionNothingSelected)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleSelectionListBoxOptionOneSelected)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleSelectionListBoxOptionMultipleSelected)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleSelectionTableNothingSelected)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleSelectionTableRowOneSelected)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleSelectionTableRowMultipleSelected)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleSelectionTableCellOneSelected)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleSelectionTableCellMultipleSelected)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleRole)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleLocation)
 
 ui::TEST_F (AXPlatformNodeWinTest, IAccessibleChildAndParent)
 
 ui::TEST_F (AXPlatformNodeWinTest, AccNavigate)
 
 ui::TEST_F (AXPlatformNodeWinTest, AnnotatedImageName)
 
 ui::TEST_F (AXPlatformNodeWinTest, IGridProviderGetRowCount)
 
 ui::TEST_F (AXPlatformNodeWinTest, IGridProviderGetColumnCount)
 
 ui::TEST_F (AXPlatformNodeWinTest, IGridProviderGetItem)
 
 ui::TEST_F (AXPlatformNodeWinTest, ITableProviderGetColumnHeaders)
 
 ui::TEST_F (AXPlatformNodeWinTest, ITableProviderGetColumnHeadersMultipleHeaders)
 
 ui::TEST_F (AXPlatformNodeWinTest, ITableProviderGetRowHeaders)
 
 ui::TEST_F (AXPlatformNodeWinTest, ITableProviderGetRowOrColumnMajor)
 
 ui::TEST_F (AXPlatformNodeWinTest, ITableItemProviderGetColumnHeaderItems)
 
 ui::TEST_F (AXPlatformNodeWinTest, ITableItemProviderGetRowHeaderItems)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetPropertySimple)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetPropertyValueClickablePoint)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetPropertyValueIsDialog)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetPropertyValueIsControlElementIgnoredInvisible)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetControllerForPropertyId)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetDescribedByPropertyId)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAItemStatusPropertyId)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetFlowsToPropertyId)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetPropertyValueFlowsFromNone)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetPropertyValueFlowsFromSingle)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetPropertyValueFlowsFromMultiple)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetPropertyValueFrameworkId)
 
 ui::TEST_F (AXPlatformNodeWinTest, GetPropertyValue_LabeledByTest)
 
 ui::TEST_F (AXPlatformNodeWinTest, GetPropertyValue_HelpText)
 
 ui::TEST_F (AXPlatformNodeWinTest, GetPropertyValue_LocalizedControlType)
 
 ui::TEST_F (AXPlatformNodeWinTest, GetPropertyValue_IsControlElement)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetProviderOptions)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetHostRawElementProvider)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetBoundingRectangle)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetFragmentRoot)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetEmbeddedFragmentRoots)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAGetRuntimeId)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAIWindowProviderGetIsModalUnset)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAIWindowProviderGetIsModalFalse)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAIWindowProviderGetIsModalTrue)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAIWindowProviderInvalidArgument)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAIWindowProviderNotSupported)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIANavigate)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionProviderCanSelectMultipleDefault)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionProviderCanSelectMultipleTrue)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionProviderIsSelectionRequiredDefault)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionProviderIsSelectionRequiredTrue)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionProviderGetSelectionNoneSelected)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionProviderGetSelectionSingleItemSelected)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionProviderGetSelectionMultipleItemsSelected)
 
 ui::TEST_F (AXPlatformNodeWinTest, ComputeUIAControlType)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIALandmarkType)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIALocalizedLandmarkType)
 
 ui::TEST_F (AXPlatformNodeWinTest, IRawElementProviderSimple2ShowContextMenu)
 
 ui::TEST_F (AXPlatformNodeWinTest, UIAErrorHandling)
 
 ui::TEST_F (AXPlatformNodeWinTest, GetPatternProviderSupportedPatterns)
 
 ui::TEST_F (AXPlatformNodeWinTest, GetPatternProviderExpandCollapsePattern)
 
 ui::TEST_F (AXPlatformNodeWinTest, GetPatternProviderInvokePattern)
 
 ui::TEST_F (AXPlatformNodeWinTest, IExpandCollapsePatternProviderAction)
 
 ui::TEST_F (AXPlatformNodeWinTest, IInvokeProviderInvoke)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionItemProviderNotSupported)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionItemProviderDisabled)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionItemProviderNotSelectable)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionItemProviderSimple)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionItemProviderRadioButton)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionItemProviderMenuItemRadio)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionItemProviderTable)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionItemProviderGrid)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionItemProviderGetSelectionContainer)
 
 ui::TEST_F (AXPlatformNodeWinTest, ISelectionItemProviderSelectFollowFocus)
 
 ui::TEST_F (AXPlatformNodeWinTest, IValueProvider_GetValue)
 
 ui::TEST_F (AXPlatformNodeWinTest, IValueProvider_SetValue)
 
 ui::TEST_F (AXPlatformNodeWinTest, IValueProvider_IsReadOnly)
 
 ui::TEST_F (AXPlatformNodeWinTest, IScrollProviderSetScrollPercent)
 
 ui::TEST_F (AXPlatformNodeWinTest, MojoEventToUIAPropertyTest)
 

Macro Definition Documentation

◆ ASSERT_UIA_ELEMENTNOTAVAILABLE

#define ASSERT_UIA_ELEMENTNOTAVAILABLE (   expr)     ASSERT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTAVAILABLE), (expr))

Definition at line 53 of file ax_platform_node_win_unittest.cc.

◆ ASSERT_UIA_ELEMENTNOTENABLED

#define ASSERT_UIA_ELEMENTNOTENABLED (   expr)     ASSERT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTENABLED), (expr))

Definition at line 57 of file ax_platform_node_win_unittest.cc.

◆ ASSERT_UIA_INVALIDOPERATION

#define ASSERT_UIA_INVALIDOPERATION (   expr)     ASSERT_EQ(static_cast<HRESULT>(UIA_E_INVALIDOPERATION), (expr))

Definition at line 55 of file ax_platform_node_win_unittest.cc.

◆ ASSERT_UIA_NOTSUPPORTED

#define ASSERT_UIA_NOTSUPPORTED (   expr)     ASSERT_EQ(static_cast<HRESULT>(UIA_E_NOTSUPPORTED), (expr))

Definition at line 59 of file ax_platform_node_win_unittest.cc.

◆ EXPECT_UIA_BOOL_EQ

#define EXPECT_UIA_BOOL_EQ (   node,
  property_id,
  expected 
)
Value:
{ \
ScopedVariant expectedVariant(expected); \
ASSERT_EQ(VT_BOOL, expectedVariant.type()); \
ScopedVariant actual; \
ASSERT_HRESULT_SUCCEEDED( \
node->GetPropertyValue(property_id, actual.Receive())); \
EXPECT_EQ(expectedVariant.ptr()->boolVal, actual.ptr()->boolVal); \
}

Definition at line 97 of file ax_platform_node_win_unittest.cc.

◆ EXPECT_UIA_BSTR_EQ

#define EXPECT_UIA_BSTR_EQ (   node,
  property_id,
  expected 
)
Value:
{ \
ScopedVariant expectedVariant(expected); \
ASSERT_EQ(VT_BSTR, expectedVariant.type()); \
ASSERT_NE(nullptr, expectedVariant.ptr()->bstrVal); \
ScopedVariant actual; \
ASSERT_HRESULT_SUCCEEDED( \
node->GetPropertyValue(property_id, actual.Receive())); \
ASSERT_EQ(VT_BSTR, actual.type()); \
ASSERT_NE(nullptr, actual.ptr()->bstrVal); \
EXPECT_STREQ(expectedVariant.ptr()->bstrVal, actual.ptr()->bstrVal); \
}

Definition at line 84 of file ax_platform_node_win_unittest.cc.

◆ EXPECT_UIA_DOUBLE_ARRAY_EQ

#define EXPECT_UIA_DOUBLE_ARRAY_EQ (   node,
  array_property_id,
  expected_property_values 
)
Value:
{ \
ScopedVariant array; \
ASSERT_HRESULT_SUCCEEDED( \
node->GetPropertyValue(array_property_id, array.Receive())); \
ASSERT_EQ(VT_ARRAY | VT_R8, array.type()); \
ASSERT_EQ(1u, SafeArrayGetDim(array.ptr()->parray)); \
LONG array_lower_bound; \
ASSERT_HRESULT_SUCCEEDED( \
SafeArrayGetLBound(array.ptr()->parray, 1, &array_lower_bound)); \
LONG array_upper_bound; \
ASSERT_HRESULT_SUCCEEDED( \
SafeArrayGetUBound(array.ptr()->parray, 1, &array_upper_bound)); \
double* array_data; \
ASSERT_HRESULT_SUCCEEDED(::SafeArrayAccessData( \
array.ptr()->parray, reinterpret_cast<void**>(&array_data))); \
size_t count = array_upper_bound - array_lower_bound + 1; \
ASSERT_EQ(expected_property_values.size(), count); \
for (size_t i = 0; i < count; ++i) { \
EXPECT_EQ(array_data[i], expected_property_values[i]); \
} \
ASSERT_HRESULT_SUCCEEDED(::SafeArrayUnaccessData(array.ptr()->parray)); \
}
int count
Definition: FontMgrTest.cpp:50

Definition at line 107 of file ax_platform_node_win_unittest.cc.

◆ EXPECT_UIA_ELEMENT_ARRAY_BSTR_EQ

#define EXPECT_UIA_ELEMENT_ARRAY_BSTR_EQ (   array,
  element_test_property_id,
  expected_property_values 
)
Value:
{ \
ASSERT_EQ(1u, SafeArrayGetDim(array)); \
LONG array_lower_bound; \
ASSERT_HRESULT_SUCCEEDED( \
SafeArrayGetLBound(array, 1, &array_lower_bound)); \
LONG array_upper_bound; \
ASSERT_HRESULT_SUCCEEDED( \
SafeArrayGetUBound(array, 1, &array_upper_bound)); \
IUnknown** array_data; \
ASSERT_HRESULT_SUCCEEDED( \
::SafeArrayAccessData(array, reinterpret_cast<void**>(&array_data))); \
size_t count = array_upper_bound - array_lower_bound + 1; \
ASSERT_EQ(expected_property_values.size(), count); \
for (size_t i = 0; i < count; ++i) { \
ComPtr<IRawElementProviderSimple> element; \
ASSERT_HRESULT_SUCCEEDED( \
array_data[i]->QueryInterface(IID_PPV_ARGS(&element))); \
EXPECT_UIA_BSTR_EQ(element, element_test_property_id, \
expected_property_values[i].c_str()); \
} \
ASSERT_HRESULT_SUCCEEDED(::SafeArrayUnaccessData(array)); \
}

Definition at line 142 of file ax_platform_node_win_unittest.cc.

◆ EXPECT_UIA_ELEMENTNOTAVAILABLE

#define EXPECT_UIA_ELEMENTNOTAVAILABLE (   expr)     EXPECT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTAVAILABLE), (expr))

Definition at line 44 of file ax_platform_node_win_unittest.cc.

◆ EXPECT_UIA_ELEMENTNOTENABLED

#define EXPECT_UIA_ELEMENTNOTENABLED (   expr)     EXPECT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTENABLED), (expr))

Definition at line 48 of file ax_platform_node_win_unittest.cc.

◆ EXPECT_UIA_EMPTY

#define EXPECT_UIA_EMPTY (   node,
  property_id 
)
Value:
{ \
ScopedVariant actual; \
ASSERT_HRESULT_SUCCEEDED( \
node->GetPropertyValue(property_id, actual.Receive())); \
EXPECT_EQ(VT_EMPTY, actual.type()); \
}

Definition at line 68 of file ax_platform_node_win_unittest.cc.

◆ EXPECT_UIA_INT_EQ

#define EXPECT_UIA_INT_EQ (   node,
  property_id,
  expected 
)
Value:
{ \
ScopedVariant expectedVariant(expected); \
ASSERT_EQ(VT_I4, expectedVariant.type()); \
ScopedVariant actual; \
ASSERT_HRESULT_SUCCEEDED( \
node->GetPropertyValue(property_id, actual.Receive())); \
EXPECT_EQ(expectedVariant.ptr()->intVal, actual.ptr()->intVal); \
}

Definition at line 132 of file ax_platform_node_win_unittest.cc.

◆ EXPECT_UIA_INVALIDOPERATION

#define EXPECT_UIA_INVALIDOPERATION (   expr)     EXPECT_EQ(static_cast<HRESULT>(UIA_E_INVALIDOPERATION), (expr))

Definition at line 46 of file ax_platform_node_win_unittest.cc.

◆ EXPECT_UIA_NOTSUPPORTED

#define EXPECT_UIA_NOTSUPPORTED (   expr)     EXPECT_EQ(static_cast<HRESULT>(UIA_E_NOTSUPPORTED), (expr))

Definition at line 50 of file ax_platform_node_win_unittest.cc.

◆ EXPECT_UIA_PROPERTY_ELEMENT_ARRAY_BSTR_EQ

#define EXPECT_UIA_PROPERTY_ELEMENT_ARRAY_BSTR_EQ (   node,
  array_property_id,
  element_test_property_id,
  expected_property_values 
)
Value:
{ \
ScopedVariant array; \
ASSERT_HRESULT_SUCCEEDED( \
node->GetPropertyValue(array_property_id, array.Receive())); \
ASSERT_EQ(VT_ARRAY | VT_UNKNOWN, array.type()); \
EXPECT_UIA_ELEMENT_ARRAY_BSTR_EQ(array.ptr()->parray, \
element_test_property_id, \
expected_property_values); \
}

Definition at line 167 of file ax_platform_node_win_unittest.cc.

◆ EXPECT_UIA_PROPERTY_UNORDERED_ELEMENT_ARRAY_BSTR_EQ

#define EXPECT_UIA_PROPERTY_UNORDERED_ELEMENT_ARRAY_BSTR_EQ (   node,
  array_property_id,
  element_test_property_id,
  expected_property_values 
)

Definition at line 180 of file ax_platform_node_win_unittest.cc.

◆ EXPECT_UIA_VALUE_EQ

#define EXPECT_UIA_VALUE_EQ (   node,
  property_id,
  expectedVariant 
)
Value:
{ \
ScopedVariant actual; \
ASSERT_HRESULT_SUCCEEDED( \
node->GetPropertyValue(property_id, actual.Receive())); \
EXPECT_EQ(0, actual.Compare(expectedVariant)); \
}

Definition at line 76 of file ax_platform_node_win_unittest.cc.