diff options
Diffstat (limited to 'toolkit/mozapps/downloads/tests/chrome')
8 files changed, 0 insertions, 247 deletions
diff --git a/toolkit/mozapps/downloads/tests/chrome/.eslintrc.js b/toolkit/mozapps/downloads/tests/chrome/.eslintrc.js deleted file mode 100644 index 8c0f4f574..000000000 --- a/toolkit/mozapps/downloads/tests/chrome/.eslintrc.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = { - "extends": [ - "../../../../../testing/mochitest/chrome.eslintrc.js" - ] -}; diff --git a/toolkit/mozapps/downloads/tests/chrome/chrome.ini b/toolkit/mozapps/downloads/tests/chrome/chrome.ini deleted file mode 100644 index b5a29cb45..000000000 --- a/toolkit/mozapps/downloads/tests/chrome/chrome.ini +++ /dev/null @@ -1,10 +0,0 @@ -[DEFAULT] -skip-if = os == 'android' -support-files = - unknownContentType_dialog_layout_data.pif - unknownContentType_dialog_layout_data.pif^headers^ - unknownContentType_dialog_layout_data.txt - unknownContentType_dialog_layout_data.txt^headers^ - -[test_unknownContentType_delayedbutton.xul] -[test_unknownContentType_dialog_layout.xul] diff --git a/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_delayedbutton.xul b/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_delayedbutton.xul deleted file mode 100644 index 9bbec0f92..000000000 --- a/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_delayedbutton.xul +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version="1.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/. --> -<!-- - * The unknownContentType popup can have two different layouts depending on - * whether a helper application can be selected or not. - * This tests that both layouts have correct collapsed elements. ---> - -<window title="Unknown Content Type Dialog Test" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - onload="doTest()"> - - <script type="application/javascript" - src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> - - <script type="application/javascript"><![CDATA[ - const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; - - Cu.import("resource://gre/modules/Services.jsm"); - Cu.import("resource://gre/modules/Task.jsm"); - Cu.import("resource://gre/modules/Promise.jsm"); - - const UCT_URI = "chrome://mozapps/content/downloads/unknownContentType.xul"; - const LOAD_URI = "http://mochi.test:8888/chrome/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.txt"; - - const DIALOG_DELAY = Services.prefs.getIntPref("security.dialog_enable_delay") + 200; - - let UCTObserver = { - opened: Promise.defer(), - closed: Promise.defer(), - - observe: function(aSubject, aTopic, aData) { - let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget); - - switch (aTopic) { - case "domwindowopened": - win.addEventListener("load", function onLoad(event) { - win.removeEventListener("load", onLoad, false); - - // Let the dialog initialize - SimpleTest.executeSoon(function() { - UCTObserver.opened.resolve(win); - }); - }, false); - break; - - case "domwindowclosed": - if (win.location == UCT_URI) { - this.closed.resolve(); - } - break; - } - } - }; - - Services.ww.registerNotification(UCTObserver); - SimpleTest.waitForExplicitFinish(); - SimpleTest.requestFlakyTimeout("This test is testing a timing-based feature, so it really needs to wait a certain amount of time to verify that the feature worked."); - - function waitDelay(delay) { - return new Promise((resolve, reject) => { - window.setTimeout(resolve, delay); - }); - } - - function doTest() { - Task.spawn(function test_aboutCrashed() { - let frame = document.getElementById("testframe"); - frame.setAttribute("src", LOAD_URI); - - let uctWindow = yield UCTObserver.opened.promise; - let ok = uctWindow.document.documentElement.getButton("accept"); - - SimpleTest.is(ok.disabled, true, "button started disabled"); - - yield waitDelay(DIALOG_DELAY); - - SimpleTest.is(ok.disabled, false, "button was enabled"); - - focusOutOfDialog = SimpleTest.promiseFocus(window); - window.focus(); - yield focusOutOfDialog; - - SimpleTest.is(ok.disabled, true, "button was disabled"); - - focusOnDialog = SimpleTest.promiseFocus(uctWindow); - uctWindow.focus(); - yield focusOnDialog; - - SimpleTest.is(ok.disabled, true, "button remained disabled"); - - yield waitDelay(DIALOG_DELAY); - SimpleTest.is(ok.disabled, false, "button re-enabled after delay"); - - uctWindow.document.documentElement.cancelDialog(); - yield UCTObserver.closed.promise; - - Services.ww.unregisterNotification(UCTObserver); - uctWindow = null; - UCTObserver = null; - SimpleTest.finish(); - }); - } - ]]></script> - - <body xmlns="http://www.w3.org/1999/xhtml"> - <p id="display"></p> - <div id="content" style="display:none;"></div> - <pre id="test"></pre> - </body> - - <iframe xmlns="http://www.w3.org/1999/xhtml" - id="testframe"> - </iframe> -</window> diff --git a/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_dialog_layout.xul b/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_dialog_layout.xul deleted file mode 100644 index 1210b908d..000000000 --- a/toolkit/mozapps/downloads/tests/chrome/test_unknownContentType_dialog_layout.xul +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.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/. --> -<!-- - * The unknownContentType popup can have two different layouts depending on - * whether a helper application can be selected or not. - * This tests that both layouts have correct collapsed elements. ---> - -<window title="Unknown Content Type Dialog Test" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - onload="init()"> - - <script type="application/javascript" - src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> - - <script type="application/javascript"> - <![CDATA[ -const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; - -const UCT_URI = "chrome://mozapps/content/downloads/unknownContentType.xul"; - -let testIndex = -1; -let tests = [ - { // This URL will trigger the simple UI, where only the Save an Cancel buttons are available - url: "http://mochi.test:8888/chrome/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.pif", - elements: { - basicBox: { collapsed: false }, - normalBox: { collapsed: true } - } - }, - { // This URL will trigger the full UI - url: "http://mochi.test:8888/chrome/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.txt", - elements: { - basicBox: { collapsed: true }, - normalBox: { collapsed: false } - } - } -]; - -let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"]. - getService(Ci.nsIWindowWatcher); - -SimpleTest.waitForExplicitFinish(); - -let windowObserver = { - observe: function(aSubject, aTopic, aData) { - let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget); - - if (aTopic == "domwindowclosed") { - if (win.location == UCT_URI) - loadNextTest(); - return; - } - - // domwindowopened - win.addEventListener("load", function onLoad(event) { - win.removeEventListener("load", onLoad, false); - - // Let the dialog initialize - SimpleTest.executeSoon(function() { - checkWindow(win); - }); - }, false); - } -}; - -function init() { - ww.registerNotification(windowObserver); - loadNextTest(); -} - -function loadNextTest() { - if (!tests[++testIndex]) { - ww.unregisterNotification(windowObserver); - SimpleTest.finish(); - return; - } - let frame = document.getElementById("testframe"); - frame.setAttribute("src", tests[testIndex].url); -} - -function checkWindow(win) { - for (let [id, props] of Object.entries(tests[testIndex].elements)) { - let elem = win.dialog.dialogElement(id); - for (let [prop, value] of Object.entries(props)) { - is(elem[prop], value, - "Element with id " + id + " has property " + - prop + " set to " + value); - } - } - win.document.documentElement.cancelDialog(); -} - - ]]> - </script> - - <body xmlns="http://www.w3.org/1999/xhtml"> - <p id="display"></p> - <div id="content" style="display:none;"></div> - <pre id="test"></pre> - </body> - - <iframe xmlns="http://www.w3.org/1999/xhtml" - id="testframe"> - </iframe> -</window> diff --git a/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.pif b/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.pif deleted file mode 100644 index 9353d1312..000000000 --- a/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.pif +++ /dev/null @@ -1 +0,0 @@ -Dummy content for unknownContentType_dialog_layout_data.pif diff --git a/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.pif^headers^ b/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.pif^headers^ deleted file mode 100644 index 09b22facc..000000000 --- a/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.pif^headers^ +++ /dev/null @@ -1 +0,0 @@ -Content-Type: application/octet-stream diff --git a/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.txt b/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.txt deleted file mode 100644 index 77e719559..000000000 --- a/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.txt +++ /dev/null @@ -1 +0,0 @@ -Dummy content for unknownContentType_dialog_layout_data.txt diff --git a/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.txt^headers^ b/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.txt^headers^ deleted file mode 100644 index 2a3c472e2..000000000 --- a/toolkit/mozapps/downloads/tests/chrome/unknownContentType_dialog_layout_data.txt^headers^ +++ /dev/null @@ -1,2 +0,0 @@ -Content-Type: text/plain -Content-Disposition: attachment |