Bug 1705253 - Partially disable accessible/tests/browser/mac/browser_app.js when native context menus are used. r=morgan

This test has a part where it expects AXMenuOpened events for context menus, which are not observable for us when native context menus are used.

It also has a part where it inspects the accessibility-exposed contents of a context menu. This is not testable with native context menus either, so that part of the test needs to be disabled.

Differential Revision: https://phabricator.services.mozilla.com/D112122
This commit is contained in:
Markus Stange 2021-04-15 19:58:16 +00:00
Родитель 6a29893c48
Коммит d025eeaf2f
1 изменённых файлов: 39 добавлений и 11 удалений

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

@ -138,19 +138,42 @@ add_task(async () => {
// Open a context menu
const menu = document.getElementById("contentAreaContextMenu");
EventUtils.synthesizeMouseAtCenter(document.body, {
type: "contextmenu",
});
await waitForMacEvent("AXMenuOpened");
if (
Services.prefs.getBoolPref("widget.macos.native-context-menus", false)
) {
// Native context menu - do not expect accessibility notifications.
let popupshown = BrowserTestUtils.waitForPopupEvent(menu, "shown");
EventUtils.synthesizeMouseAtCenter(document.body, {
type: "contextmenu",
});
await popupshown;
// Now root has 1 more child
is(rootChildCount(), baseRootChildCount + 1, "Root has 1 more child");
is(
rootChildCount(),
baseRootChildCount,
"Native context menus do not show up in the root children"
);
// Close context menu
let closed = waitForMacEvent("AXMenuClosed", "contentAreaContextMenu");
EventUtils.synthesizeKey("KEY_Escape");
await BrowserTestUtils.waitForPopupEvent(menu, "hidden");
await closed;
// Close context menu
let popuphidden = BrowserTestUtils.waitForPopupEvent(menu, "hidden");
menu.hidePopup();
await popuphidden;
} else {
// Non-native menu
EventUtils.synthesizeMouseAtCenter(document.body, {
type: "contextmenu",
});
await waitForMacEvent("AXMenuOpened");
// Now root has 1 more child
is(rootChildCount(), baseRootChildCount + 1, "Root has 1 more child");
// Close context menu
let closed = waitForMacEvent("AXMenuClosed", "contentAreaContextMenu");
EventUtils.synthesizeKey("KEY_Escape");
await BrowserTestUtils.waitForPopupEvent(menu, "hidden");
await closed;
}
// We're back to base child count
is(rootChildCount(), baseRootChildCount, "Root has original child count");
@ -197,6 +220,11 @@ add_task(async () => {
* Test context menu
*/
add_task(async () => {
if (Services.prefs.getBoolPref("widget.macos.native-context-menus", false)) {
ok(true, "We cannot inspect native context menu contents; skip this test.");
return;
}
await BrowserTestUtils.withNewTab(
{
gBrowser,