Bug 496923 - Make jstest browser harness load browser.js/shell.js from every path component in the test path. r=terrence

--HG--
extra : rebase_source : 939028cffe76a3e62892804266ae5a861ef22fee
This commit is contained in:
Jeff Walden 2013-07-02 18:41:13 -07:00
parent 1376a274d2
commit 6e7252fcc8

View File

@ -386,31 +386,27 @@ function jsTestDriverBrowserInit()
// must have at least suitepath/subsuite/testcase.js
return;
}
var suitepath = testpathparts.slice(0,testpathparts.length-2).join('/');
var subsuite = testpathparts[testpathparts.length - 2];
var test = testpathparts[testpathparts.length - 1];
document.write('<title>' + suitepath + '/' + subsuite + '/' + test + '<\/title>');
document.write('<title>' + properties.test + '<\/title>');
// XXX bc - the first document.written script is ignored if the protocol
// is file:. insert an empty script tag, to work around it.
document.write('<script></script>');
// Enable a test suite that has more than two levels of directories to
// provide browser.js and shell.js in its base directory.
// This assumes that suitepath is a relative path, as is the case in the
// try server environment. Absolute paths are not allowed.
if (suitepath.indexOf('/') !== -1) {
var base = suitepath.slice(0, suitepath.indexOf('/'));
outputscripttag(base + '/shell.js', properties);
outputscripttag(base + '/browser.js', properties);
// Output script tags for shell.js, then browser.js, at each level of the
// test path hierarchy.
var prepath = "";
var i = 0;
for (end = testpathparts.length - 1; i < end; i++) {
prepath += testpathparts[i] + "/";
outputscripttag(prepath + "shell.js", properties);
outputscripttag(prepath + "browser.js", properties);
}
outputscripttag(suitepath + '/shell.js', properties);
outputscripttag(suitepath + '/browser.js', properties);
outputscripttag(suitepath + '/' + subsuite + '/shell.js', properties);
outputscripttag(suitepath + '/' + subsuite + '/browser.js', properties);
outputscripttag(suitepath + '/' + subsuite + '/' + test, properties);
// Output the test script itself.
outputscripttag(prepath + testpathparts[i], properties);
// Finally output the driver-end script to advance to the next test.
outputscripttag('js-test-driver-end.js', properties);
return;
}