gecko/accessible/tests/mochitest/name/nsRootAcc_wnd.xul

126 lines
3.5 KiB
XML

<?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"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript">
<![CDATA[
var gOpenerWnd = window.opener.wrappedJSObject;
function ok(aCond, aMsg) {
gOpenerWnd.SimpleTest.ok(aCond, aMsg);
}
function is(aExpected, aActual, aMsg) {
gOpenerWnd.SimpleTest.is(aExpected, aActual, aMsg);
}
// Hacks to make xul:tabbrowser work.
var handleDroppedLink = null; // needed for tabbrowser usage
Components.utils.import("resource://gre/modules/Services.jsm");
var XULBrowserWindow = {
isBusy: false,
setOverLink: function (link, b) {
}
};
gFindBarInitialized = false;
////////////////////////////////////////////////////////////////////////////
// Invoker implementation.
function switchTabSelectChecker(aInvoker)
{
this.type = "select";
Object.defineProperty(this, "target", { get: function() { return aInvoker.getTabsElm(); }});
this.getID = function() { return "switch tab, select event"; }
}
function switchTabFocusChecker(aInvoker)
{
this.type = gOpenerWnd.EVENT_FOCUS;
Object.defineProperty(this, "target", { get: function() { return aInvoker.getContentDoc(); }});
this.check = function(aEvent)
{
is(gOpenerWnd.getAccessible(document).name, "about:mozilla" + aEvent.accessible.name,
"Oops almost :)");
}
this.getID = function() { return "switch tab, focus event"; }
}
function switchTabInvoker(aTabBrowser, aWindow)
{
this.invoke = function switchTabInvoker_invoke()
{
gOpenerWnd.synthesizeKey("VK_TAB", { ctrlKey: true }, aWindow);
}
this.eventSeq = [
new switchTabSelectChecker(this),
new switchTabFocusChecker(this)
];
this.getContentDoc = function switchTabInvoker_getContentDoc()
{
return aTabBrowser.getBrowserAtIndex(1).contentDocument;
}
this.getTabsElm = function switchTabInvoker_getTabsElm()
{
return aTabBrowser.tabContainer;
}
}
////////////////////////////////////////////////////////////////////////////
// Tests
var gQueue = null;
const Ci = Components.interfaces;
function doTest()
{
var tabBrowser = document.getElementById("content");
tabBrowser.loadURI("about:");
tabBrowser.addTab("about:mozilla");
gQueue = new gOpenerWnd.eventQueue();
gQueue.push(new switchTabInvoker(tabBrowser, window));
gQueue.onFinish = function() { window.close(); }
gQueue.invoke();
}
gOpenerWnd.addA11yLoadEvent(doTest);
]]>
</script>
<!-- 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="content"
flex="1"
setfocus="false">
<tab class="tabbrowser-tab" selected="true"/>
</tabs>
<tabbrowser id="content"
type="content-primary"
tabcontainer="tabbrowser-tabs"
flex="1"/>
</window>