def _CheckForDangerousTestFunctions(input_api, output_api):
    """Tests should not be using serveAsynchronousMockedRequests, since it does
    not guarantee that the threaded HTML parser will have completed."""
    serve_async_requests_re = input_api.re.compile(
        r'serveAsynchronousMockedRequests')
    errors = input_api.canned_checks._FindNewViolationsOfRule(
        lambda _, x: not serve_async_requests_re.search(x),
        input_api, None)
    errors = ['  * %s' % violation for violation in errors]
    if errors:
        return [output_api.PresubmitError(
                    'You should be using FrameTestHelpers::'
                    'pumpPendingRequests() instead of '
                    'serveAsynchronousMockedRequests() in the following '
                    'locations:\n%s' % '\n'.join(errors))]
    return []