mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 13:56:29 +00:00
Bug 719754 - rewrite events/test_docload.xul, r=marcoz
This commit is contained in:
parent
cae619ec70
commit
8f80f72f4c
@ -75,6 +75,7 @@ _TEST_FILES =\
|
||||
actions.js \
|
||||
attributes.js \
|
||||
autocomplete.js \
|
||||
browser.js \
|
||||
common.js \
|
||||
events.js \
|
||||
grid.js \
|
||||
|
96
accessible/tests/mochitest/browser.js
Normal file
96
accessible/tests/mochitest/browser.js
Normal file
@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Load the browser with the given url and then invokes the given function.
|
||||
*/
|
||||
function openBrowserWindow(aFunc, aURL)
|
||||
{
|
||||
gBrowserContext.testFunc = aFunc;
|
||||
gBrowserContext.startURL = aURL;
|
||||
|
||||
addLoadEvent(openBrowserWindowIntl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the browser window.
|
||||
*/
|
||||
function closeBrowserWindow()
|
||||
{
|
||||
gBrowserContext.browserWnd.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the browser window object.
|
||||
*/
|
||||
function browserWindow()
|
||||
{
|
||||
return gBrowserContext.browserWnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return tab browser object.
|
||||
*/
|
||||
function tabBrowser()
|
||||
{
|
||||
return browserWindow().gBrowser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return browser element of the current tab.
|
||||
*/
|
||||
function currentBrowser()
|
||||
{
|
||||
return tabBrowser().selectedBrowser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return DOM document of the current tab.
|
||||
*/
|
||||
function currentTabDocument()
|
||||
{
|
||||
return currentBrowser().contentDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return input element of address bar.
|
||||
*/
|
||||
function urlbarInput()
|
||||
{
|
||||
return browserWindow().document.getElementById("urlbar").inputField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return reload button.
|
||||
*/
|
||||
function reloadButton()
|
||||
{
|
||||
return browserWindow().document.getElementById("urlbar-reload-button");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// private section
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var gBrowserContext =
|
||||
{
|
||||
browserWnd: null,
|
||||
testFunc: null,
|
||||
startURL: ""
|
||||
};
|
||||
|
||||
function openBrowserWindowIntl()
|
||||
{
|
||||
gBrowserContext.browserWnd =
|
||||
window.openDialog(Services.prefs.getCharPref("browser.chromeURL"),
|
||||
"_blank", "chrome,all,dialog=no",
|
||||
gBrowserContext.startURL);
|
||||
|
||||
addA11yLoadEvent(startBrowserTests, browserWindow());
|
||||
}
|
||||
|
||||
function startBrowserTests()
|
||||
{
|
||||
if (gBrowserContext.startURL) // wait for load
|
||||
addA11yLoadEvent(gBrowserContext.testFunc, currentBrowser().contentWindow);
|
||||
else
|
||||
gBrowserContext.testFunc();
|
||||
}
|
@ -174,7 +174,7 @@ const DO_NOT_FINISH_TEST = 1;
|
||||
* // phase getter: function() {},
|
||||
* //
|
||||
* // * Callback, called to match handled event. *
|
||||
* // match : function() {},
|
||||
* // match : function(aEvent) {},
|
||||
* //
|
||||
* // * Callback, called when event is handled
|
||||
* // check: function(aEvent) {},
|
||||
@ -1340,10 +1340,10 @@ function caretMoveChecker(aCaretOffset, aTargetOrFunc, aTargetFuncArg)
|
||||
* State change checker.
|
||||
*/
|
||||
function stateChangeChecker(aState, aIsExtraState, aIsEnabled,
|
||||
aTargetOrFunc, aTargetFuncArg)
|
||||
aTargetOrFunc, aTargetFuncArg, aIsAsync)
|
||||
{
|
||||
this.__proto__ = new invokerChecker(EVENT_STATE_CHANGE, aTargetOrFunc,
|
||||
aTargetFuncArg);
|
||||
aTargetFuncArg, aIsAsync);
|
||||
|
||||
this.check = function stateChangeChecker_check(aEvent)
|
||||
{
|
||||
@ -1370,6 +1370,22 @@ function stateChangeChecker(aState, aIsExtraState, aIsEnabled,
|
||||
var unxpdExtraState = aIsEnabled ? 0 : (aIsExtraState ? aState : 0);
|
||||
testStates(event.accessible, state, extraState, unxpdState, unxpdExtraState);
|
||||
}
|
||||
|
||||
this.match = function stateChangeChecker_match(aEvent)
|
||||
{
|
||||
if (aEvent instanceof nsIAccessibleStateChangeEvent) {
|
||||
var scEvent = aEvent.QueryInterface(nsIAccessibleStateChangeEvent);
|
||||
return aEvent.accessible = this.target && scEvent.state == aState;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function asyncStateChangeChecker(aState, aIsExtraState, aIsEnabled,
|
||||
aTargetOrFunc, aTargetFuncArg)
|
||||
{
|
||||
this.__proto__ = new stateChangeChecker(aState, aIsExtraState, aIsEnabled,
|
||||
aTargetOrFunc, aTargetFuncArg, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ relativesrcdir = accessible/events
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# test_docload.xul, docload_wnd.xul, test_scroll.xul disabled for misusing <tabbrowser> (bug 715857)
|
||||
# test_scroll.xul disabled for misusing <tabbrowser> (bug 715857)
|
||||
|
||||
_TEST_FILES =\
|
||||
docload_wnd.html \
|
||||
@ -61,6 +61,7 @@ _TEST_FILES =\
|
||||
test_coalescence.html \
|
||||
test_contextmenu.html \
|
||||
test_docload.html \
|
||||
test_docload.xul \
|
||||
test_dragndrop.html \
|
||||
test_flush.html \
|
||||
test_focus_aria_activedescendant.html \
|
||||
|
@ -1,275 +0,0 @@
|
||||
<?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"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// SimpleTest stuffs
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
function testStates(aAccOrElmOrID, aState, aExtraState, aAbsentState,
|
||||
aAbsentExtraState)
|
||||
{
|
||||
gOpenerWnd.testStates(aAccOrElmOrID, aState, aExtraState, aAbsentState,
|
||||
aAbsentExtraState);
|
||||
}
|
||||
|
||||
var invokerChecker = gOpenerWnd.invokerChecker;
|
||||
var asyncInvokerChecker = gOpenerWnd.asyncInvokerChecker;
|
||||
|
||||
const STATE_BUSY = gOpenerWnd.STATE_BUSY;
|
||||
const EVENT_DOCUMENT_LOAD_COMPLETE =
|
||||
gOpenerWnd.EVENT_DOCUMENT_LOAD_COMPLETE;
|
||||
const EVENT_DOCUMENT_RELOAD = gOpenerWnd.EVENT_DOCUMENT_RELOAD;
|
||||
const EVENT_DOCUMENT_LOAD_STOPPED =
|
||||
gOpenerWnd.EVENT_DOCUMENT_LOAD_STOPPED;
|
||||
const EVENT_REORDER = gOpenerWnd.EVENT_REORDER;
|
||||
const EVENT_STATE_CHANGE = gOpenerWnd.EVENT_STATE_CHANGE;
|
||||
const nsIAccessibleStateChangeEvent =
|
||||
gOpenerWnd.nsIAccessibleStateChangeEvent;
|
||||
|
||||
//gOpenerWnd.gA11yEventDumpToConsole = true; // debug
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// 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;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers.
|
||||
|
||||
function getContainer()
|
||||
{
|
||||
var idx = gTabBrowser.tabContainer.selectedIndex;
|
||||
return gTabBrowser.getBrowserAtIndex(idx);
|
||||
}
|
||||
|
||||
function getDocument()
|
||||
{
|
||||
return getContainer().contentDocument;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Invoker checkers.
|
||||
function stateBusyChecker(aIsEnabled)
|
||||
{
|
||||
this.type = EVENT_STATE_CHANGE;
|
||||
this.__defineGetter__("target", getDocument);
|
||||
|
||||
this.check = function stateBusyChecker_check(aEvent)
|
||||
{
|
||||
var event = null;
|
||||
try {
|
||||
var event = aEvent.QueryInterface(nsIAccessibleStateChangeEvent);
|
||||
} catch (e) {
|
||||
ok(false, "State change event was expected");
|
||||
}
|
||||
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
is(event.state, STATE_BUSY, "Wrong state of statechange event.");
|
||||
is(event.isEnabled(), aIsEnabled,
|
||||
"Wrong value of state of statechange event");
|
||||
|
||||
testStates(event.accessible, (aIsEnabled ? STATE_BUSY : 0), 0,
|
||||
(aIsEnabled ? 0 : STATE_BUSY), 0);
|
||||
}
|
||||
}
|
||||
|
||||
function documentReloadChecker(aIsFromUserInput)
|
||||
{
|
||||
this.type = EVENT_DOCUMENT_RELOAD;
|
||||
this.__defineGetter__("target", getDocument);
|
||||
|
||||
this.check = function documentReloadChecker_check(aEvent)
|
||||
{
|
||||
is(aEvent.isFromUserInput, aIsFromUserInput,
|
||||
"Wrong value of isFromUserInput");
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Invokers.
|
||||
|
||||
/**
|
||||
* Load URI.
|
||||
*/
|
||||
function loadURIInvoker(aURI)
|
||||
{
|
||||
this.invoke = function loadURIInvoker_invoke()
|
||||
{
|
||||
gTabBrowser.loadURI(aURI);
|
||||
}
|
||||
|
||||
this.eventSeq = [
|
||||
// We don't expect state change event for busy true since things happen
|
||||
// quickly and it's coalesced.
|
||||
new asyncInvokerChecker(EVENT_REORDER, getContainer),
|
||||
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, getDocument),
|
||||
new stateBusyChecker(false)
|
||||
];
|
||||
|
||||
this.getID = function loadURIInvoker_getID()
|
||||
{
|
||||
return "load uri " + aURI;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Click reload page button.
|
||||
*/
|
||||
function clickReloadBtnInvoker()
|
||||
{
|
||||
this.invoke = function clickReloadBtnInvoker_invoke()
|
||||
{
|
||||
synthesizeMouse(document.getElementById("reloadbtn"), 5, 5, {});
|
||||
}
|
||||
|
||||
this.eventSeq = [
|
||||
new documentReloadChecker(true),
|
||||
new asyncInvokerChecker(EVENT_REORDER, getContainer),
|
||||
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, getDocument),
|
||||
new stateBusyChecker(false)
|
||||
];
|
||||
|
||||
this.getID = function reloadInvoker_getID()
|
||||
{
|
||||
return "click reload page button";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload the page.
|
||||
*/
|
||||
function reloadInvoker()
|
||||
{
|
||||
this.invoke = function reloadInvoker_invoke()
|
||||
{
|
||||
gTabBrowser.reload();
|
||||
}
|
||||
|
||||
this.eventSeq = [
|
||||
new documentReloadChecker(false),
|
||||
new asyncInvokerChecker(EVENT_REORDER, getContainer),
|
||||
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, getDocument),
|
||||
new stateBusyChecker(false)
|
||||
];
|
||||
|
||||
this.getID = function reloadInvoker_getID()
|
||||
{
|
||||
return "reload page";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load wrong URI what results in error page loading.
|
||||
*/
|
||||
function loadErrorPageInvoker(aURL, aURLDescr)
|
||||
{
|
||||
this.invoke = function loadErrorPageInvoker_invoke()
|
||||
{
|
||||
gTabBrowser.loadURI(aURL);
|
||||
}
|
||||
|
||||
this.eventSeq = [
|
||||
// We don't expect state change for busy true, load stopped events since
|
||||
// things happen quickly and it's coalesced.
|
||||
new asyncInvokerChecker(EVENT_REORDER, getContainer),
|
||||
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, getDocument),
|
||||
new stateBusyChecker(false)
|
||||
];
|
||||
|
||||
this.getID = function loadErrorPageInvoker_getID()
|
||||
{
|
||||
return "load error page: '" + aURLDescr + "'";
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Tests
|
||||
|
||||
var gQueue = null;
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
var gTabBrowser = null;
|
||||
function doTest()
|
||||
{
|
||||
gTabBrowser = document.getElementById("content");
|
||||
|
||||
gQueue = new gOpenerWnd.eventQueue();
|
||||
gQueue.push(new loadURIInvoker("about:"));
|
||||
gQueue.push(new clickReloadBtnInvoker());
|
||||
gQueue.push(new loadURIInvoker("about:mozilla"));
|
||||
gQueue.push(new reloadInvoker());
|
||||
gQueue.push(new loadErrorPageInvoker("www.wronguri.wronguri",
|
||||
"Server not found"));
|
||||
gQueue.push(new loadErrorPageInvoker("https://nocert.example.com:443",
|
||||
"Untrusted Connection"));
|
||||
|
||||
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>
|
||||
|
||||
<button id="reloadbtn" label="reload page"
|
||||
oncommand="gTabBrowser.reload();"/>
|
||||
|
||||
<toolbar>
|
||||
<tabs id="tabbrowser-tabs" class="tabbrowser-tabs"
|
||||
tabbrowser="content"
|
||||
flex="1"
|
||||
setfocus="false">
|
||||
<tab class="tabbrowser-tab" selected="true"/>
|
||||
</tabs>
|
||||
</toolbar>
|
||||
<tabbrowser id="content"
|
||||
type="content-primary"
|
||||
tabcontainer="tabbrowser-tabs"
|
||||
flex="1"/>
|
||||
|
||||
</window>
|
@ -19,20 +19,172 @@
|
||||
src="../states.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../events.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../browser.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
// var gA11yEventDumpID = "eventdump"; // debug stuff
|
||||
|
||||
function doTest()
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Invoker checkers.
|
||||
function stateBusyChecker(aIsEnabled)
|
||||
{
|
||||
var w = window.openDialog("../events/docload_wnd.xul",
|
||||
"docload_test",
|
||||
"chrome,width=600,height=600");
|
||||
this.type = EVENT_STATE_CHANGE;
|
||||
this.__defineGetter__("target", currentTabDocument);
|
||||
|
||||
this.check = function stateBusyChecker_check(aEvent)
|
||||
{
|
||||
var event = null;
|
||||
try {
|
||||
var event = aEvent.QueryInterface(nsIAccessibleStateChangeEvent);
|
||||
} catch (e) {
|
||||
ok(false, "State change event was expected");
|
||||
}
|
||||
|
||||
if (!event)
|
||||
return;
|
||||
|
||||
is(event.state, STATE_BUSY, "Wrong state of statechange event.");
|
||||
is(event.isEnabled(), aIsEnabled,
|
||||
"Wrong value of state of statechange event");
|
||||
|
||||
testStates(event.accessible, (aIsEnabled ? STATE_BUSY : 0), 0,
|
||||
(aIsEnabled ? 0 : STATE_BUSY), 0);
|
||||
}
|
||||
}
|
||||
|
||||
function documentReloadChecker(aIsFromUserInput)
|
||||
{
|
||||
this.type = EVENT_DOCUMENT_RELOAD;
|
||||
this.__defineGetter__("target", currentTabDocument);
|
||||
|
||||
this.check = function documentReloadChecker_check(aEvent)
|
||||
{
|
||||
is(aEvent.isFromUserInput, aIsFromUserInput,
|
||||
"Wrong value of isFromUserInput");
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Invokers.
|
||||
|
||||
/**
|
||||
* Load URI.
|
||||
*/
|
||||
function loadURIInvoker(aURI)
|
||||
{
|
||||
this.invoke = function loadURIInvoker_invoke()
|
||||
{
|
||||
tabBrowser().loadURI(aURI);
|
||||
}
|
||||
|
||||
this.eventSeq = [
|
||||
// We don't expect state change event for busy true since things happen
|
||||
// quickly and it's coalesced.
|
||||
new asyncInvokerChecker(EVENT_REORDER, currentBrowser),
|
||||
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument),
|
||||
new stateBusyChecker(false)
|
||||
];
|
||||
|
||||
this.getID = function loadURIInvoker_getID()
|
||||
{
|
||||
return "load uri " + aURI;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload the page by F5 (isFromUserInput flag is true).
|
||||
*/
|
||||
function userReloadInvoker()
|
||||
{
|
||||
this.invoke = function userReloadInvoker_invoke()
|
||||
{
|
||||
synthesizeKey("VK_F5", {}, browserWindow());
|
||||
}
|
||||
|
||||
this.eventSeq = [
|
||||
new documentReloadChecker(true),
|
||||
new asyncInvokerChecker(EVENT_REORDER, currentBrowser),
|
||||
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument),
|
||||
new stateBusyChecker(false)
|
||||
];
|
||||
|
||||
this.getID = function userReloadInvoker_getID()
|
||||
{
|
||||
return "user reload page";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload the page (isFromUserInput flag is false).
|
||||
*/
|
||||
function reloadInvoker()
|
||||
{
|
||||
this.invoke = function reloadInvoker_invoke()
|
||||
{
|
||||
tabBrowser().reload();
|
||||
}
|
||||
|
||||
this.eventSeq = [
|
||||
new documentReloadChecker(false),
|
||||
new asyncInvokerChecker(EVENT_REORDER, currentBrowser),
|
||||
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument),
|
||||
new stateBusyChecker(false)
|
||||
];
|
||||
|
||||
this.getID = function reloadInvoker_getID()
|
||||
{
|
||||
return "reload page";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load wrong URI what results in error page loading.
|
||||
*/
|
||||
function loadErrorPageInvoker(aURL, aURLDescr)
|
||||
{
|
||||
this.invoke = function loadErrorPageInvoker_invoke()
|
||||
{
|
||||
tabBrowser().loadURI(aURL);
|
||||
}
|
||||
|
||||
this.eventSeq = [
|
||||
// We don't expect state change for busy true, load stopped events since
|
||||
// things happen quickly and it's coalesced.
|
||||
new asyncInvokerChecker(EVENT_REORDER, currentBrowser),
|
||||
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument),
|
||||
new stateBusyChecker(false)
|
||||
];
|
||||
|
||||
this.getID = function loadErrorPageInvoker_getID()
|
||||
{
|
||||
return "load error page: '" + aURLDescr + "'";
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Tests
|
||||
|
||||
gA11yEventDumpToConsole = true; // debug
|
||||
|
||||
var gQueue = null;
|
||||
function doTests()
|
||||
{
|
||||
gQueue = new eventQueue();
|
||||
gQueue.push(new loadURIInvoker("about:"));
|
||||
gQueue.push(new userReloadInvoker());
|
||||
gQueue.push(new loadURIInvoker("about:mozilla"));
|
||||
gQueue.push(new reloadInvoker());
|
||||
gQueue.push(new loadErrorPageInvoker("www.wronguri.wronguri",
|
||||
"Server not found"));
|
||||
gQueue.push(new loadErrorPageInvoker("https://nocert.example.com:443",
|
||||
"Untrusted Connection"));
|
||||
|
||||
gQueue.onFinish = function() { closeBrowserWindow(); }
|
||||
gQueue.invoke();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(doTest);
|
||||
openBrowserWindow(doTests);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
|
@ -19,40 +19,20 @@
|
||||
src="../states.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../events.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../browser.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers
|
||||
|
||||
function tabBrowser()
|
||||
{
|
||||
return gBrowserWnd.gBrowser;
|
||||
}
|
||||
|
||||
function currentBrowser()
|
||||
{
|
||||
return tabBrowser().selectedBrowser;
|
||||
}
|
||||
|
||||
function currentTabDocument()
|
||||
{
|
||||
return currentBrowser().contentDocument;
|
||||
}
|
||||
|
||||
function inputInDocument()
|
||||
{
|
||||
var tabdoc = currentTabDocument();
|
||||
return tabdoc.getElementById("input");
|
||||
}
|
||||
|
||||
function urlbarInput()
|
||||
{
|
||||
return gBrowserWnd.document.getElementById("urlbar").inputField;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Invokers
|
||||
|
||||
@ -96,22 +76,6 @@
|
||||
var gInputDocURI = "data:text/html,<html><input id='input'></html>";
|
||||
var gButtonDocURI = "data:text/html,<html><input id='input' type='button' value='button'></html>";
|
||||
|
||||
var gBrowserWnd = null;
|
||||
function loadBrowser()
|
||||
{
|
||||
gBrowserWnd = window.openDialog(Services.prefs.getCharPref("browser.chromeURL"),
|
||||
"_blank", "chrome,all,dialog=no", gInputDocURI);
|
||||
|
||||
addA11yLoadEvent(startTests, gBrowserWnd);
|
||||
}
|
||||
|
||||
function startTests()
|
||||
{
|
||||
// Wait for tab load.
|
||||
var browser = gBrowserWnd.gBrowser.selectedBrowser;
|
||||
addA11yLoadEvent(doTests, browser.contentWindow);
|
||||
}
|
||||
|
||||
//gA11yEventDumpToConsole = true; // debug
|
||||
|
||||
var gQueue = null;
|
||||
@ -123,7 +87,8 @@
|
||||
var input = inputInDocument();
|
||||
|
||||
// move focus to input inside tab document
|
||||
gQueue.push(new synthTab(tabDocument, new focusChecker(input), gBrowserWnd));
|
||||
gQueue.push(new synthTab(tabDocument, new focusChecker(input),
|
||||
browserWindow()));
|
||||
|
||||
// open new url, focus moves to new document
|
||||
gQueue.push(new loadURI(gButtonDocURI));
|
||||
@ -132,22 +97,22 @@
|
||||
gQueue.push(new goBack());
|
||||
|
||||
// open new tab, focus moves to urlbar
|
||||
gQueue.push(new synthKey(tabDocument, "t", { ctrlKey: true, window: gBrowserWnd },
|
||||
gQueue.push(new synthKey(tabDocument, "t", { ctrlKey: true, window: browserWindow() },
|
||||
new focusChecker(urlbarInput)));
|
||||
|
||||
// close open tab, focus goes on input of tab document
|
||||
gQueue.push(new synthKey(tabDocument, "w", { ctrlKey: true, window: gBrowserWnd },
|
||||
gQueue.push(new synthKey(tabDocument, "w", { ctrlKey: true, window: browserWindow() },
|
||||
new focusChecker(inputInDocument)));
|
||||
|
||||
gQueue.onFinish = function()
|
||||
{
|
||||
gBrowserWnd.close();
|
||||
closeBrowserWindow();
|
||||
}
|
||||
gQueue.invoke();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(loadBrowser);
|
||||
openBrowserWindow(doTests, gInputDocURI);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
|
@ -37,9 +37,11 @@ const STATE_UNAVAILABLE = nsIAccessibleStates.STATE_UNAVAILABLE;
|
||||
const EXT_STATE_ACTIVE = nsIAccessibleStates.EXT_STATE_ACTIVE;
|
||||
const EXT_STATE_DEFUNCT = nsIAccessibleStates.EXT_STATE_DEFUNCT;
|
||||
const EXT_STATE_EDITABLE = nsIAccessibleStates.EXT_STATE_EDITABLE;
|
||||
const EXT_STATE_ENABLED = nsIAccessibleStates.EXT_STATE_ENABLED;
|
||||
const EXT_STATE_EXPANDABLE = nsIAccessibleStates.EXT_STATE_EXPANDABLE;
|
||||
const EXT_STATE_HORIZONTAL = nsIAccessibleStates.EXT_STATE_HORIZONTAL;
|
||||
const EXT_STATE_MULTI_LINE = nsIAccessibleStates.EXT_STATE_MULTI_LINE;
|
||||
const EXT_STATE_SENSITIVE = nsIAccessibleStates.EXT_STATE_SENSITIVE;
|
||||
const EXT_STATE_SINGLE_LINE = nsIAccessibleStates.EXT_STATE_SINGLE_LINE;
|
||||
const EXT_STATE_STALE = nsIAccessibleStates.EXT_STATE_STALE;
|
||||
const EXT_STATE_SUPPORTS_AUTOCOMPLETION =
|
||||
|
Loading…
x
Reference in New Issue
Block a user