Bug 787916 - Hide Mochitest test table with --close-when-done option. r=jmaher

This commit is contained in:
Christian Holler 2012-09-19 01:28:39 +02:00
parent 45182816a6
commit f103881675
3 changed files with 28 additions and 13 deletions

View File

@ -390,8 +390,10 @@ class MochitestServer:
args = ["-g", self._xrePath,
"-v", "170",
"-f", "./" + "httpd.js",
"-e", "const _PROFILE_PATH = '%(profile)s';const _SERVER_PORT = '%(port)s'; const _SERVER_ADDR = '%(server)s'; const _TEST_PREFIX = %(testPrefix)s;" %
{"profile" : self._profileDir.replace('\\', '\\\\'), "port" : self.httpPort, "server" : self.webServer, "testPrefix" : self.testPrefix },
"-e", """const _PROFILE_PATH = '%(profile)s';const _SERVER_PORT = '%(port)s'; const _SERVER_ADDR = '%(server)s';
const _TEST_PREFIX = %(testPrefix)s; const _DISPLAY_RESULTS = %(displayResults)s;""" %
{"profile" : self._profileDir.replace('\\', '\\\\'), "port" : self.httpPort, "server" : self.webServer,
"testPrefix" : self.testPrefix, "displayResults" : str(not self._closeWhenDone).lower() },
"-f", "./" + "server.js"]
xpcshell = os.path.join(self._utilityPath,

View File

@ -108,6 +108,7 @@ if (this["nsHttpServer"]) {
}
var serverBasePath;
var displayResults = true;
//
// SERVER SETUP
@ -147,6 +148,11 @@ function runServer()
throw "please define _SERVER_PORT (as a port number) before running server.js";
}
// If DISPLAY_RESULTS is not specified, it defaults to true
if (typeof(_DISPLAY_RESULTS) != "undefined") {
displayResults = _DISPLAY_RESULTS;
}
server._start(SERVER_PORT, gServerAddress);
// touch a file in the profile directory to indicate we're alive
@ -629,10 +635,13 @@ function testListing(metadata, response)
A({href: "#", id: "toggleNonTests"}, "Show Non-Tests"),
BR()
),
TABLE({cellpadding: 0, cellspacing: 0, class: table_class, id: "test-table"},
TR(TD("Passed"), TD("Failed"), TD("Todo"), TD("Test Files")),
linksToTableRows(links, 0)
(
displayResults ?
TABLE({cellpadding: 0, cellspacing: 0, class: table_class, id: "test-table"},
TR(TD("Passed"), TD("Failed"), TD("Todo"), TD("Test Files")),
linksToTableRows(links, 0)
) : ""
),
BR(),

View File

@ -534,13 +534,17 @@ TestRunner.updateUI = function(tests) {
// Set the table values
var trID = "tr-" + $('current-test-path').innerHTML;
var row = $(trID);
var tds = row.getElementsByTagName("td");
tds[0].style.backgroundColor = "#0d0";
tds[0].innerHTML = parseInt(tds[0].innerHTML) + parseInt(results.OK);
tds[1].style.backgroundColor = results.notOK > 0 ? "red" : "#0d0";
tds[1].innerHTML = parseInt(tds[1].innerHTML) + parseInt(results.notOK);
tds[2].style.backgroundColor = results.todo > 0 ? "orange" : "#0d0";
tds[2].innerHTML = parseInt(tds[2].innerHTML) + parseInt(results.todo);
// Only update the row if it actually exists (autoUI)
if (row != null) {
var tds = row.getElementsByTagName("td");
tds[0].style.backgroundColor = "#0d0";
tds[0].innerHTML = parseInt(tds[0].innerHTML) + parseInt(results.OK);
tds[1].style.backgroundColor = results.notOK > 0 ? "red" : "#0d0";
tds[1].innerHTML = parseInt(tds[1].innerHTML) + parseInt(results.notOK);
tds[2].style.backgroundColor = results.todo > 0 ? "orange" : "#0d0";
tds[2].innerHTML = parseInt(tds[2].innerHTML) + parseInt(results.todo);
}
//if we ran in a loop, display any found errors
if (TestRunner.repeat > 0) {