Improve DownloadManager shadow and add tests.