Right now, the most straightforward way requires three files:
function test_withCredentials(worker) {
test(function() {
...
})
<!doctype html>
<meta charset=utf-8>
<title>XMLHttpRequest#withCredentials</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src=XMLHttpRequest-withCredentials.js></script>
<div id="log"></div>
<script>
test_withCredentials(false)
</script>
importScripts("/resources/testharness.js")
importScripts("XMLHttpRequest-withCredentials.js")
test_withCredentials(true);
done()
Since the latter two files are entirely boilerplate, we should be able to do it with just one file.