diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-03 06:00:38 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-03 06:00:38 -0500 |
commit | 8148615da179fdd60f19018e13b4e94b95609cc6 (patch) | |
tree | 771fccdd99fa3adf35fdd2c81d8197b415a89b91 /browser/base/content/test/popups | |
parent | 494802c1be7888025b95260d23db187467d2b9dd (diff) | |
download | UXP-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/popups')
4 files changed, 0 insertions, 150 deletions
diff --git a/browser/base/content/test/popups/browser.ini b/browser/base/content/test/popups/browser.ini deleted file mode 100644 index 46a32783b..000000000 --- a/browser/base/content/test/popups/browser.ini +++ /dev/null @@ -1,4 +0,0 @@ -[browser_popupUI.js] -[browser_popup_blocker.js] -support-files = popup_blocker.html -skip-if = (os == 'linux') || (e10s && debug) # Frequent bug 1081925 and bug 1125520 failures diff --git a/browser/base/content/test/popups/browser_popupUI.js b/browser/base/content/test/popups/browser_popupUI.js deleted file mode 100644 index 7c6805f60..000000000 --- a/browser/base/content/test/popups/browser_popupUI.js +++ /dev/null @@ -1,37 +0,0 @@ -function test() { - waitForExplicitFinish(); - SpecialPowers.pushPrefEnv({ set: [[ "dom.disable_open_during_load", false ]] }); - - let popupOpened = BrowserTestUtils.waitForNewWindow(true, "about:blank"); - BrowserTestUtils.openNewForegroundTab(gBrowser, - "data:text/html,<html><script>popup=open('about:blank','','width=300,height=200')</script>" - ); - popupOpened.then((win) => testPopupUI(win)); -} - -function testPopupUI(win) { - var doc = win.document; - - ok(win.gURLBar, "location bar exists in the popup"); - isnot(win.gURLBar.clientWidth, 0, "location bar is visible in the popup"); - ok(win.gURLBar.readOnly, "location bar is read-only in the popup"); - isnot(doc.getElementById("Browser:OpenLocation").getAttribute("disabled"), "true", - "'open location' command is not disabled in the popup"); - - let historyButton = doc.getAnonymousElementByAttribute(win.gURLBar, "anonid", - "historydropmarker"); - is(historyButton.clientWidth, 0, "history dropdown button is hidden in the popup"); - - EventUtils.synthesizeKey("t", { accelKey: true }, win); - is(win.gBrowser.browsers.length, 1, "Accel+T doesn't open a new tab in the popup"); - is(gBrowser.browsers.length, 3, "Accel+T opened a new tab in the parent window"); - gBrowser.removeCurrentTab(); - - EventUtils.synthesizeKey("w", { accelKey: true }, win); - ok(win.closed, "Accel+W closes the popup"); - - if (!win.closed) - win.close(); - gBrowser.removeCurrentTab(); - finish(); -} diff --git a/browser/base/content/test/popups/browser_popup_blocker.js b/browser/base/content/test/popups/browser_popup_blocker.js deleted file mode 100644 index 8cadfea57..000000000 --- a/browser/base/content/test/popups/browser_popup_blocker.js +++ /dev/null @@ -1,96 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -const baseURL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://example.com"); - -function clearAllPermissionsByPrefix(aPrefix) { - let perms = Services.perms.enumerator; - while (perms.hasMoreElements()) { - let perm = perms.getNext(); - if (perm.type.startsWith(aPrefix)) { - Services.perms.removePermission(perm); - } - } -} - -add_task(function* test_opening_blocked_popups() { - // Enable the popup blocker. - yield SpecialPowers.pushPrefEnv({set: [["dom.disable_open_during_load", true]]}); - - // Open the test page. - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, baseURL + "popup_blocker.html"); - - // Wait for the popup-blocked notification. - let notification; - yield BrowserTestUtils.waitForCondition(() => - notification = gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked")); - - // Show the menu. - let popupShown = BrowserTestUtils.waitForEvent(window, "popupshown"); - let popupFilled = BrowserTestUtils.waitForMessage(gBrowser.selectedBrowser.messageManager, - "PopupBlocking:ReplyGetBlockedPopupList"); - notification.querySelector("button").doCommand(); - let popup_event = yield popupShown; - let menu = popup_event.target; - is(menu.id, "blockedPopupOptions", "Blocked popup menu shown"); - - yield popupFilled; - // The menu is filled on the same message that we waited for, so let's ensure that it - // had a chance of running before this test code. - yield new Promise(resolve => executeSoon(resolve)); - - // Check the menu contents. - let sep = menu.querySelector("menuseparator"); - let popupCount = 0; - for (let i = sep.nextElementSibling; i; i = i.nextElementSibling) { - popupCount++; - } - is(popupCount, 2, "Two popups were blocked"); - - // Pressing "allow" should open all blocked popups. - let popupTabs = []; - function onTabOpen(event) { - popupTabs.push(event.target); - } - gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen); - - // Press the button. - let allow = menu.querySelector("[observes='blockedPopupAllowSite']"); - allow.doCommand(); - yield BrowserTestUtils.waitForCondition(() => - popupTabs.length == 2 && - popupTabs.every(aTab => aTab.linkedBrowser.currentURI.spec != "about:blank")); - - gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen); - - is(popupTabs[0].linkedBrowser.currentURI.spec, "data:text/plain;charset=utf-8,a", "Popup a"); - is(popupTabs[1].linkedBrowser.currentURI.spec, "data:text/plain;charset=utf-8,b", "Popup b"); - - // Clean up. - gBrowser.removeTab(tab); - for (let popup of popupTabs) { - gBrowser.removeTab(popup); - } - clearAllPermissionsByPrefix("popup"); - // Ensure the menu closes. - menu.hidePopup(); -}); - -add_task(function* check_icon_hides() { - // Enable the popup blocker. - yield SpecialPowers.pushPrefEnv({set: [["dom.disable_open_during_load", true]]}); - - let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, baseURL + "popup_blocker.html"); - - let button = document.getElementById("page-report-button"); - yield BrowserTestUtils.waitForCondition(() => - gBrowser.getNotificationBox().getNotificationWithValue("popup-blocked")); - ok(!button.hidden, "Button should be visible"); - - let otherPageLoaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser); - openLinkIn(baseURL, "current", {}); - yield otherPageLoaded; - ok(button.hidden, "Button should have hidden again after another page loaded."); - yield BrowserTestUtils.removeTab(tab); -}); diff --git a/browser/base/content/test/popups/popup_blocker.html b/browser/base/content/test/popups/popup_blocker.html deleted file mode 100644 index 6e2b7db15..000000000 --- a/browser/base/content/test/popups/popup_blocker.html +++ /dev/null @@ -1,13 +0,0 @@ -<!doctype html> -<html> - <head> - <meta charset="UTF-8"> - <title>Page creating two popups</title> - </head> - <body> - <script type="text/javascript"> - window.open("data:text/plain;charset=utf-8,a", "a"); - window.open("data:text/plain;charset=utf-8,b", "b"); - </script> - </body> -</html> |