mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
bug 390539: honor the --test-path option for browser chrome tests as well; r=gavin
This commit is contained in:
parent
d4162f77bd
commit
869b1280bb
@ -49,6 +49,13 @@
|
||||
function TestStart() {
|
||||
gConfig = readConfig();
|
||||
|
||||
// If MochiTest was started with the --test-path flag specifying a subset
|
||||
// of tests to run, put that path in the label of the "Run Tests" button
|
||||
// so the tester knows which tests will run when they press that button.
|
||||
if (gConfig.testPath)
|
||||
document.getElementById("runTestsButton").label =
|
||||
"Run " + gConfig.testPath + " Tests";
|
||||
|
||||
if (gConfig.autoRun)
|
||||
setTimeout(runAllTests, 0);
|
||||
}
|
||||
@ -129,8 +136,16 @@
|
||||
function listTests() {
|
||||
const Cc = Components.classes; const Ci = Components.interfaces;
|
||||
|
||||
var ioSvc = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService);
|
||||
|
||||
var testsDir = getChromeDir();
|
||||
testsDir.appendRelativePath("browser");
|
||||
if (gConfig.testPath) {
|
||||
var testsDirURI = ioSvc.newFileURI(testsDir);
|
||||
testsDir = ioSvc.newURI(gConfig.testPath, null, testsDirURI)
|
||||
.QueryInterface(Ci.nsIFileURL).file;
|
||||
}
|
||||
|
||||
/** load server.js in so we can share template functions **/
|
||||
var scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
@ -138,8 +153,11 @@
|
||||
var srvScope = {};
|
||||
scriptLoader.loadSubScript("chrome://mochikit/content/server.js", srvScope);
|
||||
|
||||
var [links, count] = srvScope.list("chrome://mochikit/content/browser/",
|
||||
testsDir, true);
|
||||
var requestPath = "chrome://mochikit/content/browser";
|
||||
if (gConfig.testPath)
|
||||
requestPath += "/" + gConfig.testPath;
|
||||
|
||||
var [links, count] = srvScope.list(requestPath, testsDir, true);
|
||||
var fileNames = [];
|
||||
srvScope.arrayOfTestFiles(links, fileNames, /browser_.+\.js$/);
|
||||
|
||||
@ -210,7 +228,7 @@
|
||||
setStatus("Done.");
|
||||
}
|
||||
]]></script>
|
||||
<button onclick="runAllTests();" label="Run All Tests"/>
|
||||
<button id="runTestsButton" onclick="runAllTests();" label="Run All Tests"/>
|
||||
<label id="status"/>
|
||||
<textbox flex="1" multiline="true" id="results"/>
|
||||
</window>
|
||||
|
@ -202,14 +202,15 @@ sub main {
|
||||
if ($do_chrome) {
|
||||
$url = CHROMETESTS_URL . ($test_path ? $test_path : "") . "?";
|
||||
} elsif ($do_browser_chrome) {
|
||||
# Tests will run from an overlay, no need to load any URL
|
||||
# Tests will run from an overlay, no need to load any URL. We'll include
|
||||
# the test path in the config file so the browser chrome harness can use it.
|
||||
$url = "about:blank";
|
||||
} else {
|
||||
$url = TESTS_URL . ($test_path ? $test_path : "") . "?";
|
||||
}
|
||||
|
||||
if ($do_browser_chrome) {
|
||||
generate_test_config($autorun, $close_when_done, $log_path);
|
||||
generate_test_config($autorun, $close_when_done, $log_path, $test_path);
|
||||
} else {
|
||||
if ($autorun) {
|
||||
$url .= "&autorun=1";
|
||||
@ -367,17 +368,20 @@ sub startServer {
|
||||
##############
|
||||
|
||||
sub generate_test_config {
|
||||
my ($autorun, $close_when_done, $log_path) = @_;
|
||||
my ($autorun, $close_when_done, $log_path, $test_path) = @_;
|
||||
$autorun = $autorun || 0;
|
||||
$close_when_done = $close_when_done || 0;
|
||||
$log_path = $log_path || "";
|
||||
$log_path =~ s/\\/\\\\/;
|
||||
$log_path =~ s/\\/\\\\/g;
|
||||
$test_path = $test_path || "";
|
||||
$test_path =~ s/\\/\\\\/g;
|
||||
|
||||
my $config_content = <<CONFIGEND;
|
||||
({
|
||||
autoRun: $autorun,
|
||||
closeWhenDone: $close_when_done,
|
||||
logPath: "$log_path"
|
||||
logPath: "$log_path",
|
||||
testPath: "$test_path"
|
||||
})
|
||||
CONFIGEND
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user