gecko/accessible/tests/mochitest/tree/test_tabbrowser.xul

155 lines
4.2 KiB
Plaintext
Raw Normal View History

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<!-- Firefox tabbrowser -->
<?xml-stylesheet href="chrome://browser/content/browser.css"
type="text/css"?>
<!-- Seamonkey tabbrowser -->
<?xml-stylesheet href="chrome://navigator/content/navigator.css"
type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessible XUL tabbrowser hierarchy tests">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Test
const Ci = Components.interfaces;
// Hack to make xul:tabbrowser work.
Components.utils.import("resource://gre/modules/Services.jsm");
var XULBrowserWindow = {
isBusy: false,
setOverLink: function (link, b) {
}
};
var gFindBar = {
hidden: true
};
function doTest()
{
var tabBrowser = document.getElementById("tabbrowser");
var progressListener =
{
onStateChange: function onStateChange(aWebProgress,
aRequest,
aStateFlags,
aStatus)
{
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
testAccTree();
}
};
tabBrowser.addProgressListener(progressListener,
Ci.nsIWebProgress.NOTIFY_STATE_WINDOW);
tabBrowser.loadTabs(["about:", "about:mozilla"], false, true);
}
function testAccTree()
{
var tabsAccTree = {
role: ROLE_PAGETABLIST,
children: [
{
role: ROLE_PAGETAB,
children: [
{
role: ROLE_PUSHBUTTON
}
]
},
{
role: ROLE_PAGETAB,
children: [
{
role: ROLE_PUSHBUTTON
}
]
},
{
role: ROLE_PUSHBUTTON
},
{
role: ROLE_PUSHBUTTON
}
]
};
var tabboxAccTree = {
role: ROLE_PANE,
children: [
{
role: ROLE_PROPERTYPAGE
},
{
role: ROLE_PROPERTYPAGE
}
]
};
testAccessibleTree(getNode("tabbrowser").tabContainer, tabsAccTree);
testAccessibleTree(getNode("tabbrowser").mTabBox, tabboxAccTree);
SimpleTest.finish()
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<vbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=540389"
title=" WARNING: Bad accessible tree!: [tabbrowser tab] ">
Mozilla Bug 540389
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<!-- Hack to make xul:tabbrowser work -->
<menubar>
<menu label="menu">
<menupopup>
<menuitem label="close window hook" id="menu_closeWindow"/>
<menuitem label="close hook" id="menu_close"/>
</menupopup>
</menu>
</menubar>
<tabs id="tabbrowser-tabs" class="tabbrowser-tabs"
tabbrowser="tabbrowser"
setfocus="false">
<tab class="tabbrowser-tab" selected="true"/>
</tabs>
<tabbrowser id="tabbrowser"
type="content-primary"
tabcontainer="tabbrowser-tabs"
flex="1"/>
</vbox>
</window>