diff --git a/testing/mochitest/server.js b/testing/mochitest/server.js index 8b555e2c7e21..02485fb88d94 100644 --- a/testing/mochitest/server.js +++ b/testing/mochitest/server.js @@ -514,6 +514,10 @@ function testListing(metadata, response) true); dumpn("count: " + count); var tests = jsonArrayOfTestFiles(links); + var runtests = "Run Tests"; + if (metadata.queryString.indexOf("autorun=1") != -1) { + runtests = "Stop Tests"; + } response.write( HTML( HEAD( @@ -536,7 +540,7 @@ function testListing(metadata, response) ), BODY( DIV({class: "container"}, - H2("--> ", A({href: "#", id: "runtests"}, "Run Tests"), " <--"), + H2("--> ", A({href: "#", id: "runtests"}, runtests), " <--"), P({style: "float: right;"}, SMALL( "Based on the ", @@ -546,6 +550,8 @@ function testListing(metadata, response) ), DIV({class: "status"}, H1({id: "indicator"}, "Status"), + H2({id: "file"}, "File: ", + SPAN({id: "progress"}, "0 / " + count + " (0%)")), H2({id: "pass"}, "Passed: ", SPAN({id: "pass-count"},"0")), H2({id: "fail"}, "Failed: ", SPAN({id: "fail-count"},"0")), H2({id: "fail"}, "Todo: ", SPAN({id: "todo-count"},"0")) diff --git a/testing/mochitest/static/harness.css b/testing/mochitest/static/harness.css index 3c941ecf3920..1c5b14d7510e 100644 --- a/testing/mochitest/static/harness.css +++ b/testing/mochitest/static/harness.css @@ -91,7 +91,7 @@ div#current-test { margin: 0; } -#pass, #fail { +#pass, #fail, #file { margin: 0; padding: .5em; } diff --git a/testing/mochitest/tests/SimpleTest/TestRunner.js b/testing/mochitest/tests/SimpleTest/TestRunner.js index 7ff99f9c48cd..00d1b48c945e 100644 --- a/testing/mochitest/tests/SimpleTest/TestRunner.js +++ b/testing/mochitest/tests/SimpleTest/TestRunner.js @@ -11,6 +11,7 @@ TestRunner.logEnabled = false; TestRunner._currentTest = 0; TestRunner.currentTestURL = ""; TestRunner._urls = []; +TestRunner._title = ""; TestRunner.timeout = 5 * 60 * 1000; // 5 minutes. TestRunner.maxTimeouts = 4; // halt testing after too many timeouts @@ -95,7 +96,7 @@ TestRunner._makeIframe = function (url, retry) { TestRunner.logger.log("Error: Unable to restore focus, expect failures and timeouts."); } } - window.scrollTo(0, $('indicator').offsetTop); + window.scrollTo(0, 0); iframe.src = url; iframe.name = url; iframe.width = "500"; @@ -112,6 +113,7 @@ TestRunner.runTests = function (/*url...*/) { if (TestRunner.logEnabled) TestRunner.logger.log("SimpleTest START"); + TestRunner._title = document.title; TestRunner._urls = flattenArguments(arguments); $('testframe').src=""; TestRunner._checkForHangs(); @@ -169,6 +171,12 @@ TestRunner.runNextTest = function() { if (TestRunner.onComplete) TestRunner.onComplete(); } + var cur = TestRunner._currentTest; + var total = TestRunner._urls.length; + var progress = cur + " / " + total + " (" + + Math.floor(100 * (cur / total)) + "%)"; + document.title = progress + " - " + TestRunner._title; + $("progress").innerHTML = progress; }; /** diff --git a/testing/mochitest/tests/SimpleTest/setup.js b/testing/mochitest/tests/SimpleTest/setup.js index e9f693fac996..95efbc2a07c4 100644 --- a/testing/mochitest/tests/SimpleTest/setup.js +++ b/testing/mochitest/tests/SimpleTest/setup.js @@ -138,11 +138,16 @@ RunSet.runall = function(e) { } RunSet.reloadAndRunAll = function(e) { e.preventDefault(); - //window.location.hash = ""; var addParam = ""; if (params.autorun) { - window.location.search += ""; - window.location.href = window.location.href; + if (!TestRunner._haltTests) { + TestRunner._haltTests = true; + $('runtests').innerHTML = "Restart Tests"; + } + else { + // already clicked stop, so just reload + window.location.href = window.location.href; + } } else if (window.location.search) { window.location.href += "&autorun=1"; } else {