Isolate download dirs in download related unit tests

The tests in question were using ScopedPathOverride to set the download
directory root, which changes process-global state (in PathService).
When unit tests were running in parallel, they were flaky because they
all accessed and modified this process-global state which has been
cached in DownloadPrefs.

The ChromeDownloadManagerDelegateTest was using
DownloadPrefs::ReinitializeDefaultDownloadDirectoryForTesting to work
around the caching issue, but this effectively only reduces the race
window.

Instead, use DownloadPrefs to expclitly give each test case its own
download directory root. It was necessary to skip download directory
sanitization for this so the test can freely choose the directory.

Bug: 899918
Test: unit_tests --gtest_filter=*ChromeDownloadManagerDelegateTest*
Test: unit_tests --gtest_filter=*DownloadTargetDeterminerTest*
Change-Id: I1019d1db86cfc297bb8a834ee88c6bf7cd81016f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1505445
Reviewed-by: Min Qin <qinmin@chromium.org>
Commit-Queue: Pavol Marko <pmarko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638960}
4 files changed