Bug 534762. Allow --test-path to run mochitest-chrome tests from a specific diretory. r=ted

This commit is contained in:
Jonathan Griffin 2009-12-22 14:48:16 -08:00
Родитель 0b9b1643df
Коммит d2ee43b89d
1 изменённых файлов: 16 добавлений и 3 удалений

Просмотреть файл

@ -23,6 +23,7 @@
window.removeEventListener("load", loadTests, false);
var dir = document.documentElement.getAttribute('directory');
var url = "chrome://mochikit/content/" + dir + "/";
// Find our chrome dir
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
@ -37,6 +38,19 @@
chromeDir = chromeDir.parent.QueryInterface(Ci.nsILocalFile);
chromeDir.appendRelativePath(dir);
var singleTestPath;
if ("testPath" in params && params.testPath) {
var extraPath = params.testPath;
var pathToCheck = chromeDir.clone().QueryInterface(Ci.nsILocalFile);
pathToCheck.appendRelativePath(extraPath);
if (pathToCheck.isDirectory()) {
chromeDir.appendRelativePath(extraPath);
url += extraPath + "/";
}
else {
singleTestPath = url + params.testPath;
}
}
// load server.js in so we can share template functions
var scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
@ -46,7 +60,6 @@
// generate our test list
srvScope.makeTags();
var url = "chrome://mochikit/content/" + dir + "/";
var [links, count] = srvScope.list(url, chromeDir, true);
var tableContent = srvScope.linksToTableRows(links, 0);
function populate() {
@ -57,8 +70,8 @@
hookup();
// if we got passed a test path, just run that single test
if ("testPath" in params && params.testPath)
window.location.href = url + params.testPath;
if (singleTestPath)
window.location.href = singleTestPath;
}
window.addEventListener("load", loadTests, false);