Bug 1521704 - Move Page Action tests to their own directory. r=adw

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

--HG--
rename : browser/components/urlbar/tests/legacy/browser_page_action_menu.js => browser/base/content/test/pageActions/browser_page_action_menu.js
rename : browser/components/urlbar/tests/browser/browser_page_action_menu_add_search_engine.js => browser/base/content/test/pageActions/browser_page_action_menu_add_search_engine.js
rename : browser/components/urlbar/tests/browser/browser_page_action_menu_clipboard.js => browser/base/content/test/pageActions/browser_page_action_menu_clipboard.js
rename : browser/components/urlbar/tests/browser/browser_page_action_menu_share_mac.js => browser/base/content/test/pageActions/browser_page_action_menu_share_mac.js
rename : browser/components/urlbar/tests/browser/browser_page_action_menu_share_win.html => browser/base/content/test/pageActions/browser_page_action_menu_share_win.html
rename : browser/components/urlbar/tests/browser/browser_page_action_menu_share_win.js => browser/base/content/test/pageActions/browser_page_action_menu_share_win.js
rename : browser/components/urlbar/tests/browser/head-common.js => browser/base/content/test/pageActions/head.js
rename : browser/components/urlbar/tests/browser/page_action_menu_add_search_engine_0.xml => browser/base/content/test/pageActions/page_action_menu_add_search_engine_0.xml
rename : browser/components/urlbar/tests/browser/page_action_menu_add_search_engine_1.xml => browser/base/content/test/pageActions/page_action_menu_add_search_engine_1.xml
rename : browser/components/urlbar/tests/browser/page_action_menu_add_search_engine_2.xml => browser/base/content/test/pageActions/page_action_menu_add_search_engine_2.xml
rename : browser/components/urlbar/tests/browser/page_action_menu_add_search_engine_many.html => browser/base/content/test/pageActions/page_action_menu_add_search_engine_many.html
rename : browser/components/urlbar/tests/browser/page_action_menu_add_search_engine_one.html => browser/base/content/test/pageActions/page_action_menu_add_search_engine_one.html
rename : browser/components/urlbar/tests/browser/page_action_menu_add_search_engine_same_names.html => browser/base/content/test/pageActions/page_action_menu_add_search_engine_same_names.html
extra : moz-landing-system : lando
This commit is contained in:
Mark Banner 2019-01-24 09:21:47 +00:00
Родитель 5bd96a47f5
Коммит 1d083ed1c1
20 изменённых файлов: 163 добавлений и 157 удалений

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

@ -40,6 +40,9 @@ with Files("test/historySwipeAnimation/**"):
with Files("test/keyboard/**"):
BUG_COMPONENT = ("Firefox", "Keyboard Navigation")
with Files("test/pageActions/**"):
BUG_COMPONENT = ("Firefox", "Toolbars and Customization")
with Files("test/pageinfo/**"):
BUG_COMPONENT = ("Firefox", "Page Info Window")
@ -130,6 +133,9 @@ with Files("browser-gestureSupport.js"):
with Files("browser-media.js"):
BUG_COMPONENT = ("Core", "Audio/Video: Playback")
with Files("browser-pageActions.js"):
BUG_COMPONENT = ("Firefox", "Toolbars and Customization")
with Files("browser-places.js"):
BUG_COMPONENT = ("Firefox", "Bookmarks & History")

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

@ -0,0 +1,7 @@
"use strict";
module.exports = {
"extends": [
"plugin:mozilla/browser-test",
]
};

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

@ -0,0 +1,21 @@
[DEFAULT]
support-files =
head.js
[browser_page_action_menu_add_search_engine.js]
support-files =
page_action_menu_add_search_engine_one.html
page_action_menu_add_search_engine_many.html
page_action_menu_add_search_engine_same_names.html
page_action_menu_add_search_engine_0.xml
page_action_menu_add_search_engine_1.xml
page_action_menu_add_search_engine_2.xml
[browser_page_action_menu_clipboard.js]
subsuite = clipboard
[browser_page_action_menu_share_mac.js]
skip-if = os != "mac" # Mac only feature
[browser_page_action_menu_share_win.js]
support-files =
browser_page_action_menu_share_win.html
skip-if = os != "win" # Windows only feature
[browser_page_action_menu.js]

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

@ -0,0 +1,122 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const {PlacesTestUtils} = ChromeUtils.import("resource://testing-common/PlacesTestUtils.jsm", null);
function promisePageActionPanelOpen() {
let dwu = window.windowUtils;
return BrowserTestUtils.waitForCondition(() => {
// Wait for the main page action button to become visible. It's hidden for
// some URIs, so depending on when this is called, it may not yet be quite
// visible. It's up to the caller to make sure it will be visible.
info("Waiting for main page action button to have non-0 size");
let bounds = dwu.getBoundsWithoutFlushing(BrowserPageActions.mainButtonNode);
return bounds.width > 0 && bounds.height > 0;
}).then(() => {
// Wait for the panel to become open, by clicking the button if necessary.
info("Waiting for main page action panel to be open");
if (BrowserPageActions.panelNode.state == "open") {
return Promise.resolve();
}
let shownPromise = promisePageActionPanelShown();
EventUtils.synthesizeMouseAtCenter(BrowserPageActions.mainButtonNode, {});
return shownPromise;
}).then(() => {
// Wait for items in the panel to become visible.
return promisePageActionViewChildrenVisible(BrowserPageActions.mainViewNode);
});
}
async function waitForActivatedActionPanel() {
if (!BrowserPageActions.activatedActionPanelNode) {
info("Waiting for activated-action panel to be added to mainPopupSet");
await new Promise(resolve => {
let observer = new MutationObserver(mutations => {
if (BrowserPageActions.activatedActionPanelNode) {
observer.disconnect();
resolve();
}
});
let popupSet = document.getElementById("mainPopupSet");
observer.observe(popupSet, { childList: true });
});
info("Activated-action panel added to mainPopupSet");
}
if (!BrowserPageActions.activatedActionPanelNode.state == "open") {
info("Waiting for activated-action panel popupshown");
await promisePanelShown(BrowserPageActions.activatedActionPanelNode);
info("Got activated-action panel popupshown");
}
let panelView =
BrowserPageActions.activatedActionPanelNode.querySelector("panelview");
if (panelView) {
await BrowserTestUtils.waitForEvent(
BrowserPageActions.activatedActionPanelNode,
"ViewShown"
);
await promisePageActionViewChildrenVisible(panelView);
}
return panelView;
}
function promisePageActionPanelShown() {
return promisePanelShown(BrowserPageActions.panelNode);
}
function promisePageActionPanelHidden() {
return promisePanelHidden(BrowserPageActions.panelNode);
}
function promisePanelShown(panelIDOrNode) {
return promisePanelEvent(panelIDOrNode, "popupshown");
}
function promisePanelHidden(panelIDOrNode) {
return promisePanelEvent(panelIDOrNode, "popuphidden");
}
function promisePanelEvent(panelIDOrNode, eventType) {
return new Promise(resolve => {
let panel = panelIDOrNode;
if (typeof panel == "string") {
panel = document.getElementById(panelIDOrNode);
if (!panel) {
throw new Error(`Panel with ID "${panelIDOrNode}" does not exist.`);
}
}
if ((eventType == "popupshown" && panel.state == "open") ||
(eventType == "popuphidden" && panel.state == "closed")) {
executeSoon(resolve);
return;
}
panel.addEventListener(eventType, () => {
executeSoon(resolve);
}, { once: true });
});
}
function promisePageActionViewShown() {
info("promisePageActionViewShown waiting for ViewShown");
return BrowserTestUtils.waitForEvent(BrowserPageActions.panelNode, "ViewShown").then(async event => {
let panelViewNode = event.originalTarget;
await promisePageActionViewChildrenVisible(panelViewNode);
return panelViewNode;
});
}
function promisePageActionViewChildrenVisible(panelViewNode) {
return promiseNodeVisible(panelViewNode.firstElementChild.firstElementChild);
}
function promiseNodeVisible(node) {
info(`promiseNodeVisible waiting, node.id=${node.id} node.localeName=${node.localName}\n`);
let dwu = window.windowUtils;
return BrowserTestUtils.waitForCondition(() => {
let bounds = dwu.getBoundsWithoutFlushing(node);
if (bounds.width > 0 && bounds.height > 0) {
info(`promiseNodeVisible OK, node.id=${node.id} node.localeName=${node.localName}\n`);
return true;
}
return false;
});
}

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

@ -2,9 +2,9 @@
<html>
<head>
<meta charset="UTF-8">
<link rel="search" type="application/opensearchdescription+xml" title="page_action_menu_add_search_engine_0" href="http://mochi.test:8888/browser/browser/components/urlbar/tests/browser/page_action_menu_add_search_engine_0.xml">
<link rel="search" type="application/opensearchdescription+xml" title="page_action_menu_add_search_engine_1" href="http://mochi.test:8888/browser/browser/components/urlbar/tests/browser/page_action_menu_add_search_engine_1.xml">
<link rel="search" type="application/opensearchdescription+xml" title="page_action_menu_add_search_engine_2" href="http://mochi.test:8888/browser/browser/components/urlbar/tests/browser/page_action_menu_add_search_engine_2.xml">
<link rel="search" type="application/opensearchdescription+xml" title="page_action_menu_add_search_engine_0" href="http://mochi.test:8888/browser/browser/base/content/test/pageActions/page_action_menu_add_search_engine_0.xml">
<link rel="search" type="application/opensearchdescription+xml" title="page_action_menu_add_search_engine_1" href="http://mochi.test:8888/browser/browser/base/content/test/pageActions/page_action_menu_add_search_engine_1.xml">
<link rel="search" type="application/opensearchdescription+xml" title="page_action_menu_add_search_engine_2" href="http://mochi.test:8888/browser/browser/base/content/test/pageActions/page_action_menu_add_search_engine_2.xml">
</head>
<body></body>
</html>

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

