Bug 462348: Make browser chrome test output less awful and more awesome
(test only change). r=gavin git-svn-id: svn://10.0.0.236/trunk@254832 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
edf0d1bbbf
commit
563f917e4f
@ -44,6 +44,38 @@
|
||||
title="Browser chrome tests">
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/MozillaFileLogger.js"/>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/quit.js"/>
|
||||
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
|
||||
#results {
|
||||
margin: 5px;
|
||||
background-color: window;
|
||||
-moz-user-select: text;
|
||||
}
|
||||
|
||||
#summary {
|
||||
border: 2px solid black;
|
||||
}
|
||||
|
||||
#summary.success {
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
#summary.failure {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
.failed {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.testHeader {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0.1em;
|
||||
}
|
||||
]]></style>
|
||||
<script type="application/javascript;version=1.7"><![CDATA[
|
||||
var gConfig;
|
||||
function TestStart() {
|
||||
@ -129,6 +161,15 @@
|
||||
return t.msg + " - " + path;
|
||||
return t.msg;
|
||||
}).join("\n");
|
||||
},
|
||||
get htmlLog() {
|
||||
var path = this.path;
|
||||
return this.tests.map(function (t) {
|
||||
var result = "<p class=\"result ";
|
||||
result += t.pass ? "passed" : "failed";
|
||||
result += "\">" + t.result + " | " + path + " | " + t.msg + "</p>";
|
||||
return result;
|
||||
}).join("\n");
|
||||
}
|
||||
};
|
||||
|
||||
@ -180,6 +221,24 @@
|
||||
Tester.start();
|
||||
}
|
||||
|
||||
function getHTMLLogFromTests(aTests) {
|
||||
var log = "";
|
||||
|
||||
function sum(a, b){ return a + b; }
|
||||
var passCount = aTests.map(function (f) f.passCount).reduce(sum);
|
||||
var failCount = aTests.map(function (f) f.failCount).reduce(sum);
|
||||
var todoCount = aTests.map(function (f) f.todoCount).reduce(sum);
|
||||
log += "<div id=\"summary\" class=\"";
|
||||
log += failCount == 0 ? "success" : "failure";
|
||||
log += "\">\n<p>Passed: " + passCount + "</p>\n" +
|
||||
"<p>Failed: " + failCount + "</p>\n" +
|
||||
"<p>Todo: " + todoCount + "</p>\n</div>\n<div id=\"log\">\n";
|
||||
|
||||
return log + aTests.map(function (f) {
|
||||
return "<p class=\"testHeader\">" + f.path + "</p>\n" + f.htmlLog;
|
||||
}).join("\n") + "</div>";
|
||||
}
|
||||
|
||||
function getLogFromTests(aTests) {
|
||||
if (!aTests.length)
|
||||
return "PASS - No tests to run";
|
||||
@ -224,11 +283,13 @@
|
||||
}
|
||||
|
||||
// UI
|
||||
document.getElementById("results").value = output;
|
||||
document.getElementById("results").innerHTML = getHTMLLogFromTests(aTests);
|
||||
setStatus("Done.");
|
||||
}
|
||||
]]></script>
|
||||
<button id="runTestsButton" onclick="runAllTests();" label="Run All Tests"/>
|
||||
<label id="status"/>
|
||||
<textbox flex="1" multiline="true" id="results"/>
|
||||
<scrollbox flex="1" style="overflow: auto" align="stretch">
|
||||
<div id="results" xmlns="http://www.w3.org/1999/xhtml"/>
|
||||
</scrollbox>
|
||||
</window>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user