diff --git a/engine/src/flutter/third_party/accessibility/ax/platform/ax_platform_node_win_unittest.cc b/engine/src/flutter/third_party/accessibility/ax/platform/ax_platform_node_win_unittest.cc index 6cd3740a2a..90d5e40156 100644 --- a/engine/src/flutter/third_party/accessibility/ax/platform/ax_platform_node_win_unittest.cc +++ b/engine/src/flutter/third_party/accessibility/ax/platform/ax_platform_node_win_unittest.cc @@ -271,6 +271,7 @@ void AXPlatformNodeWinTest::TearDown() { ax_fragment_root_.reset(nullptr); DestroyTree(); TestAXNodeWrapper::SetGlobalIsWebContent(false); + TestAXNodeWrapper::ClearHitTestResults(); ASSERT_EQ(0U, AXPlatformNodeBase::GetInstanceCountForTesting()); } @@ -446,8 +447,7 @@ TEST_F(AXPlatformNodeWinTest, IAccessibleDetachedObject) { EXPECT_EQ(E_FAIL, root_obj->get_accName(SELF, name2.Receive())); } -// TODO(cbracken): Flaky https://github.com/flutter/flutter/issues/98302 -TEST_F(AXPlatformNodeWinTest, DISABLED_IAccessibleHitTest) { +TEST_F(AXPlatformNodeWinTest, IAccessibleHitTest) { AXNodeData root; root.id = 1; root.relative_bounds.bounds = gfx::RectF(0, 0, 40, 40); diff --git a/engine/src/flutter/third_party/accessibility/ax/platform/test_ax_node_wrapper.cc b/engine/src/flutter/third_party/accessibility/ax/platform/test_ax_node_wrapper.cc index 6ed39a7bbc..7270b83911 100644 --- a/engine/src/flutter/third_party/accessibility/ax/platform/test_ax_node_wrapper.cc +++ b/engine/src/flutter/third_party/accessibility/ax/platform/test_ax_node_wrapper.cc @@ -119,6 +119,11 @@ void TestAXNodeWrapper::SetHitTestResult(AXNode::AXID src_node_id, g_hit_test_result[src_node_id] = dst_node_id; } +// static +void TestAXNodeWrapper::ClearHitTestResults() { + g_hit_test_result.clear(); +} + TestAXNodeWrapper::~TestAXNodeWrapper() { platform_node_->Destroy(); } diff --git a/engine/src/flutter/third_party/accessibility/ax/platform/test_ax_node_wrapper.h b/engine/src/flutter/third_party/accessibility/ax/platform/test_ax_node_wrapper.h index fc0581c12f..c2e9c208da 100644 --- a/engine/src/flutter/third_party/accessibility/ax/platform/test_ax_node_wrapper.h +++ b/engine/src/flutter/third_party/accessibility/ax/platform/test_ax_node_wrapper.h @@ -56,6 +56,9 @@ class TestAXNodeWrapper : public AXPlatformNodeDelegateBase { static void SetHitTestResult(AXNode::AXID src_node_id, AXNode::AXID dst_node_id); + // Remove all hit test overrides added by SetHitTestResult. + static void ClearHitTestResults(); + ~TestAXNodeWrapper() override; AXPlatformNode* ax_platform_node() const { return platform_node_; }