Bug 423035: can't run single chrome/a11y test automatically; r=Waldo
--- a/testing/mochitest/harness-a11y.xul
+++ b/testing/mochitest/harness-a11y.xul
@@ -1,15 +1,11 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/static/harness.css"
type="text/css"?>
-
+
<?xul-overlay href="chrome://mochikit/content/harness-overlay.xul"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessibility Chrome Test Harness"
- id="browserTestOverlay"
- aonload="loadTests('chrome');">
- <script type="text/javascript">
- gDir = "a11y";
- </script>
+ directory="a11y">
</window>
--- a/testing/mochitest/harness-overlay.xul
+++ b/testing/mochitest/harness-overlay.xul
@@ -7,63 +7,67 @@
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<window>
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/TestRunner.js"/>
<script type="text/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/MozillaFileLogger.js"/>
+ src="chrome://mochikit/content/tests/SimpleTest/MozillaFileLogger.js"/>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/quit.js" />
- <script type="text/javascript"
+ <script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/setup.js" />
<script type="application/javascript;version=1.7"><![CDATA[
- function loadTests(aDir)
+ function loadTests()
{
+ var dir = document.documentElement.getAttribute('directory');
// Find our chrome dir
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var chromeURI = ios.newURI("chrome://mochikit/content/",
null, null);
var resolvedURI = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIChromeRegistry).
convertChromeURL(chromeURI);
var fileHandler = Cc["@mozilla.org/network/protocol;1?name=file"].
getService(Ci.nsIFileProtocolHandler);
var chromeDir = fileHandler.getFileFromURLSpec(resolvedURI.spec);
chromeDir = chromeDir.parent.QueryInterface(Ci.nsILocalFile);
- chromeDir.appendRelativePath(aDir);
+ chromeDir.appendRelativePath(dir);
// load server.js in so we can share template functions
var scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
var srvScope = {};
scriptLoader.loadSubScript("chrome://mochikit/content/server.js",
srvScope);
// generate our test list
srvScope.makeTags();
- var url = "chrome://mochikit/content/" + aDir + "/";
+ var url = "chrome://mochikit/content/" + dir + "/";
var [links, count] = srvScope.list(url, chromeDir, true);
var listContent = srvScope.linksToListItems(links);
var tableContent = srvScope.linksToTableRows(links);
function populate() {
$("list-holder").setAttribute("rowspan", 1 + count);
$("test-list").innerHTML += listContent;
$("test-table").innerHTML += tableContent;
$("wrapper").innerHTML += " "; // redraw the table
}
gTestList = eval(srvScope.jsonArrayOfTestFiles(links));
- connect(window, 'onload', populate);
- connect(window, 'onload', hookup);
+ populate();
+ 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;
}
-
- loadTests(gDir);
+ window.addEventListener("load", loadTests, false)
]]>
</script>
<vbox>
<button label="Run Chrome Tests" id="runtests" flex="1"/>
<body xmlns="http://www.w3.org/1999/xhtml" id="xulharness">
<div class="container">
--- a/testing/mochitest/harness.xul
+++ b/testing/mochitest/harness.xul
@@ -1,15 +1,11 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/static/harness.css"
type="text/css"?>
-
+
<?xul-overlay href="chrome://mochikit/content/harness-overlay.xul"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Chrome Test Harness"
- id="browserTestOverlay"
- aonload="loadTests('chrome');">
- <script type="text/javascript">
- gDir = "chrome";
- </script>
+ directory="chrome">
</window>
--- a/testing/mochitest/runtests.pl.in
+++ b/testing/mochitest/runtests.pl.in
@@ -212,23 +212,23 @@ sub main {
# ready, etc. However, xpcshell cold start times suck, at least for debug
# builds. We'll try to connect to the server for 30 seconds or until we
# succeed, whichever is first. If we succeed, then we continue with
# execution. If we fail, we try to kill the server and exit with an error.
wait_for_server_startup($serverPid, SERVER_STARTUP_TIMEOUT);
my $url;
if ($do_chrome) {
- $url = CHROMETESTS_URL . ($test_path ? $test_path : "") . "?";
+ $url = CHROMETESTS_URL . "?" . ($test_path ? "testPath=" . $test_path : "");
} elsif ($do_browser_chrome) {
# 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";
} elsif ($do_a11y) {
- $url = A11YTESTS_URL . ($test_path ? $test_path : "") . "?";
+ $url = A11YTESTS_URL . "?" . ($test_path ? "testPath=" . $test_path : "");
} else {
$url = TESTS_URL . ($test_path ? $test_path : "") . "?";
}
if ($do_browser_chrome) {
generate_test_config($autorun, $close_when_done, $log_path, $test_path);
} else {
if ($autorun) {
--- a/testing/mochitest/runtests.py.in
+++ b/testing/mochitest/runtests.py.in
@@ -294,27 +294,31 @@ Are you executing $objdir/_tests/testing
# logFile -- logs test run to an absolute path
#
# consoleLevel, fileLevel: set the logging level of the console and
# file logs, if activated.
# <http://mochikit.com/doc/html/MochiKit/Logging.html>
testURL = TESTS_URL + options.testPath
+ urlOpts = []
if options.chrome:
- testURL = CHROMETESTS_URL + options.testPath
+ testURL = CHROMETESTS_URL
+ if options.testPath:
+ urlOpts.append("testPath=" + encodeURIComponent(options.testPath))
elif options.a11y:
- testURL = A11YTESTS_URL + options.testPath
+ testURL = A11YTESTS_URL
+ if options.testPath:
+ urlOpts.append("testPath=" + encodeURIComponent(options.testPath))
elif options.browserChrome:
testURL = "about:blank"
if options.browserChrome:
makeTestConfig(options)
else:
- urlOpts = []
if options.autorun:
urlOpts.append("autorun=1")
if options.closeWhenDone:
urlOpts.append("closeWhenDone=1")
if options.logFile:
urlOpts.append("logFile=" + encodeURIComponent(options.logFile))
if options.fileLevel:
urlOpts.append("fileLevel=" + encodeURIComponent(options.fileLevel))