Bug 416553 - option to run accessibility tests, r=rcampbell

This commit is contained in:
surkov.alexander@gmail.com 2008-02-13 22:20:01 -08:00
Родитель ce2c246576
Коммит 658f5a6467
13 изменённых файлов: 447 добавлений и 126 удалений

Просмотреть файл

@ -43,7 +43,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = accessibility
DIRS = public src build
DIRS = public src build tests
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,53 @@
#
# ***** 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 mozilla.org 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):
# Alexander Surkov <surkov.alexander@gmail.com> (original author)
#
# Alternatively, the contents of this file may be used under the terms of
# either of 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 *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = test_accessibility
ifdef MOZ_MOCHITEST
DIRS += mochitest
endif
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,53 @@
#
# ***** 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 mozilla.org 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):
# Alexander Surkov <surkov.alexander@gmail.com> (original author)
#
# Alternatively, the contents of this file may be used under the terms of
# either of 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 *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = accessible
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES =\
test_bug368835.xul \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/ally/$(relativesrcdir)

Просмотреть файл

@ -1,6 +1,7 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<!--
Bug 368835 - fire TreeViewChanged/TreeRowCountChanged events.
@ -9,8 +10,10 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Mozilla Bug 368835">
<script type="application/javascript" src="/MochiKit/packed.js"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript">
<![CDATA[
function inTreeView() { }
@ -19,10 +22,18 @@
{
mRowCount: 0,
mTree: null,
mData: {},
get rowCount() { return this.mRowCount; },
setTree: function(aTree) { this.mTree = aTree; },
getCellText: function(aRow, aCol) { return "hello"; },
getCellText: function(aRow, aCol)
{
var key = String(aRow) + aCol.id;
if (key in this.mData)
return this.mData[key];
return "hello";
},
getRowProperties: function(aIndex, aProperties) {},
getCellProperties: function(aIndex, aCol, aProperties) {},
getColumnProperties: function(aCol, aProperties) {},
@ -59,28 +70,86 @@
var gTreeRowCountChanged = false;
function TreeRowCountChangedHandler(aEvent)
{
netscape.security.PrivilegeManager.
enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
gTreeRowCountChanged = true;
var index = aEvent.getData("index");
ok(index == 0, "Wrong 'index' data of 'treeRowCountChanged' event.");
is(index, 0, "Wrong 'index' data of 'treeRowCountChanged' event.");
var count = aEvent.getData("count");
ok(count == 1, "Wrong 'count' data of 'treeRowCountChanged' event.");
is(count, 1, "Wrong 'count' data of 'treeRowCountChanged' event.");
}
var gTreeInvalidatedCount = 0;
function TreeInvalidatedHandler(aEvent)
{
gTreeInvalidatedCount++;
switch (gTreeInvalidatedCount) {
case 2:
TreeColumnInvalidatedHandler(aEvent);
break;
case 3:
TreeRowInvalidatedHandler(aEvent);
break;
}
}
var gTreeColumnInvalidated = false;
function TreeColumnInvalidatedHandler(aEvent)
{
var startRow = aEvent.getData("startrow");
is(startRow, null,
"Wrong 'startrow' of 'treeInvalidated' event on InvalidateColumn().");
var endRow = aEvent.getData("endrow");
is(endRow, null,
"Wrong 'endrow' of 'treeInvalidated' event on InvalidateColumn().");
var startCol = aEvent.getData("startcolumn");
is(startCol, 0,
"Wrong 'startcolumn' of 'treeInvalidated' event on InvalidateColumn().");
var endCol = aEvent.getData("endcolumn");
is(endCol, 0,
"Wrong 'endcolumn' of 'treeInvalidated' event on InvalidateColumn().");
gTreeColumnInvalidated = true;
}
var gTreeRowInvalidated = false;
function TreeRowInvalidatedHandler(aEvent)
{
var startRow = aEvent.getData("startrow");
is(startRow, 1,
"Wrong 'startrow' of 'treeInvalidated' event on InvalidateColumn().");
var endRow = aEvent.getData("endrow");
is(endRow, 1,
"Wrong 'endrow' of 'treeInvalidated' event on InvalidateColumn().");
var startCol = aEvent.getData("startcolumn");
is(startCol, null,
"Wrong 'startcolumn' of 'treeInvalidated' event on InvalidateColumn().");
var endCol = aEvent.getData("endcolumn");
is(endCol, null,
"Wrong 'endcolumn' of 'treeInvalidated' event on InvalidateColumn().");
gTreeRowInvalidated = true;
}
function CheckEvents()
{
netscape.security.PrivilegeManager.
enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
// If these fail then it doesn't mean actually events are not fired,
// possibly setTimeout was executed earlier than events have beenS fired.
ok(gTreeViewChanged, "TreeViewChanged event should have been fired.")
ok(gTreeRowCountChanged, "TreeRowCountChanged event should have been fired.");
ok(gTreeViewChanged,
"TreeViewChanged event should have been fired.");
ok(gTreeRowCountChanged,
"TreeRowCountChanged event should have been fired.");
ok(gTreeColumnInvalidated,
"TreeInvalidated event should have been fired for InvalidateColumn().");
ok(gTreeRowInvalidated,
"TreeInvalidated event should have been fired for InvalidateRow().");
document.removeEventListener("TreeViewChanged",
TreeViewChangedHandler, true);
@ -88,6 +157,9 @@
document.removeEventListener("TreeRowCountChanged",
TreeRowCountChangedHandler, true);
document.removeEventListener("TreeInvalidated",
TreeInvalidatedHandler, true);
SimpleTest.finish();
}
@ -95,9 +167,6 @@
function doTest()
{
netscape.security.PrivilegeManager.
enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
// Check whether accessbility support is enabled.
if (!("@mozilla.org/accessibleRetrieval;1" in Components.classes)) {
SimpleTest.finish();
@ -108,26 +177,49 @@
gAccService = Components.classes["@mozilla.org/accessibleRetrieval;1"].
getService(Components.interfaces.nsIAccessibleRetrieval);
// Add event listeners
document.addEventListener("TreeViewChanged",
TreeViewChangedHandler, true);
document.addEventListener("TreeRowCountChanged",
TreeRowCountChangedHandler, true);
document.addEventListener("TreeInvalidated",
TreeInvalidatedHandler, true);
// Initialize the tree
var tree = document.getElementById("tree");
var treeBox = tree.treeBoxObject;
var view = new inTreeView();
view.mRowCount = 5;
// Fire 'TreeViewChanged' event
treeBox.view = view;
view.selection.currentIndex = 0;
view.selection.selectAll();
// Fire 'TreeRowCountChanged' changed
++view.mRowCount;
treeBox.rowCountChanged(0, 1);
if (gTreeViewChanged && gTreeRowCountChanged)
// Fire 'TreeInvalidated' event by InvalidateColumn()
var firstCol = treeBox.columns.getFirstColumn();
for (var i = 0; i < view.mRowCount; i++) {
var key = String(i) + firstCol.id;
view.mData[key] = key + "_col";
}
treeBox.invalidateColumn(firstCol);
// Fire 'TreeInvalidated' event by InvalidateRow()
var colCount = tree.columns.count;
for (var i = 0; i < colCount; i++) {
var key = "1" + tree.columns.getColumnAt(i).id;
view.mData[key] = key + "_row";
}
treeBox.invalidateRow(1);
// Wait for events.
if (gTreeViewChanged && gTreeRowCountChanged &&
gTreeColumnInvalidated)
CheckEvents();
else
window.setTimeout(CheckEvents, 1000);
@ -146,11 +238,14 @@
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<tree id="tree" flex="1">
<treecols>
<treecol id="col" flex="1" primary="true" label="column"/>
<treecol id="scol" flex="1" label="column 2"/>
</treecols>
<treechildren id="treechildren"/>
</tree>

Просмотреть файл

@ -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)

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

Просмотреть файл

@ -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"