def METHOD_NAME(request, test_name, download_dir, quteproc, server):
    quteproc.set_setting('downloads.location.directory', download_dir.location)
    quteproc.set_setting('downloads.location.prompt', 'false')
    test_dir = (pathlib.Path(__file__).parent.resolve()
                / 'data' / 'downloads' / 'mhtml' / test_name)
    test_path = 'data/downloads/mhtml/{}'.format(test_name)
    url_path = '{}/{}.html'.format(test_path, test_name)
    quteproc.open_path(url_path)
    download_dest = (pathlib.Path(download_dir.location)
                     / '{}-downloaded.mht'.format(test_name))
    # Wait for favicon.ico to be loaded if there is one
    if (test_dir / 'favicon.png').exists():
        server.wait_for(path='/{}/favicon.png'.format(test_path))
    # Discard all requests that were necessary to display the page
    server.clear_data()
    quteproc.send_cmd(':download --mhtml --dest "{}"'.format(download_dest))
    quteproc.wait_for(category='downloads',
                      message='File successfully written.')
    if request.config.webengine:
        download_dir.sanity_check_mhtml()
        return
    filename = test_name + '.mht'
    expected_file = test_dir / filename
    download_dir.compare_mhtml(expected_file)
    _test_mhtml_requests(test_dir, test_path, server)