summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/tabPrompts
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-03 06:00:38 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-03 06:00:38 -0500
commit8148615da179fdd60f19018e13b4e94b95609cc6 (patch)
tree771fccdd99fa3adf35fdd2c81d8197b415a89b91 /browser/base/content/test/tabPrompts
parent494802c1be7888025b95260d23db187467d2b9dd (diff)
downloadUXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.gz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.lz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.xz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.zip
Remove browser tests - Part 1: The Tests (except for experiments)
Diffstat (limited to 'browser/base/content/test/tabPrompts')
-rw-r--r--browser/base/content/test/tabPrompts/.eslintrc.js7
-rw-r--r--browser/base/content/test/tabPrompts/browser.ini4
-rw-r--r--browser/base/content/test/tabPrompts/browser_closeTabSpecificPanels.js41
-rw-r--r--browser/base/content/test/tabPrompts/browser_multiplePrompts.js72
-rw-r--r--browser/base/content/test/tabPrompts/browser_openPromptInBackgroundTab.js66
-rw-r--r--browser/base/content/test/tabPrompts/openPromptOffTimeout.html10
6 files changed, 0 insertions, 200 deletions
diff --git a/browser/base/content/test/tabPrompts/.eslintrc.js b/browser/base/content/test/tabPrompts/.eslintrc.js
deleted file mode 100644
index 7c8021192..000000000
--- a/browser/base/content/test/tabPrompts/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
- "extends": [
- "../../../../../testing/mochitest/browser.eslintrc.js"
- ]
-};
diff --git a/browser/base/content/test/tabPrompts/browser.ini b/browser/base/content/test/tabPrompts/browser.ini
deleted file mode 100644
index 9b94f14c5..000000000
--- a/browser/base/content/test/tabPrompts/browser.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[browser_closeTabSpecificPanels.js]
-[browser_multiplePrompts.js]
-[browser_openPromptInBackgroundTab.js]
-support-files = openPromptOffTimeout.html
diff --git a/browser/base/content/test/tabPrompts/browser_closeTabSpecificPanels.js b/browser/base/content/test/tabPrompts/browser_closeTabSpecificPanels.js
deleted file mode 100644
index 30c15a56f..000000000
--- a/browser/base/content/test/tabPrompts/browser_closeTabSpecificPanels.js
+++ /dev/null
@@ -1,41 +0,0 @@
-"use strict";
-
-/*
- * This test creates multiple panels, one that has been tagged as specific to its tab's content
- * and one that isn't. When a tab loses focus, panel specific to that tab should close.
- * The non-specific panel should remain open.
- *
- */
-
-add_task(function*() {
- let tab1 = gBrowser.addTab("http://mochi.test:8888/#0");
- let tab2 = gBrowser.addTab("http://mochi.test:8888/#1");
- let specificPanel = document.createElement("panel");
- specificPanel.setAttribute("tabspecific", "true");
- let generalPanel = document.createElement("panel");
- let anchor = document.getElementById(CustomizableUI.AREA_NAVBAR);
-
- anchor.appendChild(specificPanel);
- anchor.appendChild(generalPanel);
- is(specificPanel.state, "closed", "specificPanel starts as closed");
- is(generalPanel.state, "closed", "generalPanel starts as closed");
-
- let specificPanelPromise = BrowserTestUtils.waitForEvent(specificPanel, "popupshown");
- specificPanel.openPopupAtScreen(210, 210);
- yield specificPanelPromise;
- is(specificPanel.state, "open", "specificPanel has been opened");
-
- let generalPanelPromise = BrowserTestUtils.waitForEvent(generalPanel, "popupshown");
- generalPanel.openPopupAtScreen(510, 510);
- yield generalPanelPromise;
- is(generalPanel.state, "open", "generalPanel has been opened");
-
- gBrowser.tabContainer.advanceSelectedTab(-1, true);
- is(specificPanel.state, "closed", "specificPanel panel is closed after its tab loses focus");
- is(generalPanel.state, "open", "generalPanel is still open after tab switch");
-
- specificPanel.remove();
- generalPanel.remove();
- gBrowser.removeTab(tab1);
- gBrowser.removeTab(tab2);
-});
diff --git a/browser/base/content/test/tabPrompts/browser_multiplePrompts.js b/browser/base/content/test/tabPrompts/browser_multiplePrompts.js
deleted file mode 100644
index c548429ea..000000000
--- a/browser/base/content/test/tabPrompts/browser_multiplePrompts.js
+++ /dev/null
@@ -1,72 +0,0 @@
-"use strict";
-
-/*
- * This test triggers multiple alerts on one single tab, because it"s possible
- * for web content to do so. The behavior is described in bug 1266353.
- *
- * We assert the presentation of the multiple alerts, ensuring we show only
- * the oldest one.
- */
-add_task(function*() {
- const PROMPTCOUNT = 5;
-
- let contentScript = function() {
- var i = 5; // contentScript has no access to PROMPTCOUNT.
- window.addEventListener("message", function() {
- i--;
- if (i) {
- window.postMessage("ping", "*");
- }
- alert("Alert countdown #" + i);
- });
- window.postMessage("ping", "*");
- };
- let url = "data:text/html,<script>(" + encodeURIComponent(contentScript.toSource()) + ")();</script>"
-
- let promptsOpenedPromise = new Promise(function(resolve) {
- let unopenedPromptCount = PROMPTCOUNT;
- Services.obs.addObserver(function observer() {
- unopenedPromptCount--;
- if (!unopenedPromptCount) {
- Services.obs.removeObserver(observer, "tabmodal-dialog-loaded");
- info("Prompts opened.");
- resolve();
- }
- }, "tabmodal-dialog-loaded", false);
- });
-
- let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, url, true);
- info("Tab loaded");
-
- yield promptsOpenedPromise;
-
- let promptsCount = PROMPTCOUNT;
- while (promptsCount--) {
- let prompts = tab.linkedBrowser.parentNode.querySelectorAll("tabmodalprompt");
- is(prompts.length, promptsCount + 1, "There should be " + (promptsCount + 1) + " prompt(s).");
- // The oldest should be the first.
- let i = 0;
- for (let prompt of prompts) {
- is(prompt.Dialog.args.text, "Alert countdown #" + i, "The #" + i + " alert should be labelled as such.");
- if (i !== promptsCount) {
- is(prompt.hidden, true, "This prompt should be hidden.");
- i++;
- continue;
- }
-
- is(prompt.hidden, false, "The last prompt should not be hidden.");
- prompt.onButtonClick(0);
-
- // The click is handled async; wait for an event loop turn for that to
- // happen.
- yield new Promise(function(resolve) {
- Services.tm.mainThread.dispatch(resolve, Ci.nsIThread.DISPATCH_NORMAL);
- });
- }
- }
-
- let prompts = tab.linkedBrowser.parentNode.querySelectorAll("tabmodalprompt");
- is(prompts.length, 0, "Prompts should all be dismissed.");
-
- yield BrowserTestUtils.removeTab(tab);
-});
diff --git a/browser/base/content/test/tabPrompts/browser_openPromptInBackgroundTab.js b/browser/base/content/test/tabPrompts/browser_openPromptInBackgroundTab.js
deleted file mode 100644
index d244d157a..000000000
--- a/browser/base/content/test/tabPrompts/browser_openPromptInBackgroundTab.js
+++ /dev/null
@@ -1,66 +0,0 @@
-"use strict";
-
-const ROOT = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://example.com/");
-let pageWithAlert = ROOT + "openPromptOffTimeout.html";
-
-registerCleanupFunction(function() {
- Services.perms.removeAll(makeURI(pageWithAlert));
-});
-
-/*
- * This test opens a tab that alerts when it is hidden. We then switch away
- * from the tab, and check that by default the tab is not automatically
- * re-selected. We also check that a checkbox appears in the alert that allows
- * the user to enable this automatically re-selecting. We then check that
- * checking the checkbox does actually enable that behaviour.
- */
-add_task(function*() {
- yield SpecialPowers.pushPrefEnv({"set": [["browser.tabs.dontfocusfordialogs", true]]});
- let firstTab = gBrowser.selectedTab;
- // load page that opens prompt when page is hidden
- let openedTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, pageWithAlert, true);
- let openedTabGotAttentionPromise = BrowserTestUtils.waitForAttribute("attention", openedTab, "true");
- // switch away from that tab again - this triggers the alert.
- yield BrowserTestUtils.switchTab(gBrowser, firstTab);
- // ... but that's async on e10s...
- yield openedTabGotAttentionPromise;
- // check for attention attribute
- is(openedTab.getAttribute("attention"), "true", "Tab with alert should have 'attention' attribute.");
- ok(!openedTab.selected, "Tab with alert should not be selected");
-
- // switch tab back, and check the checkbox is displayed:
- yield BrowserTestUtils.switchTab(gBrowser, openedTab);
- // check the prompt is there, and the extra row is present
- let prompts = openedTab.linkedBrowser.parentNode.querySelectorAll("tabmodalprompt");
- is(prompts.length, 1, "There should be 1 prompt");
- let ourPrompt = prompts[0];
- let row = ourPrompt.querySelector("row");
- ok(row, "Should have found the row with our checkbox");
- let checkbox = row.querySelector("checkbox[label*='example.com']");
- ok(checkbox, "The checkbox should be there");
- ok(!checkbox.checked, "Checkbox shouldn't be checked");
- // tick box and accept dialog
- checkbox.checked = true;
- ourPrompt.onButtonClick(0);
- // Wait for that click to actually be handled completely.
- yield new Promise(function(resolve) {
- Services.tm.mainThread.dispatch(resolve, Ci.nsIThread.DISPATCH_NORMAL);
- });
- // check permission is set
- let ps = Services.perms;
- is(ps.ALLOW_ACTION, ps.testPermission(makeURI(pageWithAlert), "focus-tab-by-prompt"),
- "Tab switching should now be allowed");
-
- let openedTabSelectedPromise = BrowserTestUtils.waitForAttribute("selected", openedTab, "true");
- // switch to other tab again
- yield BrowserTestUtils.switchTab(gBrowser, firstTab);
-
- // This is sync in non-e10s, but in e10s we need to wait for this, so yield anyway.
- // Note that the switchTab promise doesn't actually guarantee anything about *which*
- // tab ends up as selected when its event fires, so using that here wouldn't work.
- yield openedTabSelectedPromise;
- // should be switched back
- ok(openedTab.selected, "Ta-dah, the other tab should now be selected again!");
-
- yield BrowserTestUtils.removeTab(openedTab);
-});
diff --git a/browser/base/content/test/tabPrompts/openPromptOffTimeout.html b/browser/base/content/test/tabPrompts/openPromptOffTimeout.html
deleted file mode 100644
index e865c7872..000000000
--- a/browser/base/content/test/tabPrompts/openPromptOffTimeout.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<body>
-This page opens an alert box when the page is hidden.
-<script>
-document.addEventListener("visibilitychange", () => {
- if (document.hidden) {
- alert("You hid my page!");
- }
-}, false);
-</script>
-</body>