@ -2,7 +2,7 @@
<html>
<head>
<meta charset="UTF-8">
<link rel="search" type="application/opensearchdescription+xml" title="page_action_menu_add_search_engine_0" href="http://mochi.test:8888/browser/browser/components/urlbar/tests/browser/page_action_menu_add_search_engine_0.xml">
<link rel="search" type="application/opensearchdescription+xml" title="page_action_menu_add_search_engine_0" href="http://mochi.test:8888/browser/browser/base/content/test/pageActions/page_action_menu_add_search_engine_0.xml">
</head>
<body></body>
</html>

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

@ -2,8 +2,8 @@
<html>
<head>
<meta charset="UTF-8">
<link rel="search" type="application/opensearchdescription+xml" title="page_action_menu_add_search_engine_0" href="http://mochi.test:8888/browser/browser/base/content/test/urlbar/page_action_menu_add_search_engine_0.xml">
<link rel="search" type="application/opensearchdescription+xml" title="page_action_menu_add_search_engine_1" href="http://mochi.test:8888/browser/browser/base/content/test/urlbar/page_action_menu_add_search_engine_0.xml">
<link rel="search" type="application/opensearchdescription+xml" title="page_action_menu_add_search_engine_0" href="http://mochi.test:8888/browser/browser/base/content/test/pageActions/page_action_menu_add_search_engine_0.xml">
<link rel="search" type="application/opensearchdescription+xml" title="page_action_menu_add_search_engine_1" href="http://mochi.test:8888/browser/browser/base/content/test/pageActions/page_action_menu_add_search_engine_0.xml">
</head>
<body></body>
</html>

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

