Bug 1706775 - Ensure that various menu tests under toolkit/content/tests/chrome are run on non-native menus. r=harry

These tests are meant to exercise our non-native menu code.
Some aspects of these tests are worth testing with native menus, too -
we will have separate native menu test files for those.

Once we do not use non-native menus anywhere on macOS anymore, we can
disable these tests on macOS. However, for now, we still use non-native
menus for 'anchored popups', e.g. toolbar button dropdowns.
In order to retain test coverage for our non-native menu code, we make
sure that these tests are run with native context menus turned off.

Differential Revision: https://phabricator.services.mozilla.com/D113027
This commit is contained in:
Markus Stange 2021-04-21 21:21:42 +00:00
parent e8938ae1b2
commit 6f37d66cc4
4 changed files with 24 additions and 4 deletions

View File

@ -80,8 +80,13 @@ var gTestElement = "list";
var gSelectionStep = 0;
var gContextMenuFired = false;
function startTest()
async function startTest()
{
// These tests check behavior of non-native menus, and use anchored and non-anchored popups
// somewhat interchangibly. So disable native context menus for this test.
// We will have separate tests for native context menu behavior, see bug 1700727.
await SpecialPowers.pushPrefEnv({ set: [["widget.macos.native-context-menus", false]] });
// first, check if the richlistbox selection changes on a contextmenu mouse event
var element = $("list");
synthesizeMouse(element.getItemAtIndex(3), 7, 1, { type : "mousedown", button: 2, ctrlKey: true });

View File

@ -7,7 +7,12 @@
<link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script>
SimpleTest.waitForExplicitFinish();
function runTest() {
async function runTest() {
// This test exercises non-native menu code. So disable native context menus for this test.
// If we ever get to a point where we don't use any non-native menus on macOS any more, we can
// disable this test on macOS.
await SpecialPowers.pushPrefEnv({ set: [["widget.macos.native-context-menus", false]] });
window.openDialog("window_largemenu.xhtml", "_blank", "chrome,width=200,height=200,noopener", window);
}
</script>

View File

@ -10,8 +10,13 @@
<script>
SimpleTest.waitForExplicitFinish();
function runTest()
async function runTest()
{
// This test exercises non-native menu code. So disable native context menus for this test.
// If we ever get to a point where we don't use any non-native menus on macOS any more, we can
// disable this test on macOS.
await SpecialPowers.pushPrefEnv({ set: [["widget.macos.native-context-menus", false]] });
window.open("window_popup_attribute.xhtml", "_blank", "width=600,height=800");
}
</script>

View File

@ -10,8 +10,13 @@
<script>
SimpleTest.waitForExplicitFinish();
function runTest()
async function runTest()
{
// This test exercises non-native menu code. So disable native context menus for this test.
// If we ever get to a point where we don't use any non-native menus on macOS any more, we can
// disable this test on macOS.
await SpecialPowers.pushPrefEnv({ set: [["widget.macos.native-context-menus", false]] });
window.open("window_popup_button.xhtml", "_blank", "width=700,height=800");
}
</script>