From 9d017ed867d7c0b974c9764142abcfda89c58b58 Mon Sep 17 00:00:00 2001 From: "kouhei@chromium.org" Date: Fri, 18 Apr 2014 10:41:14 +0000 Subject: [PATCH] Disable accessibility hooks after test run Accessibility hooks at WebTestProxy was still active after the test run. This caused WebNodes to be stored after test run in AccessibilityController, causing content_shell leak detector to report false positives on some LayoutTests. This patch disables accessibility event hook at WebTestProxy if the testRunner is not running. BUG=332630,364760 Review URL: https://codereview.chromium.org/237963023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264770 0039d316-1c4b-4281-b951-d872f2087c98 --- content/shell/renderer/test_runner/WebTestProxy.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/content/shell/renderer/test_runner/WebTestProxy.cpp b/content/shell/renderer/test_runner/WebTestProxy.cpp index 93e5f16b5688..811e86308699 100644 --- a/content/shell/renderer/test_runner/WebTestProxy.cpp +++ b/content/shell/renderer/test_runner/WebTestProxy.cpp @@ -767,6 +767,13 @@ void WebTestProxyBase::didAutoResize(const WebSize&) void WebTestProxyBase::postAccessibilityEvent(const blink::WebAXObject& obj, blink::WebAXEvent event) { + // Only hook the accessibility events occured during the test run. + // This check prevents false positives in WebLeakDetector. + // The pending tasks in browser/renderer message queue may trigger accessibility events, + // and AccessibilityController will hold on to their target nodes if we don't ignore them here. + if (!m_testInterfaces->testRunner()->TestIsRunning()) + return; + if (event == blink::WebAXEventFocus) m_testInterfaces->accessibilityController()->SetFocusedElement(obj); -- 2.11.4.GIT