@ -32,6 +32,7 @@ BROWSER_CHROME_MANIFESTS += [
'content/test/historySwipeAnimation/browser.ini',
'content/test/keyboard/browser.ini',
'content/test/metaTags/browser.ini',
'content/test/pageActions/browser.ini',
'content/test/pageinfo/browser.ini',
'content/test/performance/browser.ini',
'content/test/performance/hidpi/browser.ini',

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

@ -20,22 +20,6 @@ skip-if = true # Bug 1521490
[browser_locationBarExternalLoad.js]
skip-if = true # Bug 1521490
[browser_moz_action_link.js]
[browser_page_action_menu_add_search_engine.js]
support-files =
page_action_menu_add_search_engine_one.html
page_action_menu_add_search_engine_many.html
page_action_menu_add_search_engine_same_names.html
page_action_menu_add_search_engine_0.xml
page_action_menu_add_search_engine_1.xml
page_action_menu_add_search_engine_2.xml
[browser_page_action_menu_clipboard.js]
subsuite = clipboard
[browser_page_action_menu_share_mac.js]
skip-if = os != "mac" # Mac only feature
[browser_page_action_menu_share_win.js]
support-files =
browser_page_action_menu_share_win.html
skip-if = os != "win" # Windows only feature
[browser_populateAfterPushState.js]
[browser_urlbar_blanking.js]
support-files =

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

@ -56,124 +56,6 @@ function promiseAutocompleteResultPopup(inputText,
win, waitForFocus, fireInputEvent);
}
function promisePageActionPanelOpen() {
let dwu = window.windowUtils;
return BrowserTestUtils.waitForCondition(() => {
// Wait for the main page action button to become visible. It's hidden for
// some URIs, so depending on when this is called, it may not yet be quite
// visible. It's up to the caller to make sure it will be visible.
info("Waiting for main page action button to have non-0 size");
let bounds = dwu.getBoundsWithoutFlushing(BrowserPageActions.mainButtonNode);
return bounds.width > 0 && bounds.height > 0;
}).then(() => {
// Wait for the panel to become open, by clicking the button if necessary.
info("Waiting for main page action panel to be open");
if (BrowserPageActions.panelNode.state == "open") {
return Promise.resolve();
}
let shownPromise = promisePageActionPanelShown();
EventUtils.synthesizeMouseAtCenter(BrowserPageActions.mainButtonNode, {});
return shownPromise;
}).then(() => {
// Wait for items in the panel to become visible.
return promisePageActionViewChildrenVisible(BrowserPageActions.mainViewNode);
});
}
async function waitForActivatedActionPanel() {
if (!BrowserPageActions.activatedActionPanelNode) {
info("Waiting for activated-action panel to be added to mainPopupSet");
await new Promise(resolve => {
let observer = new MutationObserver(mutations => {
if (BrowserPageActions.activatedActionPanelNode) {
observer.disconnect();
resolve();
}
});
let popupSet = document.getElementById("mainPopupSet");
observer.observe(popupSet, { childList: true });
});
info("Activated-action panel added to mainPopupSet");
}
if (!BrowserPageActions.activatedActionPanelNode.state == "open") {
info("Waiting for activated-action panel popupshown");
await promisePanelShown(BrowserPageActions.activatedActionPanelNode);
info("Got activated-action panel popupshown");
}
let panelView =
BrowserPageActions.activatedActionPanelNode.querySelector("panelview");
if (panelView) {
await BrowserTestUtils.waitForEvent(
BrowserPageActions.activatedActionPanelNode,
"ViewShown"
);
await promisePageActionViewChildrenVisible(panelView);
}
return panelView;
}
function promisePageActionPanelShown() {
return promisePanelShown(BrowserPageActions.panelNode);
}
function promisePageActionPanelHidden() {
return promisePanelHidden(BrowserPageActions.panelNode);
}
function promisePanelShown(panelIDOrNode) {
return promisePanelEvent(panelIDOrNode, "popupshown");
}
function promisePanelHidden(panelIDOrNode) {
return promisePanelEvent(panelIDOrNode, "popuphidden");
}
function promisePanelEvent(panelIDOrNode, eventType) {
return new Promise(resolve => {
let panel = panelIDOrNode;
if (typeof panel == "string") {
panel = document.getElementById(panelIDOrNode);
if (!panel) {
throw new Error(`Panel with ID "${panelIDOrNode}" does not exist.`);
}
}
if ((eventType == "popupshown" && panel.state == "open") ||
(eventType == "popuphidden" && panel.state == "closed")) {
executeSoon(resolve);
return;
}
panel.addEventListener(eventType, () => {
executeSoon(resolve);
}, { once: true });
});
}
function promisePageActionViewShown() {
info("promisePageActionViewShown waiting for ViewShown");
return BrowserTestUtils.waitForEvent(BrowserPageActions.panelNode, "ViewShown").then(async event => {
let panelViewNode = event.originalTarget;
await promisePageActionViewChildrenVisible(panelViewNode);
return panelViewNode;
});
}
function promisePageActionViewChildrenVisible(panelViewNode) {
return promiseNodeVisible(panelViewNode.firstElementChild.firstElementChild);
}
function promiseNodeVisible(node) {
info(`promiseNodeVisible waiting, node.id=${node.id} node.localeName=${node.localName}\n`);
let dwu = window.windowUtils;
return BrowserTestUtils.waitForCondition(() => {
let bounds = dwu.getBoundsWithoutFlushing(node);
if (bounds.width > 0 && bounds.height > 0) {
info(`promiseNodeVisible OK, node.id=${node.id} node.localeName=${node.localName}\n`);
return true;
}
return false;
});
}
function promiseSpeculativeConnection(httpserver) {
return UrlbarTestUtils.promiseSpeculativeConnection(httpserver);
}

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

@ -42,8 +42,6 @@ subsuite = clipboard
[browser_dragdropURL.js]
[browser_locationBarCommand.js]
[browser_new_tab_urlbar_reset.js]
[browser_page_action_menu.js]
skip-if = os != "win" # Windows only feature
[browser_pasteAndGo.js]
subsuite = clipboard
[../browser/browser_populateAfterPushState.js]
@ -132,21 +130,6 @@ support-files =
[../browser/browser_bug783614.js]
[../browser/browser_locationBarExternalLoad.js]
[../browser/browser_moz_action_link.js]
[../browser/browser_page_action_menu_add_search_engine.js]
support-files =
../browser/page_action_menu_add_search_engine_one.html
../browser/page_action_menu_add_search_engine_many.html
../browser/page_action_menu_add_search_engine_same_names.html
../browser/page_action_menu_add_search_engine_0.xml
../browser/page_action_menu_add_search_engine_1.xml
../browser/page_action_menu_add_search_engine_2.xml
[../browser/browser_page_action_menu_clipboard.js]
subsuite = clipboard
[../browser/browser_page_action_menu_share_mac.js]
skip-if = os != "mac" # Mac only feature
[../browser/browser_page_action_menu_share_win.js]
support-files =
../browser/browser_page_action_menu_share_win.html
[../browser/browser_urlbarCopying.js]
subsuite = clipboard
support-files =