gecko/accessible/tests/mochitest/jsat/test_content_integration.html

243 lines
8.2 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<title>Tests AccessFu content integration</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
</script>
<script type="application/javascript"
src="chrome://mochikit/content/chrome-harness.js">
</script>
<script type="application/javascript" src="../common.js"></script>
<script type="application/javascript" src="../browser.js"></script>
<script type="application/javascript" src="../events.js"></script>
<script type="application/javascript" src="../role.js"></script>
<script type="application/javascript" src="../states.js"></script>
<script type="application/javascript" src="../layout.js"></script>
<script type="application/javascript" src="jsatcommon.js"></script>
<script type="application/javascript">
function doTest() {
var doc = currentTabDocument();
var iframe = doc.createElement("iframe");
iframe.mozbrowser = true;
iframe.addEventListener("mozbrowserloadend", function () {
var contentTest = new AccessFuContentTest(
[
// Simple traversal forward
[ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document'
}],
[ContentMessages.simpleMoveNext, {
speak: 'wow heading level 1 such app'
}],
[ContentMessages.simpleMoveNext, {
speak: 'many option not checked check button'
}],
// check checkbox
[ContentMessages.activateCurrent(), {
speak: 'checked'
}],
[null, {
speak: 'checked',
speak_checkFunc: 'todo_isnot'
}],
[ContentMessages.simpleMoveNext, {
speak: 'much range label'
}],
[ContentMessages.simpleMoveNext, {
speak: 'much range 5 slider'
}],
[ContentMessages.adjustRangeUp,
{ speak: '6'}],
[ContentMessages.simpleMoveNext, {
speak: 'Home button'
}],
// Simple traversal backward
[ContentMessages.simpleMovePrevious, {
speak: 'much range 6 slider such app'
}],
[ContentMessages.adjustRangeDown,
{ speak: '5'}],
[ContentMessages.simpleMovePrevious, {
speak: 'much range label'
}],
[ContentMessages.simpleMovePrevious, {
speak: 'many option checked check button'
}],
// uncheck checkbox
[ContentMessages.activateCurrent(), {
speak: 'unchecked'
}],
[null, {
speak: 'unchecked',
speak_checkFunc: 'todo_isnot'
}],
[ContentMessages.simpleMovePrevious, {
speak: 'wow heading level 1'
}],
[ContentMessages.simpleMovePrevious, {
speak: 'Phone status bar'
}],
// Moving to the absolute last item from an embedded document
// fails. Bug 972035.
[ContentMessages.simpleMoveNext, {
speak: 'wow heading level 1 such app'
}],
// Move from an inner frame to the last element in the parent doc
[ContentMessages.simpleMoveLast, {
speak: 'Home button',
speak_checkFunc: 'todo_is'
}],
[ContentMessages.clearCursor, null], // Reset cursors
// Moving to the absolute first item from an embedded document
// fails. Bug 972035.
[ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document'
}],
[ContentMessages.simpleMoveNext, {
speak: 'wow heading level 1 such app'
}],
[ContentMessages.simpleMoveNext, {
speak: 'many option not checked check button'
}],
[ContentMessages.simpleMoveFirst, {
speak: 'Phone status bar',
speak_checkFunc: 'todo_is'
}],
// Reset cursors
[ContentMessages.clearCursor, null],
// Move cursor with focus in outside document
[ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document'
}],
[ContentMessages.focusSelector('button#home', false), {
speak: 'Home button'
}],
// Blur button and reset cursor
[ContentMessages.focusSelector('button#home', true), null],
[ContentMessages.clearCursor, null],
// Set focus on element outside of embedded frame while
// cursor is in frame
[ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document'
}],
[ContentMessages.simpleMoveNext, {
speak: 'wow heading level 1 such app'
}],
[ContentMessages.focusSelector('button#home', false), {
speak: 'Home button'
}]
// Blur button and reset cursor
[ContentMessages.focusSelector('button#home', true), null],
[ContentMessages.clearCursor, null],
// XXX: Set focus on iframe itself.
// XXX: Set focus on element in iframe when cursor is outside of it.
// XXX: Set focus on element in iframe when cursor is in iframe.
// Open dialog in outer doc, while cursor is also in outer doc
[ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document'
}],
[doc.defaultView.showAlert, {
speak: 'This is an alert! heading level 1 dialog'
}],
[function() {
doc.defaultView.hideAlert()
}, {
speak: 'wow heading level 1 such app'
}],
[ContentMessages.clearCursor, null],
// Open dialog in outer doc, while cursor is in inner frame
[ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document'
}],
[ContentMessages.simpleMoveNext, {
speak: 'wow heading level 1 such app'
}],
[doc.defaultView.showAlert, {
speak: 'This is an alert! heading level 1 dialog'
}],
// XXX: Place cursor back where it was.
[doc.defaultView.hideAlert, {
speak: 'many option not checked check button such app'
}],
[ContentMessages.clearCursor, null],
// Open dialog, then focus on something when closing
[ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document'
}],
[doc.defaultView.showAlert, {
speak: 'This is an alert! heading level 1 dialog'
}],
[function() {
doc.defaultView.hideAlert();
doc.querySelector('button#home').focus();
}, {
speak: 'Home button Traversal Rule test document'
}]
]);
contentTest.start(function () {
closeBrowserWindow();
SimpleTest.finish();
});
});
iframe.src = 'data:text/html;charset=utf-8,' + doc.defaultView.frameContents;
doc.getElementById('appframe').appendChild(iframe);
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(
function () {
openBrowserWindow(
function () {
SpecialPowers.pushPrefEnv({
"set": [
// TODO: remove this as part of bug 820712
["network.disable.ipc.security", true],
["dom.ipc.browser_frames.oop_by_default", true],
["dom.mozBrowserFramesEnabled", true],
["browser.pagethumbnails.capturing_disabled", true]
]
}, doTest) },
getRootDirectory(window.location.href) + "doc_content_integration.html");
});
</script>
</head>
<body id="body">
<a target="_blank"
title="Add tests for OOP message handling and general integration"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=972047">Mozilla Bug 933808</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
</body>
</html>