Bug 1250453 - Remove getNotInstalled test. r=myk
authorMarco Castelluccio <mcastelluccio@mozilla.com>
Mon, 14 Mar 2016 16:28:45 +0000
changeset 288561 f8c0b81cce33c310c142e125a3680471a6e13b7a
parent 288560 61492626c26afd375cfd7982e7fb751fa45a5f45
child 288562 5b9c66a957c23df049aa85a7a5a048f6c00973c7
push id73456
push usermcastelluccio@mozilla.com
push dateMon, 14 Mar 2016 16:31:16 +0000
treeherdermozilla-inbound@81fb57cf9486 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmyk
bugs1250453
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1250453 - Remove getNotInstalled test. r=myk
dom/apps/tests/chrome.ini
dom/apps/tests/test_getNotInstalled.xul
--- a/dom/apps/tests/chrome.ini
+++ b/dom/apps/tests/chrome.ini
@@ -11,17 +11,16 @@ support-files =
   install_and_redirect_helper.xul
 
 [test_apps_service.xul]
 [test_bug_765063.xul]
 [test_bug_771294.xul]
 [test_bug_945152.html]
 skip-if = os != 'linux'
 [test_cross_origin.xul]
-[test_getNotInstalled.xul]
 [test_install_app.xul]
 [test_install_errors.xul]
 [test_install_utf8.xul]
 [test_launch_paths.xul]
 [test_list_api.xul]
 [test_manifest_helper.xul]
 [test_operator_app_install.js]
 [test_operator_app_install.xul]
deleted file mode 100644
--- a/dom/apps/tests/test_getNotInstalled.xul
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- Any copyright is dedicated to the Public Domain.
-   - http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
-<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
-
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        title="Mozilla Bug 781379">
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-  <script type="application/javascript" src="head.js"/>
-  <!-- test results are displayed in the html:body -->
-  <body xmlns="http://www.w3.org/1999/xhtml">
-  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=741549"
-     target="_blank">Mozilla Bug 781379</a>
-  </body>
-
-<script type="application/javascript;version=1.8">
-
-Cu.import("resource://gre/modules/Webapps.jsm");
-
-// We use a different origin than other webapps test files because we compare
-// the number of apps before and after installing this one; and if a test file
-// installs our app and then doesn't uninstall it (f.e. because it isn't written
-// to clean up after itself, or because it throws an exception or times out),
-// then this test will *reinstall* the app, and the number of apps won't change,
-// which will look like a failure in this test although it's actually a failure
-// in the other one.
-//
-// Using a different origin here isn't a foolproof solution, as another test
-// could start using it.  Reviewer vigilance is required!  And to anyone reading
-// this: don't use this origin without good reason and due consideration for
-// the potential consequences!
-//
-// Alternately, we could define a test-specific domain, getNotInstalled.com,
-// in source/build/pgo/server-locations.txt.  But that seems like overkill,
-// and this problem will go away once we support multiple apps per origin,
-// since then we can make this test install its own personal webapp from any
-// origin.
-//
-let url = "http://example.com/chrome/dom/apps/tests/apps/basic.webapp";
-
-let app, notInstalled, _isLaunchable;
-
-let steps = [
-  monkeyPatchDOMApplicationRegistry,
-  getNotInstalled,
-  installApp,
-  compareNotInstalled,
-  unmonkeyPatchDOMApplicationRegistry,
-  uninstallApp,
-];
-
-runAll(steps);
-
-// Monkey patch DOMApplicationRegistry._isLaunchable for testing.
-// This way, we don't have to create a platform specific application with a
-// status other than "installed".
-function monkeyPatchDOMApplicationRegistry(next) {
-  _isLaunchable = DOMApplicationRegistry._isLaunchable;
-  DOMApplicationRegistry._isLaunchable = function mockIsLaunchable(aOrigin) {
-    return false;
-  }
-  next();
-}
-
-// Call navigator.mozApps.mgmt.getNotInstalled and save the result.
-function getNotInstalled(next) {
-  window.navigator.mozApps.mgmt.getNotInstalled().onsuccess =
-  function onGetNotInstalled() {
-    notInstalled = this.result.length;
-    next();
-  };
-}
-
-// Add an app to the appregistry
-function installApp(next) {
-  confirmNextPopup();
-  navigator.mozApps.install(url, null).onsuccess = function onInstall() {
-    app = this.result;
-    next();
-  };
-}
-
-// Call navigator.mozApps.mgmt.getNotInstalled and make sure there is one more.
-function compareNotInstalled(next) {
-  let results;
-  function getNotInstalledError() {
-    ok(false, "window.mozApps.mgmt.getNotInstalled onerror called");
-    next();
-  }
-  function getNotInstalledSuccess() {
-    ok(true, "window.mozApps.mgmt.getNotInstalled onsuccess called");
-    is(this.result.length, notInstalled + 1,
-       "should get one more notInstalled app");
-
-    if (this.result.length > 0) {
-      is(this.result[this.result.length-1].origin, "http://example.com",
-         "getNotInstalled returned the expected app");
-    }
-    next();
-  }
-
-  let type = typeof window.navigator.mozApps.getNotInstalled;
-  is(type, "undefined", "getNotInstalled moved from window.navigator");
-  type = typeof window.navigator.mozApps.mgmt.getNotInstalled;
-  if (type === "function") {
-    is(type, "function", "getNotInstalled moved to window.navigator.mgmt");
-    results = window.navigator.mozApps.mgmt.getNotInstalled();
-    results.onerror = getNotInstalledError;
-    results.onsuccess = getNotInstalledSuccess;
-  } else {
-    ok(false, "getNotInstalled not a function");
-    next();
-  }
-}
-
-function unmonkeyPatchDOMApplicationRegistry(next) {
-  if (typeof _isLaunchable === "function") {
-    DOMApplicationRegistry._isLaunchable = _isLaunchable;
-    ok(true, "restored DOMApplicationRegistry._isLaunchable");
-  } else {
-    ok(false, "can't restore DOMApplicationRegistry._isLaunchable");
-  }
-  next();
-}
-
-// Remove the app from the appregistry
-function uninstallApp(next) {
-  confirmNextPopup();
-  window.navigator.mozApps.mgmt.uninstall(app).onsuccess = function onUninstall() {
-    app = null;
-    next();
-  }
-}
-
-</script>
-</window>