Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Unified Diff: ui/accessibility/platform/ax_platform_node_win_unittest.cc

Issue 2948513002: Forward BrowserAccessibility::accHitTest to AXPlatformNode. (Closed)
Patch Set: spelling Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_win.cc ('k') | ui/accessibility/platform/test_ax_node_wrapper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/accessibility/platform/ax_platform_node_win_unittest.cc
diff --git a/ui/accessibility/platform/ax_platform_node_win_unittest.cc b/ui/accessibility/platform/ax_platform_node_win_unittest.cc
index 506267ccaa1d5e4eb0a917282f8ec2259c51be91..1cb4a5c8dcda83153c49d618305379b613a2bda0 100644
--- a/ui/accessibility/platform/ax_platform_node_win_unittest.cc
+++ b/ui/accessibility/platform/ax_platform_node_win_unittest.cc
@@ -124,6 +124,46 @@ TEST_F(AXPlatformNodeWinTest, TestIAccessibleDetachedObject) {
EXPECT_EQ(E_FAIL, root_obj->get_accName(SELF, name2.Receive()));
}
+TEST_F(AXPlatformNodeWinTest, TestIAccessibleHitTest) {
+ AXNodeData root;
+ root.id = 0;
+ root.child_ids.push_back(1);
+ root.child_ids.push_back(2);
+ root.location = gfx::RectF(0, 0, 30, 30);
+
+ AXNodeData node1;
+ node1.id = 1;
+ node1.location = gfx::RectF(0, 0, 10, 10);
+ node1.AddStringAttribute(AX_ATTR_NAME, "Name1");
+
+ AXNodeData node2;
+ node2.id = 2;
+ node2.location = gfx::RectF(20, 20, 10, 10);
+ node2.AddStringAttribute(AX_ATTR_NAME, "Name2");
+
+ Init(root, node1, node2);
+
+ ScopedComPtr<IAccessible> root_obj(GetRootIAccessible());
+
+ ScopedVariant obj;
+
+ // This is way outside of the root node
+ EXPECT_EQ(S_FALSE, root_obj->accHitTest(50, 50, obj.Receive()));
+ EXPECT_EQ(VT_EMPTY, obj.type());
+
+ // this is directly on node 1.
+ EXPECT_EQ(S_OK, root_obj->accHitTest(5, 5, obj.Receive()));
+ ASSERT_NE(nullptr, obj.ptr());
+
+ // We got something back, make sure that it has the correct name.
+ base::win::ScopedComPtr<IAccessible> accessible;
+ HRESULT hr = V_DISPATCH(obj.ptr())->QueryInterface(IID_PPV_ARGS(&accessible));
+ EXPECT_EQ(S_OK, hr);
+ ScopedBstr name;
+ EXPECT_EQ(S_OK, accessible->get_accName(SELF, name.Receive()));
+ EXPECT_STREQ(L"Name1", name);
+}
+
TEST_F(AXPlatformNodeWinTest, TestIAccessibleName) {
AXNodeData root;
root.id = 1;
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_win.cc ('k') | ui/accessibility/platform/test_ax_node_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698