diff options
Diffstat (limited to 'devtools/client/webide/test/test_addons.html')
-rw-r--r-- | devtools/client/webide/test/test_addons.html | 176 |
1 files changed, 0 insertions, 176 deletions
diff --git a/devtools/client/webide/test/test_addons.html b/devtools/client/webide/test/test_addons.html deleted file mode 100644 index 5a1bc7504..000000000 --- a/devtools/client/webide/test/test_addons.html +++ /dev/null @@ -1,176 +0,0 @@ -<!DOCTYPE html> - -<html> - - <head> - <meta charset="utf8"> - <title></title> - - <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> - <script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script> - <script type="application/javascript;version=1.8" src="head.js"></script> - <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"> - </head> - - <body> - - <script type="application/javascript;version=1.8"> - window.onload = function() { - SimpleTest.waitForExplicitFinish(); - - const {GetAvailableAddons} = require("devtools/client/webide/modules/addons"); - const {Devices} = Cu.import("resource://devtools/shared/apps/Devices.jsm"); - const {Simulators} = require("devtools/client/webide/modules/simulators"); - - let adbAddonsInstalled = promise.defer(); - Devices.on("addon-status-updated", function onUpdate1() { - Devices.off("addon-status-updated", onUpdate1); - adbAddonsInstalled.resolve(); - }); - - function getVersion(name) { - return name.match(/(\d+\.\d+)/)[0]; - } - - function onSimulatorInstalled(name) { - let deferred = promise.defer(); - Simulators.on("updated", function onUpdate() { - Simulators.findSimulatorAddons().then(addons => { - for (let addon of addons) { - if (name == addon.name.replace(" Simulator", "")) { - Simulators.off("updated", onUpdate); - nextTick().then(deferred.resolve); - return; - } - } - }); - }); - return deferred.promise; - } - - function installSimulatorFromUI(doc, name) { - let li = doc.querySelector('[addon="simulator-' + getVersion(name) + '"]'); - li.querySelector(".install-button").click(); - return onSimulatorInstalled(name); - } - - function uninstallSimulatorFromUI(doc, name) { - let deferred = promise.defer(); - Simulators.on("updated", function onUpdate() { - nextTick().then(() => { - let li = doc.querySelector('[status="uninstalled"][addon="simulator-' + getVersion(name) + '"]'); - if (li) { - Simulators.off("updated", onUpdate); - deferred.resolve(); - } else { - deferred.reject("Can't find item"); - } - }); - }); - let li = doc.querySelector('[status="installed"][addon="simulator-' + getVersion(name) + '"]'); - li.querySelector(".uninstall-button").click(); - return deferred.promise; - } - - function uninstallADBFromUI(doc) { - let deferred = promise.defer(); - Devices.on("addon-status-updated", function onUpdate() { - nextTick().then(() => { - let li = doc.querySelector('[status="uninstalled"][addon="adb"]'); - if (li) { - Devices.off("addon-status-updated", onUpdate); - deferred.resolve(); - } else { - deferred.reject("Can't find item"); - } - }) - }); - let li = doc.querySelector('[status="installed"][addon="adb"]'); - li.querySelector(".uninstall-button").click(); - return deferred.promise; - } - - Task.spawn(function*() { - - ok(!Devices.helperAddonInstalled, "Helper not installed"); - - let win = yield openWebIDE(true); - let docRuntime = getRuntimeDocument(win); - - yield adbAddonsInstalled.promise; - - ok(Devices.helperAddonInstalled, "Helper has been auto-installed"); - - yield nextTick(); - - let addons = yield GetAvailableAddons(); - - is(addons.simulators.length, 3, "3 simulator addons to install"); - - let sim10 = addons.simulators.filter(a => a.version == "1.0")[0]; - sim10.install(); - - yield onSimulatorInstalled("Firefox OS 1.0"); - - win.Cmds.showAddons(); - - let frame = win.document.querySelector("#deck-panel-addons"); - let addonDoc = frame.contentWindow.document; - let lis; - - lis = addonDoc.querySelectorAll("li"); - is(lis.length, 5, "5 addons listed"); - - lis = addonDoc.querySelectorAll('li[status="installed"]'); - is(lis.length, 3, "3 addons installed"); - - lis = addonDoc.querySelectorAll('li[status="uninstalled"]'); - is(lis.length, 2, "2 addons uninstalled"); - - info("Uninstalling Simulator 2.0"); - - yield installSimulatorFromUI(addonDoc, "Firefox OS 2.0"); - - info("Uninstalling Simulator 3.0"); - - yield installSimulatorFromUI(addonDoc, "Firefox OS 3.0"); - - yield nextTick(); - - let panelNode = docRuntime.querySelector("#runtime-panel"); - let items; - - items = panelNode.querySelectorAll(".runtime-panel-item-usb"); - is(items.length, 1, "Found one runtime button"); - - items = panelNode.querySelectorAll(".runtime-panel-item-simulator"); - is(items.length, 3, "Found 3 simulators button"); - - yield uninstallSimulatorFromUI(addonDoc, "Firefox OS 1.0"); - yield uninstallSimulatorFromUI(addonDoc, "Firefox OS 2.0"); - yield uninstallSimulatorFromUI(addonDoc, "Firefox OS 3.0"); - - items = panelNode.querySelectorAll(".runtime-panel-item-simulator"); - is(items.length, 0, "No simulator listed"); - - let w = addonDoc.querySelector(".warning"); - let display = addonDoc.defaultView.getComputedStyle(w).display - is(display, "none", "Warning about missing ADB hidden"); - - yield uninstallADBFromUI(addonDoc, "adb"); - - items = panelNode.querySelectorAll(".runtime-panel-item-usb"); - is(items.length, 0, "No usb runtime listed"); - - display = addonDoc.defaultView.getComputedStyle(w).display - is(display, "block", "Warning about missing ADB present"); - - yield closeWebIDE(win); - - SimpleTest.finish(); - - }); - } - </script> - </body> -</html> |