зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1351638 - Fix intermittents caused by menus_commands test r=kmag
MozReview-Commit-ID: FsU2MHL0c9o --HG-- extra : rebase_source : bc5f1897825a882537bc927fd4e59fb7ac23fb1a
This commit is contained in:
Родитель
8b1992d948
Коммит
35a2e0e01d
|
@ -56,7 +56,6 @@ skip-if = (os == 'win' && !debug) # bug 1352668
|
|||
[browser_ext_contextMenus_checkboxes.js]
|
||||
[browser_ext_contextMenus_commands.js]
|
||||
[browser_ext_contextMenus_icons.js]
|
||||
skip-if = os == 'win' && !debug # Bug 1351638
|
||||
[browser_ext_contextMenus_onclick.js]
|
||||
[browser_ext_contextMenus_radioGroups.js]
|
||||
[browser_ext_contextMenus_uninstall.js]
|
||||
|
|
|
@ -33,6 +33,7 @@ add_task(async function() {
|
|||
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"name": "contextMenus commands",
|
||||
"permissions": ["contextMenus", "activeTab", "tabs"],
|
||||
"browser_action": {
|
||||
"default_title": "Test BrowserAction",
|
||||
|
@ -59,6 +60,7 @@ add_task(async function() {
|
|||
async function testContext(id) {
|
||||
const menu = await openExtensionContextMenu();
|
||||
const items = menu.getElementsByAttribute("label", id);
|
||||
is(items.length, 1, `exactly one menu item found`);
|
||||
await closeExtensionContextMenu(items[0]);
|
||||
return extension.awaitMessage("test-opened");
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ add_task(async function() {
|
|||
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"name": "contextMenus icons",
|
||||
"permissions": ["contextMenus"],
|
||||
"icons": {
|
||||
"18": "extension.png",
|
||||
|
@ -38,9 +39,10 @@ add_task(async function() {
|
|||
},
|
||||
});
|
||||
|
||||
let confirmContextMenuIcon = (rootElement) => {
|
||||
let confirmContextMenuIcon = (rootElements) => {
|
||||
let expectedURL = new RegExp(String.raw`^moz-extension://[^/]+/extension\.png$`);
|
||||
let imageUrl = rootElement.getAttribute("image");
|
||||
is(rootElements.length, 1, "Found exactly one menu item");
|
||||
let imageUrl = rootElements[0].getAttribute("image");
|
||||
ok(expectedURL.test(imageUrl), "The context menu should display the extension icon next to the root element");
|
||||
};
|
||||
|
||||
|
@ -50,17 +52,18 @@ add_task(async function() {
|
|||
let extensionMenu = await openExtensionContextMenu();
|
||||
|
||||
let contextMenu = document.getElementById("contentAreaContextMenu");
|
||||
let topLevelMenuItem = contextMenu.getElementsByAttribute("ext-type", "top-level-menu")[0];
|
||||
let topLevelMenuItem = contextMenu.getElementsByAttribute("ext-type", "top-level-menu");
|
||||
confirmContextMenuIcon(topLevelMenuItem);
|
||||
|
||||
let childToDelete = extensionMenu.getElementsByAttribute("label", "child-to-delete")[0];
|
||||
await closeExtensionContextMenu(childToDelete);
|
||||
let childToDelete = extensionMenu.getElementsByAttribute("label", "child-to-delete");
|
||||
is(childToDelete.length, 1, "Found exactly one child to delete");
|
||||
await closeExtensionContextMenu(childToDelete[0]);
|
||||
await extension.awaitMessage("child-deleted");
|
||||
|
||||
await openExtensionContextMenu();
|
||||
|
||||
contextMenu = document.getElementById("contentAreaContextMenu");
|
||||
topLevelMenuItem = contextMenu.getElementsByAttribute("label", "child")[0];
|
||||
topLevelMenuItem = contextMenu.getElementsByAttribute("label", "child");
|
||||
|
||||
confirmContextMenuIcon(topLevelMenuItem);
|
||||
await closeContextMenu();
|
||||
|
|
|
@ -218,6 +218,7 @@ add_task(async function test_onclick_modifiers() {
|
|||
async function click(modifiers = {}) {
|
||||
const menu = await openContextMenu();
|
||||
const items = menu.getElementsByAttribute("label", "modify");
|
||||
is(items.length, 1, "Got exactly one context menu item");
|
||||
await closeExtensionContextMenu(items[0], modifiers);
|
||||
return extension.awaitMessage("click");
|
||||
}
|
||||
|
|
|
@ -320,7 +320,7 @@ async function openExtensionContextMenu(selector = "#img1") {
|
|||
return null;
|
||||
}
|
||||
|
||||
let extensionMenu = topLevelMenu[0].childNodes[0];
|
||||
let extensionMenu = topLevelMenu[0];
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
|
||||
EventUtils.synthesizeMouseAtCenter(extensionMenu, {});
|
||||
await popupShownPromise;
|
||||
|
@ -331,7 +331,10 @@ async function closeExtensionContextMenu(itemToSelect, modifiers = {}) {
|
|||
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||
let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden");
|
||||
EventUtils.synthesizeMouseAtCenter(itemToSelect, modifiers);
|
||||
return popupHiddenPromise;
|
||||
await popupHiddenPromise;
|
||||
|
||||
// Bug 1351638: parent menu fails to close intermittently, make sure it does.
|
||||
contentAreaContextMenu.hidePopup();
|
||||
}
|
||||
|
||||
async function openChromeContextMenu(menuId, target, win = window) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче