Bug 1543575 - add fission coverage for accessibility b-c e10s tree update tests. r=Jamie

Differential Revision: https://phabricator.services.mozilla.com/D48552

--HG--
extra : rebase_source : d674efca44b5a6d11dbc371f3866d8dc87ab3ba4
extra : source : 2dbafadffbd9114592c927136992571d57b86bae
This commit is contained in:
Yura Zenevich 2019-10-17 15:15:18 +00:00
Родитель fcf58d51e6
Коммит c8dd78f635
20 изменённых файлов: 647 добавлений и 595 удалений

Просмотреть файл

@ -23,8 +23,6 @@ skip-if = (os == "linux" && bits == 64) || (debug && os == "mac") || (debug && o
[browser_caching_value.js]
skip-if = fission # Bug 1556627
[browser_contentSelectDropdown.js]
# Events tests
[browser_events_announcement.js]
skip-if = e10s && os == 'win' # Bug 1288839
@ -52,6 +50,8 @@ skip-if = e10s && os == 'win' # Bug 1288839
[browser_treeupdate_listener.js]
[browser_treeupdate_optgroup.js]
[browser_treeupdate_removal.js]
[browser_treeupdate_select_dropdown.js]
skip-if = fission # Bug 1556627
[browser_treeupdate_table.js]
[browser_treeupdate_textleaf.js]
[browser_treeupdate_visibility.js]

Просмотреть файл

@ -1,65 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
const snippet = `
<select id="select">
<option>o1</option>
<optgroup label="g1">
<option>g1o1</option>
<option>g1o2</option>
</optgroup>
<optgroup label="g2">
<option>g2o1</option>
<option>g2o2</option>
</optgroup>
<option>o2</option>
</select>
`;
addAccessibleTask(snippet, async function(browser, accDoc) {
await invokeFocus(browser, "select");
// Expand the select. A dropdown item should get focus.
// Note that the dropdown is rendered in the parent process.
let focused = waitForEvent(
EVENT_FOCUS,
event => event.accessible.role == ROLE_COMBOBOX_OPTION,
"Dropdown item focused after select expanded"
);
await BrowserTestUtils.synthesizeKey(
"KEY_ArrowDown",
{ altKey: true },
browser
);
let event = await focused;
let dropdown = event.accessible.parent;
let selectedOptionChildren = [];
if (MAC) {
// Checkmark is part of the Mac menu styling.
selectedOptionChildren = [{ STATICTEXT: [] }];
}
let tree = {
COMBOBOX_LIST: [
{ COMBOBOX_OPTION: selectedOptionChildren },
{ GROUPING: [{ COMBOBOX_OPTION: [] }, { COMBOBOX_OPTION: [] }] },
{ GROUPING: [{ COMBOBOX_OPTION: [] }, { COMBOBOX_OPTION: [] }] },
{ COMBOBOX_OPTION: [] },
],
};
testAccessibleTree(dropdown, tree);
// Collapse the select. Focus should return to the select.
focused = waitForEvent(
EVENT_FOCUS,
"select",
"select focused after collapsed"
);
await BrowserTestUtils.synthesizeKey("KEY_Escape", {}, browser);
await focused;
});

Просмотреть файл

@ -8,37 +8,38 @@
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
// Test ARIA Dialog
addAccessibleTask("doc_treeupdate_ariadialog.html", async function(
browser,
accDoc
) {
testAccessibleTree(accDoc, {
role: ROLE_DOCUMENT,
children: [],
});
addAccessibleTask(
"doc_treeupdate_ariadialog.html",
async function(browser, accDoc) {
testAccessibleTree(accDoc, {
role: ROLE_DOCUMENT,
children: [],
});
// Make dialog visible and update its inner content.
let onShow = waitForEvent(EVENT_SHOW, "dialog");
await SpecialPowers.spawn(browser, [], () => {
content.document.getElementById("dialog").style.display = "block";
});
await onShow;
// Make dialog visible and update its inner content.
let onShow = waitForEvent(EVENT_SHOW, "dialog");
await invokeContentTask(browser, [], () => {
content.document.getElementById("dialog").style.display = "block";
});
await onShow;
testAccessibleTree(accDoc, {
role: ROLE_DOCUMENT,
children: [
{
role: ROLE_DIALOG,
children: [
{
role: ROLE_PUSHBUTTON,
children: [{ role: ROLE_TEXT_LEAF }],
},
{
role: ROLE_ENTRY,
},
],
},
],
});
});
testAccessibleTree(accDoc, {
role: ROLE_DOCUMENT,
children: [
{
role: ROLE_DIALOG,
children: [
{
role: ROLE_PUSHBUTTON,
children: [{ role: ROLE_TEXT_LEAF }],
},
{
role: ROLE_ENTRY,
},
],
},
],
});
},
{ iframe: true }
);

Просмотреть файл

@ -86,7 +86,7 @@ async function testContainer1(browser, accDoc) {
/* ================ Append element ======================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [id], contentId => {
await invokeContentTask(browser, [id], contentId => {
let div = content.document.createElement("div");
div.setAttribute("id", "t1_child3");
div.setAttribute("role", "radio");
@ -109,7 +109,7 @@ async function testContainer1(browser, accDoc) {
/* ================ Remove element ======================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
content.document.getElementById("t1_span").remove();
});
await onReorder;
@ -167,7 +167,7 @@ async function removeContainer(browser, accDoc) {
testAccessibleTree(acc, tree);
let onReorder = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
content.document
.getElementById("t2_container2")
.removeChild(content.document.getElementById("t2_container3"));
@ -189,7 +189,7 @@ async function stealAndRecacheChildren(browser, accDoc) {
/* ================ Attempt to steal from other ARIA owns ================= */
let onReorder = waitForEvent(EVENT_REORDER, id2);
await invokeSetAttribute(browser, id2, "aria-owns", "t3_child");
await SpecialPowers.spawn(browser, [id2], id => {
await invokeContentTask(browser, [id2], id => {
let div = content.document.createElement("div");
div.setAttribute("role", "radio");
content.document.getElementById(id).appendChild(div);
@ -267,7 +267,7 @@ async function removeNotARIAOwnedEl(browser, accDoc) {
testAccessibleTree(acc, tree);
let onReorder = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [id], contentId => {
await invokeContentTask(browser, [id], contentId => {
content.document
.getElementById(contentId)
.removeChild(content.document.getElementById("t6_span"));
@ -280,14 +280,15 @@ async function removeNotARIAOwnedEl(browser, accDoc) {
testAccessibleTree(acc, tree);
}
addAccessibleTask("doc_treeupdate_ariaowns.html", async function(
browser,
accDoc
) {
await testContainer1(browser, accDoc);
await removeContainer(browser, accDoc);
await stealAndRecacheChildren(browser, accDoc);
await showHiddenElement(browser, accDoc);
await rearrangeARIAOwns(browser, accDoc);
await removeNotARIAOwnedEl(browser, accDoc);
});
addAccessibleTask(
"doc_treeupdate_ariaowns.html",
async function(browser, accDoc) {
await testContainer1(browser, accDoc);
await removeContainer(browser, accDoc);
await stealAndRecacheChildren(browser, accDoc);
await showHiddenElement(browser, accDoc);
await rearrangeARIAOwns(browser, accDoc);
await removeNotARIAOwnedEl(browser, accDoc);
},
{ iframe: true }
);

Просмотреть файл

@ -23,5 +23,6 @@ addAccessibleTask(
await onShow;
testAccessibleTree(dialog, { DIALOG: [] });
}
},
{ iframe: true }
);

Просмотреть файл

@ -31,7 +31,7 @@ addAccessibleTask(
testAccessibleTree(container, tree);
let onReorder = waitForEvent(EVENT_REORDER, id1);
await SpecialPowers.spawn(browser, [id1], id => {
await invokeContentTask(browser, [id1], id => {
let doc = content.document;
doc.getElementById("scrollarea").style.width = "20px";
doc.getElementById(id).appendChild(doc.createElement("input"));
@ -55,5 +55,6 @@ addAccessibleTask(
],
};
testAccessibleTree(container, tree);
}
},
{ iframe: true }
);

Просмотреть файл

@ -34,7 +34,7 @@ addAccessibleTask(
/* ================= Write iframe document ================================ */
let reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [id], contentId => {
await invokeContentTask(browser, [id], contentId => {
let docNode = content.document.getElementById("iframe").contentDocument;
let newHTMLNode = docNode.createElement("html");
let newBodyNode = docNode.createElement("body");
@ -59,7 +59,7 @@ addAccessibleTask(
/* ================= Replace iframe HTML element ========================== */
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [id], contentId => {
await invokeContentTask(browser, [id], contentId => {
let docNode = content.document.getElementById("iframe").contentDocument;
// We can't use open/write/close outside of iframe document because of
// security error.
@ -85,7 +85,7 @@ addAccessibleTask(
/* ================= Replace iframe body ================================== */
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [id], contentId => {
await invokeContentTask(browser, [id], contentId => {
let docNode = content.document.getElementById("iframe").contentDocument;
let newBodyNode = docNode.createElement("body");
let newTextNode = docNode.createTextNode("New Hello");
@ -109,7 +109,7 @@ addAccessibleTask(
/* ================= Open iframe document ================================= */
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [id], contentId => {
await invokeContentTask(browser, [id], contentId => {
// Open document.
let docNode = content.document.getElementById("iframe").contentDocument;
let script = docNode.createElement("script");
@ -133,7 +133,7 @@ addAccessibleTask(
/* ================= Close iframe document ================================ */
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
// Write and close document.
let docNode = content.document.getElementById("iframe").contentDocument;
docNode.write("Works?");
@ -154,7 +154,7 @@ addAccessibleTask(
/* ================= Remove HTML from iframe document ===================== */
reorderEventPromise = waitForEvent(EVENT_REORDER, iframe);
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
// Remove HTML element.
let docNode = content.document.getElementById("iframe").contentDocument;
docNode.firstChild.remove();
@ -173,7 +173,7 @@ addAccessibleTask(
/* ================= Insert HTML to iframe document ======================= */
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [id], contentId => {
await invokeContentTask(browser, [id], contentId => {
// Insert HTML element.
let docNode = content.document.getElementById("iframe").contentDocument;
let html = docNode.createElement("html");
@ -199,7 +199,7 @@ addAccessibleTask(
/* ================= Remove body from iframe document ===================== */
reorderEventPromise = waitForEvent(EVENT_REORDER, iframe);
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
// Remove body element.
let docNode = content.document.getElementById("iframe").contentDocument;
docNode.documentElement.removeChild(docNode.body);
@ -218,7 +218,7 @@ addAccessibleTask(
/* ================ Insert element under document element while body missed */
reorderEventPromise = waitForEvent(EVENT_REORDER, iframe);
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
let docNode = content.document.getElementById("iframe").contentDocument;
let inputNode = (content.window.inputNode = docNode.createElement(
"input"
@ -237,7 +237,7 @@ addAccessibleTask(
testAccessibleTree(iframe, tree);
reorderEventPromise = waitForEvent(EVENT_REORDER, iframe);
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
let docEl = content.document.getElementById("iframe").contentDocument
.documentElement;
// Remove aftermath of this test before next test starts.
@ -253,7 +253,7 @@ addAccessibleTask(
/* ================= Insert body to iframe document ======================= */
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [id], contentId => {
await invokeContentTask(browser, [id], contentId => {
// Write and close document.
let docNode = content.document.getElementById("iframe").contentDocument;
// Insert body element.
@ -294,7 +294,7 @@ addAccessibleTask(
/* ================= Replace iframe body on ARIA role body ================ */
reorderEventPromise = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [id], contentId => {
await invokeContentTask(browser, [id], contentId => {
let docNode = content.document.getElementById("iframe").contentDocument;
let newBodyNode = docNode.createElement("body");
let newTextNode = docNode.createTextNode("New Hello");
@ -315,5 +315,6 @@ addAccessibleTask(
],
};
testAccessibleTree(iframe, tree);
}
},
{ iframe: true }
);

Просмотреть файл

@ -47,7 +47,7 @@ addAccessibleTask(
let onReorder = waitForEvent(EVENT_REORDER, id1);
// Create and add an element with CSS generated content to container1
await SpecialPowers.spawn(browser, [id1], id => {
await invokeContentTask(browser, [id1], id => {
let node = content.document.createElement("div");
node.textContent = "text";
node.setAttribute("class", "gentext");
@ -89,5 +89,6 @@ addAccessibleTask(
],
};
testAccessibleTree(container2, tree);
}
},
{ iframe: true }
);

Просмотреть файл

@ -27,5 +27,6 @@ addAccessibleTask(
// Remove @hidden attribute
await setHidden(browser);
testAccessibleTree(container, { SECTION: [{ ENTRY: [] }] });
}
},
{ iframe: true }
);

Просмотреть файл

@ -19,7 +19,7 @@ async function testImageMap(browser, accDoc) {
/* ================= Insert area ========================================== */
let onReorder = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
let areaElm = content.document.createElement("area");
let mapNode = content.document.getElementById("map");
areaElm.setAttribute(
@ -43,7 +43,7 @@ async function testImageMap(browser, accDoc) {
/* ================= Append area ========================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
let areaElm = content.document.createElement("area");
let mapNode = content.document.getElementById("map");
areaElm.setAttribute(
@ -68,7 +68,7 @@ async function testImageMap(browser, accDoc) {
/* ================= Remove area ========================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
let mapNode = content.document.getElementById("map");
mapNode.removeChild(mapNode.firstElementChild);
});
@ -100,13 +100,19 @@ async function testContainer(browser) {
onReorder = waitForEvent(EVENT_REORDER, id);
await invokeSetAttribute(browser, "map", "name", "atoz_map");
// XXX: force repainting of the image (see bug 745788 for details).
await BrowserTestUtils.synthesizeMouse(
"#imgmap",
10,
10,
{ type: "mousemove" },
browser
);
await invokeContentTask(browser, [], () => {
const { ContentTaskUtils } = ChromeUtils.import(
"resource://testing-common/ContentTaskUtils.jsm"
);
const EventUtils = ContentTaskUtils.getEventUtils(content);
EventUtils.synthesizeMouse(
content.document.getElementById("imgmap"),
10,
10,
{ type: "mousemove" },
content
);
});
await onReorder;
tree = {
@ -120,7 +126,7 @@ async function testContainer(browser) {
/* ================= Remove map =========================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
let mapNode = content.document.getElementById("map");
mapNode.remove();
});
@ -133,7 +139,7 @@ async function testContainer(browser) {
/* ================= Insert map =========================================== */
onReorder = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [id], contentId => {
await invokeContentTask(browser, [id], contentId => {
let map = content.document.createElement("map");
let area = content.document.createElement("area");
@ -179,21 +185,28 @@ async function waitForImageMap(browser, accDoc) {
const onReorder = waitForEvent(EVENT_REORDER, id);
// Wave over image map
await BrowserTestUtils.synthesizeMouse(
`#${id}`,
10,
10,
{ type: "mousemove" },
browser
);
await invokeContentTask(browser, [id], contentId => {
const { ContentTaskUtils } = ChromeUtils.import(
"resource://testing-common/ContentTaskUtils.jsm"
);
const EventUtils = ContentTaskUtils.getEventUtils(content);
EventUtils.synthesizeMouse(
content.document.getElementById(contentId),
10,
10,
{ type: "mousemove" },
content
);
});
await onReorder;
}
addAccessibleTask("doc_treeupdate_imagemap.html", async function(
browser,
accDoc
) {
await waitForImageMap(browser, accDoc);
await testImageMap(browser, accDoc);
await testContainer(browser);
});
addAccessibleTask(
"doc_treeupdate_imagemap.html",
async function(browser, accDoc) {
await waitForImageMap(browser, accDoc);
await testImageMap(browser, accDoc);
await testContainer(browser);
},
{ iframe: true }
);

Просмотреть файл

@ -47,5 +47,6 @@ addAccessibleTask(
findAccessibleChildByID(event.accessible, "li"),
accTree
);
}
},
{ iframe: true }
);

Просмотреть файл

@ -7,33 +7,42 @@
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask('<ol id="list"></ol>', async function(browser, accDoc) {
let list = findAccessibleChildByID(accDoc, "list");
addAccessibleTask(
'<ol id="list"></ol>',
async function(browser, accDoc) {
let list = findAccessibleChildByID(accDoc, "list");
testAccessibleTree(list, {
role: ROLE_LIST,
children: [],
});
testAccessibleTree(list, {
role: ROLE_LIST,
children: [],
});
await invokeSetAttribute(browser, "body", "contentEditable", "true");
let onReorder = waitForEvent(EVENT_REORDER, "list");
await SpecialPowers.spawn(browser, [], () => {
let li = content.document.createElement("li");
li.textContent = "item";
content.document.getElementById("list").appendChild(li);
});
await onReorder;
await invokeSetAttribute(
browser,
currentContentDoc(),
"contentEditable",
"true"
);
let onReorder = waitForEvent(EVENT_REORDER, "list");
await invokeContentTask(browser, [], () => {
let li = content.document.createElement("li");
li.textContent = "item";
content.document.getElementById("list").appendChild(li);
});
await onReorder;
testAccessibleTree(list, {
role: ROLE_LIST,
children: [
{
role: ROLE_LISTITEM,
children: [
{ role: ROLE_STATICTEXT, name: "1. ", children: [] },
{ role: ROLE_TEXT_LEAF, children: [] },
],
},
],
});
});
testAccessibleTree(list, {
role: ROLE_LIST,
children: [
{
role: ROLE_LISTITEM,
children: [
{ role: ROLE_STATICTEXT, name: "1. ", children: [] },
{ role: ROLE_TEXT_LEAF, children: [] },
],
},
],
});
},
{ iframe: true }
);

Просмотреть файл

@ -21,9 +21,9 @@ addAccessibleTask(
"Check that child is not accessible."
);
let onReorder = waitForEvent(EVENT_REORDER, "body");
let onReorder = waitForEvent(EVENT_REORDER, matchContentDoc);
// Add an event listener to parent.
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
content.window.dummyListener = () => {};
content.document
.getElementById("parent")
@ -33,5 +33,6 @@ addAccessibleTask(
let tree = { TEXT: [] };
testAccessibleTree(findAccessibleChildByID(accDoc, "parent"), tree);
}
},
{ iframe: true }
);

Просмотреть файл

@ -7,93 +7,97 @@
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask('<select id="select"></select>', async function(
browser,
accDoc
) {
let select = findAccessibleChildByID(accDoc, "select");
addAccessibleTask(
'<select id="select"></select>',
async function(browser, accDoc) {
let select = findAccessibleChildByID(accDoc, "select");
let onEvent = waitForEvent(EVENT_REORDER, "select");
// Create a combobox with grouping and 2 standalone options
await SpecialPowers.spawn(browser, [], () => {
let doc = content.document;
let contentSelect = doc.getElementById("select");
let optGroup = doc.createElement("optgroup");
let onEvent = waitForEvent(EVENT_REORDER, "select");
// Create a combobox with grouping and 2 standalone options
await invokeContentTask(browser, [], () => {
let doc = content.document;
let contentSelect = doc.getElementById("select");
let optGroup = doc.createElement("optgroup");
for (let i = 0; i < 2; i++) {
let opt = doc.createElement("option");
opt.value = i;
opt.text = "Option: Value " + i;
optGroup.appendChild(opt);
}
contentSelect.add(optGroup, null);
for (let i = 0; i < 2; i++) {
let opt = doc.createElement("option");
opt.value = i;
opt.text = "Option: Value " + i;
optGroup.appendChild(opt);
}
contentSelect.add(optGroup, null);
for (let i = 0; i < 2; i++) {
let opt = doc.createElement("option");
contentSelect.add(opt, null);
}
contentSelect.firstChild.firstChild.id = "option1Node";
});
let event = await onEvent;
let option1Node = findAccessibleChildByID(event.accessible, "option1Node");
for (let i = 0; i < 2; i++) {
let opt = doc.createElement("option");
contentSelect.add(opt, null);
}
contentSelect.firstChild.firstChild.id = "option1Node";
});
let event = await onEvent;
let option1Node = findAccessibleChildByID(event.accessible, "option1Node");
let tree = {
COMBOBOX: [
{
COMBOBOX_LIST: [
{
GROUPING: [
{ COMBOBOX_OPTION: [{ TEXT_LEAF: [] }] },
{ COMBOBOX_OPTION: [{ TEXT_LEAF: [] }] },
],
},
{
COMBOBOX_OPTION: [],
},
{
COMBOBOX_OPTION: [],
},
],
},
],
};
testAccessibleTree(select, tree);
ok(!isDefunct(option1Node), "option shouldn't be defunct");
let tree = {
COMBOBOX: [
{
COMBOBOX_LIST: [
{
GROUPING: [
{ COMBOBOX_OPTION: [{ TEXT_LEAF: [] }] },
{ COMBOBOX_OPTION: [{ TEXT_LEAF: [] }] },
],
},
{
COMBOBOX_OPTION: [],
},
{
COMBOBOX_OPTION: [],
},
],
},
],
};
testAccessibleTree(select, tree);
ok(!isDefunct(option1Node), "option shouldn't be defunct");
onEvent = waitForEvent(EVENT_REORDER, "select");
// Remove grouping from combobox
await SpecialPowers.spawn(browser, [], () => {
let contentSelect = content.document.getElementById("select");
contentSelect.firstChild.remove();
});
await onEvent;
onEvent = waitForEvent(EVENT_REORDER, "select");
// Remove grouping from combobox
await invokeContentTask(browser, [], () => {
let contentSelect = content.document.getElementById("select");
contentSelect.firstChild.remove();
});
await onEvent;
tree = {
COMBOBOX: [
{
COMBOBOX_LIST: [{ COMBOBOX_OPTION: [] }, { COMBOBOX_OPTION: [] }],
},
],
};
testAccessibleTree(select, tree);
ok(isDefunct(option1Node), "removed option shouldn't be accessible anymore!");
tree = {
COMBOBOX: [
{
COMBOBOX_LIST: [{ COMBOBOX_OPTION: [] }, { COMBOBOX_OPTION: [] }],
},
],
};
testAccessibleTree(select, tree);
ok(
isDefunct(option1Node),
"removed option shouldn't be accessible anymore!"
);
onEvent = waitForEvent(EVENT_REORDER, "select");
// Remove all options from combobox
await SpecialPowers.spawn(browser, [], () => {
let contentSelect = content.document.getElementById("select");
while (contentSelect.length) {
contentSelect.remove(0);
}
});
await onEvent;
onEvent = waitForEvent(EVENT_REORDER, "select");
// Remove all options from combobox
await invokeContentTask(browser, [], () => {
let contentSelect = content.document.getElementById("select");
while (contentSelect.length) {
contentSelect.remove(0);
}
});
await onEvent;
tree = {
COMBOBOX: [
{
COMBOBOX_LIST: [],
},
],
};
testAccessibleTree(select, tree);
});
tree = {
COMBOBOX: [
{
COMBOBOX_LIST: [],
},
],
};
testAccessibleTree(select, tree);
},
{ iframe: true }
);

Просмотреть файл

@ -7,51 +7,52 @@
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask("doc_treeupdate_removal.xhtml", async function(
browser,
accDoc
) {
ok(
isAccessible(findAccessibleChildByID(accDoc, "the_table")),
"table should be accessible"
);
// Move the_table element into hidden subtree.
let onReorder = waitForEvent(EVENT_REORDER, "body");
await SpecialPowers.spawn(browser, [], () => {
content.document
.getElementById("the_displaynone")
.appendChild(content.document.getElementById("the_table"));
});
await onReorder;
ok(
!isAccessible(findAccessibleChildByID(accDoc, "the_table")),
"table in display none tree shouldn't be accessible"
);
ok(
!isAccessible(findAccessibleChildByID(accDoc, "the_row")),
"row shouldn't be accessible"
);
// Remove the_row element (since it did not have accessible, no event needed).
await SpecialPowers.spawn(browser, [], () => {
content.document.body.removeChild(
content.document.getElementById("the_row")
addAccessibleTask(
"doc_treeupdate_removal.xhtml",
async function(browser, accDoc) {
ok(
isAccessible(findAccessibleChildByID(accDoc, "the_table")),
"table should be accessible"
);
});
// make sure no accessibles have stuck around.
ok(
!isAccessible(findAccessibleChildByID(accDoc, "the_row")),
"row shouldn't be accessible"
);
ok(
!isAccessible(findAccessibleChildByID(accDoc, "the_table")),
"table shouldn't be accessible"
);
ok(
!isAccessible(findAccessibleChildByID(accDoc, "the_displayNone")),
"display none things shouldn't be accessible"
);
});
// Move the_table element into hidden subtree.
let onReorder = waitForEvent(EVENT_REORDER, matchContentDoc);
await invokeContentTask(browser, [], () => {
content.document
.getElementById("the_displaynone")
.appendChild(content.document.getElementById("the_table"));
});
await onReorder;
ok(
!isAccessible(findAccessibleChildByID(accDoc, "the_table")),
"table in display none tree shouldn't be accessible"
);
ok(
!isAccessible(findAccessibleChildByID(accDoc, "the_row")),
"row shouldn't be accessible"
);
// Remove the_row element (since it did not have accessible, no event needed).
await invokeContentTask(browser, [], () => {
content.document.body.removeChild(
content.document.getElementById("the_row")
);
});
// make sure no accessibles have stuck around.
ok(
!isAccessible(findAccessibleChildByID(accDoc, "the_row")),
"row shouldn't be accessible"
);
ok(
!isAccessible(findAccessibleChildByID(accDoc, "the_table")),
"table shouldn't be accessible"
);
ok(
!isAccessible(findAccessibleChildByID(accDoc, "the_displayNone")),
"display none things shouldn't be accessible"
);
},
{ iframe: true }
);

Просмотреть файл

@ -0,0 +1,77 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
const snippet = `
<select id="select">
<option>o1</option>
<optgroup label="g1">
<option>g1o1</option>
<option>g1o2</option>
</optgroup>
<optgroup label="g2">
<option>g2o1</option>
<option>g2o2</option>
</optgroup>
<option>o2</option>
</select>
`;
addAccessibleTask(
snippet,
async function(browser, accDoc) {
await invokeFocus(browser, "select");
// Expand the select. A dropdown item should get focus.
// Note that the dropdown is rendered in the parent process.
let focused = waitForEvent(
EVENT_FOCUS,
event => event.accessible.role == ROLE_COMBOBOX_OPTION,
"Dropdown item focused after select expanded"
);
await invokeContentTask(browser, [], () => {
const { ContentTaskUtils } = ChromeUtils.import(
"resource://testing-common/ContentTaskUtils.jsm"
);
const EventUtils = ContentTaskUtils.getEventUtils(content);
EventUtils.synthesizeKey("VK_DOWN", { altKey: true }, content);
});
let event = await focused;
let dropdown = event.accessible.parent;
let selectedOptionChildren = [];
if (MAC) {
// Checkmark is part of the Mac menu styling.
selectedOptionChildren = [{ STATICTEXT: [] }];
}
let tree = {
COMBOBOX_LIST: [
{ COMBOBOX_OPTION: selectedOptionChildren },
{ GROUPING: [{ COMBOBOX_OPTION: [] }, { COMBOBOX_OPTION: [] }] },
{ GROUPING: [{ COMBOBOX_OPTION: [] }, { COMBOBOX_OPTION: [] }] },
{ COMBOBOX_OPTION: [] },
],
};
testAccessibleTree(dropdown, tree);
// Collapse the select. Focus should return to the select.
focused = waitForEvent(
EVENT_FOCUS,
"select",
"select focused after collapsed"
);
await invokeContentTask(browser, [], () => {
const { ContentTaskUtils } = ChromeUtils.import(
"resource://testing-common/ContentTaskUtils.jsm"
);
const EventUtils = ContentTaskUtils.getEventUtils(content);
EventUtils.synthesizeKey("VK_ESCAPE", {}, content);
});
await focused;
},
{ iframe: true }
);

Просмотреть файл

@ -26,7 +26,7 @@ addAccessibleTask(
testAccessibleTree(table, tree);
let onReorder = waitForEvent(EVENT_REORDER, "table");
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
// append a caption, it should appear as a first element in the
// accessible tree.
let doc = content.document;
@ -43,5 +43,6 @@ addAccessibleTask(
],
};
testAccessibleTree(table, tree);
}
},
{ iframe: true }
);

Просмотреть файл

@ -15,7 +15,7 @@ async function removeTextData(browser, accessible, id, role) {
testAccessibleTree(accessible, tree);
let onReorder = waitForEvent(EVENT_REORDER, id);
await SpecialPowers.spawn(browser, [id], contentId => {
await invokeContentTask(browser, [id], contentId => {
content.document.getElementById(contentId).firstChild.textContent = "";
});
await onReorder;
@ -33,5 +33,6 @@ addAccessibleTask(
let pre = findAccessibleChildByID(accDoc, "pre");
await removeTextData(browser, p, "p", ROLE_PARAGRAPH);
await removeTextData(browser, pre, "pre", ROLE_TEXT_CONTAINER);
}
},
{ iframe: true }
);

Просмотреть файл

@ -49,7 +49,7 @@ async function test3(browser, accessible) {
testAccessibleTree(accessible, tree);
let onReorder = waitForEvent(EVENT_REORDER, "t3_container");
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
let doc = content.document;
doc.getElementById("t3_container").style.color = "red";
doc.getElementById("t3_parent").style.visibility = "hidden";
@ -84,7 +84,7 @@ async function test4(browser, accessible) {
testAccessibleTree(accessible, tree);
let onReorder = waitForEvent(EVENT_REORDER, "t4_parent");
await SpecialPowers.spawn(browser, [], () => {
await invokeContentTask(browser, [], () => {
let doc = content.document;
doc.getElementById("t4_container").style.color = "red";
doc.getElementById("t4_child").style.visibility = "visible";
@ -117,225 +117,226 @@ async function test4(browser, accessible) {
testAccessibleTree(accessible, tree);
}
addAccessibleTask("doc_treeupdate_visibility.html", async function(
browser,
accDoc
) {
let t3Container = findAccessibleChildByID(accDoc, "t3_container");
let t4Container = findAccessibleChildByID(accDoc, "t4_container");
addAccessibleTask(
"doc_treeupdate_visibility.html",
async function(browser, accDoc) {
let t3Container = findAccessibleChildByID(accDoc, "t3_container");
let t4Container = findAccessibleChildByID(accDoc, "t4_container");
await testTreeOnHide(
browser,
accDoc,
"t1_container",
"t1_parent",
{
SECTION: [
{
SECTION: [
{
SECTION: [{ TEXT_LEAF: [] }],
},
],
},
],
},
{
SECTION: [
{
SECTION: [{ TEXT_LEAF: [] }],
},
],
}
);
await testTreeOnHide(
browser,
accDoc,
"t1_container",
"t1_parent",
{
SECTION: [
{
SECTION: [
{
SECTION: [{ TEXT_LEAF: [] }],
},
],
},
],
},
{
SECTION: [
{
SECTION: [{ TEXT_LEAF: [] }],
},
],
}
);
await testTreeOnHide(
browser,
accDoc,
"t2_container",
"t2_grandparent",
{
SECTION: [
{
// container
SECTION: [
{
// grand parent
SECTION: [
{
SECTION: [
{
// child
TEXT_LEAF: [],
},
],
},
{
SECTION: [
{
// child2
TEXT_LEAF: [],
},
],
},
],
},
],
},
],
},
{
SECTION: [
{
// container
SECTION: [
{
// child
TEXT_LEAF: [],
},
],
},
{
SECTION: [
{
// child2
TEXT_LEAF: [],
},
],
},
],
}
);
await testTreeOnHide(
browser,
accDoc,
"t2_container",
"t2_grandparent",
{
SECTION: [
{
// container
SECTION: [
{
// grand parent
SECTION: [
{
SECTION: [
{
// child
TEXT_LEAF: [],
},
],
},
{
SECTION: [
{
// child2
TEXT_LEAF: [],
},
],
},
],
},
],
},
],
},
{
SECTION: [
{
// container
SECTION: [
{
// child
TEXT_LEAF: [],
},
],
},
{
SECTION: [
{
// child2
TEXT_LEAF: [],
},
],
},
],
}
);
await test3(browser, t3Container);
await test4(browser, t4Container);
await test3(browser, t3Container);
await test4(browser, t4Container);
await testTreeOnHide(
browser,
accDoc,
"t5_container",
"t5_subcontainer",
{
SECTION: [
{
// container
SECTION: [
{
// subcontainer
TABLE: [
{
ROW: [
{
CELL: [
{
SECTION: [
{
// child
TEXT_LEAF: [],
},
],
},
],
},
],
},
],
},
],
},
],
},
{
SECTION: [
{
// container
SECTION: [
{
// child
TEXT_LEAF: [],
},
],
},
],
}
);
await testTreeOnHide(
browser,
accDoc,
"t5_container",
"t5_subcontainer",
{
SECTION: [
{
// container
SECTION: [
{
// subcontainer
TABLE: [
{
ROW: [
{
CELL: [
{
SECTION: [
{
// child
TEXT_LEAF: [],
},
],
},
],
},
],
},
],
},
],
},
],
},
{
SECTION: [
{
// container
SECTION: [
{
// child
TEXT_LEAF: [],
},
],
},
],
}
);
await testTreeOnHide(
browser,
accDoc,
"t6_container",
"t6_subcontainer",
{
SECTION: [
{
// container
SECTION: [
{
// subcontainer
TABLE: [
{
ROW: [
{
CELL: [
{
TABLE: [
{
// nested table
ROW: [
{
CELL: [
{
SECTION: [
{
// child
TEXT_LEAF: [],
},
],
},
],
},
],
},
],
},
],
},
],
},
],
},
{
SECTION: [
{
// child2
TEXT_LEAF: [],
},
],
},
],
},
],
},
{
SECTION: [
{
// container
SECTION: [
{
// child
TEXT_LEAF: [],
},
],
},
{
SECTION: [
{
// child2
TEXT_LEAF: [],
},
],
},
],
}
);
});
await testTreeOnHide(
browser,
accDoc,
"t6_container",
"t6_subcontainer",
{
SECTION: [
{
// container
SECTION: [
{
// subcontainer
TABLE: [
{
ROW: [
{
CELL: [
{
TABLE: [
{
// nested table
ROW: [
{
CELL: [
{
SECTION: [
{
// child
TEXT_LEAF: [],
},
],
},
],
},
],
},
],
},
],
},
],
},
],
},
{
SECTION: [
{
// child2
TEXT_LEAF: [],
},
],
},
],
},
],
},
{
SECTION: [
{
// container
SECTION: [
{
// child
TEXT_LEAF: [],
},
],
},
{
SECTION: [
{
// child2
TEXT_LEAF: [],
},
],
},
],
}
);
},
{ iframe: true }
);

Просмотреть файл

@ -7,61 +7,62 @@
/* import-globals-from ../../mochitest/role.js */
loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
addAccessibleTask("doc_treeupdate_whitespace.html", async function(
browser,
accDoc
) {
let container1 = findAccessibleChildByID(accDoc, "container1");
let container2Parent = findAccessibleChildByID(accDoc, "container2-parent");
addAccessibleTask(
"doc_treeupdate_whitespace.html",
async function(browser, accDoc) {
let container1 = findAccessibleChildByID(accDoc, "container1");
let container2Parent = findAccessibleChildByID(accDoc, "container2-parent");
let tree = {
SECTION: [
{ GRAPHIC: [] },
{ TEXT_LEAF: [] },
{ GRAPHIC: [] },
{ TEXT_LEAF: [] },
{ GRAPHIC: [] },
],
};
testAccessibleTree(container1, tree);
let tree = {
SECTION: [
{ GRAPHIC: [] },
{ TEXT_LEAF: [] },
{ GRAPHIC: [] },
{ TEXT_LEAF: [] },
{ GRAPHIC: [] },
],
};
testAccessibleTree(container1, tree);
let onReorder = waitForEvent(EVENT_REORDER, "container1");
// Remove img1 from container1
await SpecialPowers.spawn(browser, [], () => {
let doc = content.document;
doc.getElementById("container1").removeChild(doc.getElementById("img1"));
});
await onReorder;
let onReorder = waitForEvent(EVENT_REORDER, "container1");
// Remove img1 from container1
await invokeContentTask(browser, [], () => {
let doc = content.document;
doc.getElementById("container1").removeChild(doc.getElementById("img1"));
});
await onReorder;
tree = {
SECTION: [{ GRAPHIC: [] }, { TEXT_LEAF: [] }, { GRAPHIC: [] }],
};
testAccessibleTree(container1, tree);
tree = {
SECTION: [{ GRAPHIC: [] }, { TEXT_LEAF: [] }, { GRAPHIC: [] }],
};
testAccessibleTree(container1, tree);
tree = {
SECTION: [{ LINK: [] }, { LINK: [{ GRAPHIC: [] }] }],
};
testAccessibleTree(container2Parent, tree);
tree = {
SECTION: [{ LINK: [] }, { LINK: [{ GRAPHIC: [] }] }],
};
testAccessibleTree(container2Parent, tree);
onReorder = waitForEvent(EVENT_REORDER, "container2-parent");
// Append an img with valid src to container2
await SpecialPowers.spawn(browser, [], () => {
let doc = content.document;
let img = doc.createElement("img");
img.setAttribute(
"src",
"http://example.com/a11y/accessible/tests/mochitest/moz.png"
);
doc.getElementById("container2").appendChild(img);
});
await onReorder;
onReorder = waitForEvent(EVENT_REORDER, "container2-parent");
// Append an img with valid src to container2
await invokeContentTask(browser, [], () => {
let doc = content.document;
let img = doc.createElement("img");
img.setAttribute(
"src",
"http://example.com/a11y/accessible/tests/mochitest/moz.png"
);
doc.getElementById("container2").appendChild(img);
});
await onReorder;
tree = {
SECTION: [
{ LINK: [{ GRAPHIC: [] }] },
{ TEXT_LEAF: [] },
{ LINK: [{ GRAPHIC: [] }] },
],
};
testAccessibleTree(container2Parent, tree);
});
tree = {
SECTION: [
{ LINK: [{ GRAPHIC: [] }] },
{ TEXT_LEAF: [] },
{ LINK: [{ GRAPHIC: [] }] },
],
};
testAccessibleTree(container2Parent, tree);
},
{ iframe: true }
);