Set directories in headless on Windows.

Caused some tests to fail.
Update tests.
Merge pull request #4309 from unknownbrackets/tests

Update tests