Bug 416553 â option to run accessibility tests, r=rcampbell
git-svn-id: svn://10.0.0.236/trunk@245676 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -57,11 +57,15 @@ _SERV_FILES = \
|
||||
runtests.py \
|
||||
gen_template.pl \
|
||||
server.js \
|
||||
harness-ally.xul \
|
||||
harness-overlay.xul \
|
||||
harness.xul \
|
||||
browser-test-overlay.xul \
|
||||
browser-test.js \
|
||||
browser-harness.xul \
|
||||
redirect-ally.html \
|
||||
redirect.html \
|
||||
redirect.js \
|
||||
$(topsrcdir)/netwerk/test/httpserver/httpd.js \
|
||||
$(NULL)
|
||||
|
||||
|
||||
15
mozilla/testing/mochitest/harness-ally.xul
Normal file
15
mozilla/testing/mochitest/harness-ally.xul
Normal file
@@ -0,0 +1,15 @@
|
||||
<?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 = "ally";
|
||||
</script>
|
||||
</window>
|
||||
109
mozilla/testing/mochitest/harness-overlay.xul
Normal file
109
mozilla/testing/mochitest/harness-overlay.xul
Normal file
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
|
||||
<overlay id="browserTestOverlay"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
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"/>
|
||||
<script type="text/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/quit.js" />
|
||||
<script type="text/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/setup.js" />
|
||||
<script type="application/javascript;version=1.7"><![CDATA[
|
||||
function loadTests(aDir)
|
||||
{
|
||||
// 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);
|
||||
|
||||
// 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 [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);
|
||||
}
|
||||
|
||||
loadTests(gDir);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<vbox>
|
||||
<button label="Run Chrome Tests" id="runtests" flex="1"/>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" id="xulharness">
|
||||
<div class="container">
|
||||
<p style="float:right;">
|
||||
<small>Based on the MochiKit unit tests.</small>
|
||||
</p>
|
||||
<div class="status">
|
||||
<h1 id="indicator">Status</h1>
|
||||
<h2 id="pass">Passed: <span id="pass-count">0</span></h2>
|
||||
<h2 id="fail">Failed: <span id="fail-count">0</span></h2>
|
||||
<h2 id="fail">Todo: <span id="todo-count">0</span></h2>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="current-test">
|
||||
<b>Currently Executing: <span id="current-test-path">_</span></b>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="frameholder">
|
||||
<iframe scrolling="no" id="testframe" width="500"></iframe>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="toggle">
|
||||
<a href="#" id="toggleNonTests">Show Non-Tests</a>
|
||||
<br />
|
||||
</div>
|
||||
<div id="wrapper">
|
||||
<table cellpadding="0" cellspacing="0" id="test-table">
|
||||
<tr>
|
||||
<td>Passed</td>
|
||||
<td>Failed</td>
|
||||
<td>Todo</td>
|
||||
<td id="list-holder">
|
||||
<ul class="top" id="test-list"><li><b>Test Files</b></li></ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</vbox>
|
||||
</window>
|
||||
|
||||
</overlay>
|
||||
@@ -2,96 +2,14 @@
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/static/harness.css"
|
||||
type="text/css"?>
|
||||
<window title="Chrome Test Harness"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<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"/>
|
||||
<script type="text/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/quit.js" />
|
||||
<script type="text/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/setup.js" />
|
||||
<script type="application/javascript;version=1.7"><![CDATA[
|
||||
/** 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("chrome");
|
||||
|
||||
<?xul-overlay href="chrome://mochikit/content/harness-overlay.xul"?>
|
||||
|
||||
/** 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 [links, count] = srvScope.list("chrome://mochikit/content/chrome/",
|
||||
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);
|
||||
]]>
|
||||
<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>
|
||||
<vbox>
|
||||
<button label="Run Chrome Tests" id="runtests" />
|
||||
<body xmlns="http://www.w3.org/1999/xhtml" id="xulharness">
|
||||
<div class="container">
|
||||
<p style="float:right;">
|
||||
<small>Based on the MochiKit unit tests.</small>
|
||||
</p>
|
||||
<div class="status">
|
||||
<h1 id="indicator">Status</h1>
|
||||
<h2 id="pass">Passed: <span id="pass-count">0</span></h2>
|
||||
<h2 id="fail">Failed: <span id="fail-count">0</span></h2>
|
||||
<h2 id="fail">Todo: <span id="todo-count">0</span></h2>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="current-test">
|
||||
<b>Currently Executing: <span id="current-test-path">_</span></b>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="frameholder">
|
||||
<iframe
|
||||
scrolling="no" id="testframe" width="500"></iframe>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="toggle">
|
||||
<a href="#" id="toggleNonTests">Show Non-Tests</a>
|
||||
<br />
|
||||
</div>
|
||||
<div id="wrapper">
|
||||
<table cellpadding="0" cellspacing="0" id="test-table">
|
||||
<tr>
|
||||
<td>Passed</td>
|
||||
<td>Failed</td>
|
||||
<td>Todo</td>
|
||||
<td id="list-holder"><ul class="top" id="test-list"><li><b>Test Files</b></li></ul></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</vbox>
|
||||
</window>
|
||||
|
||||
14
mozilla/testing/mochitest/redirect-ally.html
Normal file
14
mozilla/testing/mochitest/redirect-ally.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>redirecting...</title>
|
||||
|
||||
<script type="text/javascript" src="redirect.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
redirect("chrome://mochikit/content/harness-ally.xul");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
redirecting...
|
||||
</body>
|
||||
</html>
|
||||
@@ -2,18 +2,10 @@
|
||||
<head>
|
||||
<title>redirecting...</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
<script type="text/javascript" src="redirect.js"></script>
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
var windowMediator = Cc['@mozilla.org/appshell/window-mediator;1'].
|
||||
getService(Ci.nsIWindowMediator);
|
||||
var win = windowMediator.getMostRecentWindow("navigator:browser");
|
||||
win.getWebNavigation().loadURI("chrome://mochikit/content/harness.xul" +
|
||||
location.search,
|
||||
null, null, null, null);
|
||||
<script type="text/javascript">
|
||||
redirect("chrome://mochikit/content/harness.xul");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
53
mozilla/testing/mochitest/redirect.js
Normal file
53
mozilla/testing/mochitest/redirect.js
Normal file
@@ -0,0 +1,53 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is MozJSHTTP code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Robert Sayre <sayrer@gmail.com>
|
||||
* Alexander Surkov <surkov.alexander@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function redirect(aURL)
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
var windowMediator = Cc['@mozilla.org/appshell/window-mediator;1'].
|
||||
getService(Ci.nsIWindowMediator);
|
||||
var win = windowMediator.getMostRecentWindow("navigator:browser");
|
||||
win.getWebNavigation().loadURI(aURL + location.search,
|
||||
null, null, null, null);
|
||||
}
|
||||
@@ -91,8 +91,10 @@ use strict;
|
||||
use constant TEST_SERVER_HOST => "localhost:8888";
|
||||
use constant TEST_PATH => "/tests/";
|
||||
use constant CHROME_PATH => "/redirect.html";
|
||||
use constant ALLY_PATH => "/redirect-ally.html";
|
||||
use constant TESTS_URL => "http://" . TEST_SERVER_HOST . TEST_PATH;
|
||||
use constant CHROMETESTS_URL => "http://" . TEST_SERVER_HOST . CHROME_PATH;
|
||||
use constant ALLYTESTS_URL => "http://" . TEST_SERVER_HOST . ALLY_PATH;
|
||||
|
||||
# Max time in seconds to wait for server startup before tests will fail -- if
|
||||
# this seems big, it's mostly for debug machines where cold startup
|
||||
@@ -164,7 +166,7 @@ my $unixish = (!($is_win32) && !($is_mac));
|
||||
sub main {
|
||||
my ($close_when_done, $appoverride, $log_path, $autorun,
|
||||
$console_level, $file_level, $help, $do_chrome, $test_path,
|
||||
$do_browser_chrome, %browser_env, %browser_args);
|
||||
$do_browser_chrome, $do_ally, %browser_env, %browser_args);
|
||||
GetOptions("close-when-done!"=> \$close_when_done,
|
||||
"appname:s"=> \$appoverride,
|
||||
"log-file:s" => \$log_path,
|
||||
@@ -174,6 +176,7 @@ sub main {
|
||||
"chrome!" => \$do_chrome,
|
||||
"test-path:s" => \$test_path,
|
||||
"browser-chrome!" => \$do_browser_chrome,
|
||||
"ally!" => \$do_ally,
|
||||
"setenv=s%" => \%browser_env,
|
||||
"browser-arg=s%" => \%browser_args,
|
||||
"help!" => \$help);
|
||||
@@ -213,6 +216,8 @@ sub main {
|
||||
# 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_ally) {
|
||||
$url = ALLYTESTS_URL . ($test_path ? $test_path : "") . "?";
|
||||
} else {
|
||||
$url = TESTS_URL . ($test_path ? $test_path : "") . "?";
|
||||
}
|
||||
@@ -259,14 +264,16 @@ sub usage_and_exit {
|
||||
print "\n";
|
||||
print "Usage instructons for runtests.pl.\n";
|
||||
print "If --log-file is specified, --file-level must be specified as well.\n";
|
||||
print "If --chrome is specified, chrome tests will be run instead of web content tests";
|
||||
print "If --browser-chrome is specified, browser-chrome tests will be run instead of web content tests";
|
||||
print "If --chrome is specified, chrome tests will be run instead of web content tests.\n";
|
||||
print "If --browser-chrome is specified, browser-chrome tests will be run instead of web content tests.\n";
|
||||
print "If --ally is specified, ally tests will be run instead of web content tests.";
|
||||
print "\n\n";
|
||||
print "Syntax:\n";
|
||||
print " runtests.pl \\\n";
|
||||
print " [--autorun] \\\n";
|
||||
print " [--chrome] \\\n";
|
||||
print " [--browser-chrome] \\\n";
|
||||
print " [--ally] \\\n";
|
||||
print " [--close-when-done] \\\n";
|
||||
print " [--appname=/path/to/app] \\\n";
|
||||
print " [--log-file=/path/to/logfile] \\\n";
|
||||
|
||||
@@ -59,8 +59,10 @@ import commands
|
||||
TEST_SERVER_HOST = "localhost:8888"
|
||||
TEST_PATH = "/tests/"
|
||||
CHROME_PATH = "/redirect.html";
|
||||
ALLY_PATH = "/redirect-ally.html"
|
||||
TESTS_URL = "http://" + TEST_SERVER_HOST + TEST_PATH
|
||||
CHROMETESTS_URL = "http://" + TEST_SERVER_HOST + CHROME_PATH
|
||||
ALLYTESTS_URL = "http://" + TEST_SERVER_HOST + ALLY_PATH
|
||||
SERVER_SHUTDOWN_URL = "http://" + TEST_SERVER_HOST + "/server/shutdown"
|
||||
|
||||
# Max time in seconds to wait for server startup before tests will fail -- if
|
||||
@@ -194,6 +196,10 @@ class MochitestOptions(optparse.OptionParser):
|
||||
help = "run browser chrome Mochitests")
|
||||
defaults["browserChrome"] = False
|
||||
|
||||
self.add_option("--ally",
|
||||
action = "store_true", dest = "ally",
|
||||
help = "run accessibility Mochitests");
|
||||
|
||||
self.add_option("--setenv",
|
||||
action = "append", type = "string", dest = "environment",
|
||||
help = "given a VAR=value pair, sets that in the "
|
||||
@@ -396,6 +402,8 @@ Are you executing $objdir/_tests/testing/mochitest/runtests.py?"""
|
||||
testURL = TESTS_URL + options.testPath
|
||||
if options.chrome:
|
||||
testURL = CHROMETESTS_URL + options.testPath
|
||||
elif options.ally:
|
||||
testURL = ALLYTESTS_URL + options.testPath
|
||||
elif options.browserChrome:
|
||||
testURL = "about:blank"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user