Bug 416553 â option to run accessibility tests, r=rcampbell
git-svn-id: svn://10.0.0.236/trunk@245688 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
d077ccaca3
commit
532fbb6b10
@ -43,7 +43,7 @@ VPATH = @srcdir@
|
|||||||
include $(DEPTH)/config/autoconf.mk
|
include $(DEPTH)/config/autoconf.mk
|
||||||
|
|
||||||
MODULE = accessibility
|
MODULE = accessibility
|
||||||
DIRS = public src build
|
DIRS = public src build tests
|
||||||
|
|
||||||
include $(topsrcdir)/config/rules.mk
|
include $(topsrcdir)/config/rules.mk
|
||||||
|
|
||||||
|
|||||||
53
mozilla/accessible/tests/Makefile.in
Normal file
53
mozilla/accessible/tests/Makefile.in
Normal file
@ -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
|
||||||
|
|
||||||
53
mozilla/accessible/tests/mochitest/Makefile.in
Normal file
53
mozilla/accessible/tests/mochitest/Makefile.in
Normal file
@ -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/a11y/$(relativesrcdir)
|
||||||
253
mozilla/accessible/tests/mochitest/test_bug368835.xul
Normal file
253
mozilla/accessible/tests/mochitest/test_bug368835.xul
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||||
|
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||||
|
type="text/css"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Bug 368835 - fire TreeViewChanged/TreeRowCountChanged events.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
|
title="Mozilla Bug 368835">
|
||||||
|
|
||||||
|
<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() { }
|
||||||
|
|
||||||
|
inTreeView.prototype =
|
||||||
|
{
|
||||||
|
mRowCount: 0,
|
||||||
|
mTree: null,
|
||||||
|
mData: {},
|
||||||
|
|
||||||
|
get rowCount() { return this.mRowCount; },
|
||||||
|
setTree: function(aTree) { this.mTree = aTree; },
|
||||||
|
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) {},
|
||||||
|
getParentIndex: function(aRowIndex) { },
|
||||||
|
hasNextSibling: function(aRowIndex, aAfterIndex) { },
|
||||||
|
getLevel: function(aIndex) {},
|
||||||
|
getImageSrc: function(aRow, aCol) {},
|
||||||
|
getProgressMode: function(aRow, aCol) {},
|
||||||
|
getCellValue: function(aRow, aCol) {},
|
||||||
|
isContainer: function(aIndex) {},
|
||||||
|
isContainerOpen: function(aIndex) {},
|
||||||
|
isContainerEmpty: function(aIndex) {},
|
||||||
|
isSeparator: function(aIndex) {},
|
||||||
|
isSorted: function() {},
|
||||||
|
toggleOpenState: function(aIndex) {},
|
||||||
|
selectionChanged: function() {},
|
||||||
|
cycleHeader: function(aCol) {},
|
||||||
|
cycleCell: function(aRow, aCol) {},
|
||||||
|
isEditable: function(aRow, aCol) {},
|
||||||
|
isSelectable: function(aRow, aCol) {},
|
||||||
|
setCellValue: function(aRow, aCol, aValue) {},
|
||||||
|
setCellText: function(aRow, aCol, aValue) { },
|
||||||
|
performAction: function(aAction) {},
|
||||||
|
performActionOnRow: function(aAction, aRow) {},
|
||||||
|
performActionOnCell: function(aAction, aRow, aCol) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
var gTreeViewChanged = false;
|
||||||
|
function TreeViewChangedHandler(aEvent)
|
||||||
|
{
|
||||||
|
gTreeViewChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var gTreeRowCountChanged = false;
|
||||||
|
function TreeRowCountChangedHandler(aEvent)
|
||||||
|
{
|
||||||
|
gTreeRowCountChanged = true;
|
||||||
|
|
||||||
|
var index = aEvent.getData("index");
|
||||||
|
is(index, 0, "Wrong 'index' data of 'treeRowCountChanged' event.");
|
||||||
|
|
||||||
|
var count = aEvent.getData("count");
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
// 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(gTreeColumnInvalidated,
|
||||||
|
"TreeInvalidated event should have been fired for InvalidateColumn().");
|
||||||
|
ok(gTreeRowInvalidated,
|
||||||
|
"TreeInvalidated event should have been fired for InvalidateRow().");
|
||||||
|
|
||||||
|
document.removeEventListener("TreeViewChanged",
|
||||||
|
TreeViewChangedHandler, true);
|
||||||
|
|
||||||
|
document.removeEventListener("TreeRowCountChanged",
|
||||||
|
TreeRowCountChangedHandler, true);
|
||||||
|
|
||||||
|
document.removeEventListener("TreeInvalidated",
|
||||||
|
TreeInvalidatedHandler, true);
|
||||||
|
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
var gAccService = null;
|
||||||
|
|
||||||
|
function doTest()
|
||||||
|
{
|
||||||
|
// Check whether accessbility support is enabled.
|
||||||
|
if (!("@mozilla.org/accessibleRetrieval;1" in Components.classes)) {
|
||||||
|
SimpleTest.finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Activate accessibility, otherwise events aren't fired.
|
||||||
|
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;
|
||||||
|
|
||||||
|
// Fire 'TreeRowCountChanged' changed
|
||||||
|
++view.mRowCount;
|
||||||
|
treeBox.rowCountChanged(0, 1);
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
addLoadEvent(doTest);
|
||||||
|
]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<a target="_blank"
|
||||||
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=368835">
|
||||||
|
Mozilla Bug 368835
|
||||||
|
</a>
|
||||||
|
<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>
|
||||||
|
</window>
|
||||||
|
|
||||||
@ -57,11 +57,15 @@ _SERV_FILES = \
|
|||||||
runtests.py \
|
runtests.py \
|
||||||
gen_template.pl \
|
gen_template.pl \
|
||||||
server.js \
|
server.js \
|
||||||
|
harness-a11y.xul \
|
||||||
|
harness-overlay.xul \
|
||||||
harness.xul \
|
harness.xul \
|
||||||
browser-test-overlay.xul \
|
browser-test-overlay.xul \
|
||||||
browser-test.js \
|
browser-test.js \
|
||||||
browser-harness.xul \
|
browser-harness.xul \
|
||||||
|
redirect-a11y.html \
|
||||||
redirect.html \
|
redirect.html \
|
||||||
|
redirect.js \
|
||||||
$(topsrcdir)/netwerk/test/httpserver/httpd.js \
|
$(topsrcdir)/netwerk/test/httpserver/httpd.js \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|||||||
15
mozilla/testing/mochitest/harness-a11y.xul
Normal file
15
mozilla/testing/mochitest/harness-a11y.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 = "a11y";
|
||||||
|
</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://global/skin" type="text/css"?>
|
||||||
<?xml-stylesheet href="chrome://mochikit/content/static/harness.css"
|
<?xml-stylesheet href="chrome://mochikit/content/static/harness.css"
|
||||||
type="text/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");
|
|
||||||
|
|
||||||
/** load server.js in so we can share template functions **/
|
<?xul-overlay href="chrome://mochikit/content/harness-overlay.xul"?>
|
||||||
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 **/
|
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
srvScope.makeTags();
|
title="Chrome Test Harness"
|
||||||
var [links, count] = srvScope.list("chrome://mochikit/content/chrome/",
|
id="browserTestOverlay"
|
||||||
chromeDir, true);
|
aonload="loadTests('chrome');">
|
||||||
var listContent = srvScope.linksToListItems(links);
|
<script type="text/javascript">
|
||||||
var tableContent = srvScope.linksToTableRows(links);
|
gDir = "chrome";
|
||||||
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);
|
|
||||||
]]>
|
|
||||||
</script>
|
</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>
|
</window>
|
||||||
|
|||||||
14
mozilla/testing/mochitest/redirect-a11y.html
Normal file
14
mozilla/testing/mochitest/redirect-a11y.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-a11y.xul");
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
redirecting...
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -2,18 +2,10 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>redirecting...</title>
|
<title>redirecting...</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="redirect.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
redirect("chrome://mochikit/content/harness.xul");
|
||||||
|
|
||||||
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>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<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_SERVER_HOST => "localhost:8888";
|
||||||
use constant TEST_PATH => "/tests/";
|
use constant TEST_PATH => "/tests/";
|
||||||
use constant CHROME_PATH => "/redirect.html";
|
use constant CHROME_PATH => "/redirect.html";
|
||||||
|
use constant A11Y_PATH => "/redirect-a11y.html";
|
||||||
use constant TESTS_URL => "http://" . TEST_SERVER_HOST . TEST_PATH;
|
use constant TESTS_URL => "http://" . TEST_SERVER_HOST . TEST_PATH;
|
||||||
use constant CHROMETESTS_URL => "http://" . TEST_SERVER_HOST . CHROME_PATH;
|
use constant CHROMETESTS_URL => "http://" . TEST_SERVER_HOST . CHROME_PATH;
|
||||||
|
use constant A11YTESTS_URL => "http://" . TEST_SERVER_HOST . A11Y_PATH;
|
||||||
|
|
||||||
# Max time in seconds to wait for server startup before tests will fail -- if
|
# 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
|
# this seems big, it's mostly for debug machines where cold startup
|
||||||
@ -164,7 +166,7 @@ my $unixish = (!($is_win32) && !($is_mac));
|
|||||||
sub main {
|
sub main {
|
||||||
my ($close_when_done, $appoverride, $log_path, $autorun,
|
my ($close_when_done, $appoverride, $log_path, $autorun,
|
||||||
$console_level, $file_level, $help, $do_chrome, $test_path,
|
$console_level, $file_level, $help, $do_chrome, $test_path,
|
||||||
$do_browser_chrome, %browser_env, %browser_args);
|
$do_browser_chrome, $do_a11y, %browser_env, %browser_args);
|
||||||
GetOptions("close-when-done!"=> \$close_when_done,
|
GetOptions("close-when-done!"=> \$close_when_done,
|
||||||
"appname:s"=> \$appoverride,
|
"appname:s"=> \$appoverride,
|
||||||
"log-file:s" => \$log_path,
|
"log-file:s" => \$log_path,
|
||||||
@ -174,6 +176,7 @@ sub main {
|
|||||||
"chrome!" => \$do_chrome,
|
"chrome!" => \$do_chrome,
|
||||||
"test-path:s" => \$test_path,
|
"test-path:s" => \$test_path,
|
||||||
"browser-chrome!" => \$do_browser_chrome,
|
"browser-chrome!" => \$do_browser_chrome,
|
||||||
|
"a11y!" => \$do_a11y,
|
||||||
"setenv=s%" => \%browser_env,
|
"setenv=s%" => \%browser_env,
|
||||||
"browser-arg=s%" => \%browser_args,
|
"browser-arg=s%" => \%browser_args,
|
||||||
"help!" => \$help);
|
"help!" => \$help);
|
||||||
@ -213,6 +216,8 @@ sub main {
|
|||||||
# Tests will run from an overlay, no need to load any URL. We'll include
|
# 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.
|
# the test path in the config file so the browser chrome harness can use it.
|
||||||
$url = "about:blank";
|
$url = "about:blank";
|
||||||
|
} elsif ($do_a11y) {
|
||||||
|
$url = A11YTESTS_URL . ($test_path ? $test_path : "") . "?";
|
||||||
} else {
|
} else {
|
||||||
$url = TESTS_URL . ($test_path ? $test_path : "") . "?";
|
$url = TESTS_URL . ($test_path ? $test_path : "") . "?";
|
||||||
}
|
}
|
||||||
@ -259,14 +264,16 @@ sub usage_and_exit {
|
|||||||
print "\n";
|
print "\n";
|
||||||
print "Usage instructons for runtests.pl.\n";
|
print "Usage instructons for runtests.pl.\n";
|
||||||
print "If --log-file is specified, --file-level must be specified as well.\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 --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";
|
print "If --browser-chrome is specified, browser-chrome tests will be run instead of web content tests.\n";
|
||||||
|
print "If --a11y is specified, a11y tests will be run instead of web content tests.";
|
||||||
print "\n\n";
|
print "\n\n";
|
||||||
print "Syntax:\n";
|
print "Syntax:\n";
|
||||||
print " runtests.pl \\\n";
|
print " runtests.pl \\\n";
|
||||||
print " [--autorun] \\\n";
|
print " [--autorun] \\\n";
|
||||||
print " [--chrome] \\\n";
|
print " [--chrome] \\\n";
|
||||||
print " [--browser-chrome] \\\n";
|
print " [--browser-chrome] \\\n";
|
||||||
|
print " [--a11y] \\\n";
|
||||||
print " [--close-when-done] \\\n";
|
print " [--close-when-done] \\\n";
|
||||||
print " [--appname=/path/to/app] \\\n";
|
print " [--appname=/path/to/app] \\\n";
|
||||||
print " [--log-file=/path/to/logfile] \\\n";
|
print " [--log-file=/path/to/logfile] \\\n";
|
||||||
|
|||||||
@ -59,8 +59,10 @@ import commands
|
|||||||
TEST_SERVER_HOST = "localhost:8888"
|
TEST_SERVER_HOST = "localhost:8888"
|
||||||
TEST_PATH = "/tests/"
|
TEST_PATH = "/tests/"
|
||||||
CHROME_PATH = "/redirect.html";
|
CHROME_PATH = "/redirect.html";
|
||||||
|
A11Y_PATH = "/redirect-a11y.html"
|
||||||
TESTS_URL = "http://" + TEST_SERVER_HOST + TEST_PATH
|
TESTS_URL = "http://" + TEST_SERVER_HOST + TEST_PATH
|
||||||
CHROMETESTS_URL = "http://" + TEST_SERVER_HOST + CHROME_PATH
|
CHROMETESTS_URL = "http://" + TEST_SERVER_HOST + CHROME_PATH
|
||||||
|
A11YTESTS_URL = "http://" + TEST_SERVER_HOST + A11Y_PATH
|
||||||
SERVER_SHUTDOWN_URL = "http://" + TEST_SERVER_HOST + "/server/shutdown"
|
SERVER_SHUTDOWN_URL = "http://" + TEST_SERVER_HOST + "/server/shutdown"
|
||||||
|
|
||||||
# Max time in seconds to wait for server startup before tests will fail -- if
|
# 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")
|
help = "run browser chrome Mochitests")
|
||||||
defaults["browserChrome"] = False
|
defaults["browserChrome"] = False
|
||||||
|
|
||||||
|
self.add_option("--a11y",
|
||||||
|
action = "store_true", dest = "a11y",
|
||||||
|
help = "run accessibility Mochitests");
|
||||||
|
|
||||||
self.add_option("--setenv",
|
self.add_option("--setenv",
|
||||||
action = "append", type = "string", dest = "environment",
|
action = "append", type = "string", dest = "environment",
|
||||||
help = "given a VAR=value pair, sets that in the "
|
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
|
testURL = TESTS_URL + options.testPath
|
||||||
if options.chrome:
|
if options.chrome:
|
||||||
testURL = CHROMETESTS_URL + options.testPath
|
testURL = CHROMETESTS_URL + options.testPath
|
||||||
|
elif options.a11y:
|
||||||
|
testURL = A11YTESTS_URL + options.testPath
|
||||||
elif options.browserChrome:
|
elif options.browserChrome:
|
||||||
testURL = "about:blank"
|
testURL = "about:blank"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user