3. tests patch - Bug 843497 - Update check says 'up to date' for out of date versions on unsupported OS versions. r=bbondy
☠☠ backed out by 089f6bad69de ☠ ☠
authorRobert Strong <robert.bugzilla@gmail.com>
Fri, 21 Jun 2013 18:11:25 -0700
changeset 136025 01bc57172461b13e4a0ce1febd6eb1ec7dbaeddf
parent 136024 c8b6ccf5b6dbd5b1f5a68205c17df001f9f71dcc
child 136026 1b81a9c888729c14728976b8e3e25f0d29b44938
push id29928
push userrstrong@mozilla.com
push dateSat, 22 Jun 2013 01:11:34 +0000
treeherdermozilla-inbound@01bc57172461 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy
bugs3, 843497
milestone24.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
3. tests patch - Bug 843497 - Update check says 'up to date' for out of date versions on unsupported OS versions. r=bbondy
toolkit/mozapps/update/test/chrome/Makefile.in
toolkit/mozapps/update/test/chrome/test_0161_check_unsupported.xul
toolkit/mozapps/update/test/chrome/test_0162_notify_unsupported.xul
toolkit/mozapps/update/test/chrome/update.sjs
toolkit/mozapps/update/test/chrome/utils.js
toolkit/mozapps/update/test/shared.js
--- a/toolkit/mozapps/update/test/chrome/Makefile.in
+++ b/toolkit/mozapps/update/test/chrome/Makefile.in
@@ -76,16 +76,18 @@ MOCHITEST_CHROME_FILES += \
   test_0121_check_requireBuiltinCert.xul \
   test_0122_check_allowNonBuiltinCert_validCertAttrs.xul \
   test_0123_check_allowNonBuiltinCert_noCertAttrsCheck.xul \
   test_0131_check_invalidCertAttrs_noUpdate.xul \
   test_0132_check_invalidCertAttrs_hasUpdate.xul \
   test_0141_notify_invalidCertAttrs_noUpdate.xul \
   test_0142_notify_invalidCertAttrs_hasUpdate.xul \
   test_0151_notify_backgroundCheckError.xul \
+  test_0161_check_unsupported.xul \
+  test_0162_notify_unsupported.xul \
   test_0900_deprecatedUpdateFormat_minor.xul \
   test_0901_deprecatedUpdateFormat_major.xul \
   test_9999_cleanup.xul \
   $(NULL)
 
 
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/update/test/chrome/test_0161_check_unsupported.xul
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<!--
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+-->
+
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window title="Test checking for updates when system is no longer supported (bug 843497)"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        onload="runTestDefault();">
+<script type="application/javascript"
+        src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+<script type="application/javascript"
+        src="utils.js"/>
+
+<script type="application/javascript">
+<![CDATA[
+
+const TESTS = [ {
+  pageid: PAGEID_CHECKING
+}, {
+  pageid: PAGEID_UNSUPPORTED,
+  buttonClick: "finish"
+} ];
+
+function runTest() {
+  debugDump("entering");
+
+  // When checking manually the unsupported page should still be shown even if
+  // it was shown previously.
+  Services.prefs.setBoolPref(PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED, true);
+
+  let url = URL_UPDATE + "?unsupported=1";
+  setUpdateURLOverride(url);
+
+  gUP.checkForUpdates();
+}
+
+]]>
+</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>
+</window>
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/update/test/chrome/test_0162_notify_unsupported.xul
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!--
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+-->
+
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window title="Test notification of updates when system is no longer supported (bug 843497)"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        onload="runTestDefault();">
+<script type="application/javascript"
+        src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+<script type="application/javascript"
+        src="utils.js"/>
+
+<script type="application/javascript">
+<![CDATA[
+
+const TESTS = [ {
+  pageid: PAGEID_UNSUPPORTED,
+  buttonClick: "finish"
+} ];
+
+function runTest() {
+  debugDump("entering");
+
+  let url = URL_UPDATE + "?unsupported=1";
+  setUpdateURLOverride(url);
+
+  gAUS.notify(null);
+}
+
+]]>
+</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>
+</window>
--- a/toolkit/mozapps/update/test/chrome/update.sjs
+++ b/toolkit/mozapps/update/test/chrome/update.sjs
@@ -82,16 +82,24 @@ function handleRequest(aRequest, aRespon
     return;
   }
 
   if (params.noUpdates) {
     aResponse.write(getRemoteUpdatesXMLString(""));
     return;
   }
 
+  if (params.unsupported) {
+    aResponse.write(getRemoteUpdatesXMLString("  <update type=\"major\" " +
+                                              "unsupported=\"true\" " +
+                                              "detailsURL=\"" + URL_HOST +
+                                              "\"></update>\n"));
+    return;
+  }
+
   var hash;
   var patches = "";
   if (!params.partialPatchOnly) {
     hash = SHA512_HASH_SIMPLE_MAR + (params.invalidCompleteHash ? "e" : "");
     patches += getRemotePatchString("complete", SERVICE_URL, "SHA512",
                                     hash, SIZE_SIMPLE_MAR);
   }
 
--- a/toolkit/mozapps/update/test/chrome/utils.js
+++ b/toolkit/mozapps/update/test/chrome/utils.js
@@ -118,16 +118,17 @@ Components.utils.import("resource://gre/
 
 // The tests have to use the pageid instead of the pageIndex due to the
 // app update wizard's access method being random.
 const PAGEID_DUMMY            = "dummy";                 // Done
 const PAGEID_CHECKING         = "checking";              // Done
 const PAGEID_PLUGIN_UPDATES   = "pluginupdatesfound";
 const PAGEID_NO_UPDATES_FOUND = "noupdatesfound";        // Done
 const PAGEID_MANUAL_UPDATE    = "manualUpdate"; // Tested on license load failure
+const PAGEID_UNSUPPORTED      = "unsupported";           // Done
 const PAGEID_INCOMPAT_CHECK   = "incompatibleCheck";     // Done
 const PAGEID_FOUND_BASIC      = "updatesfoundbasic";     // Done
 const PAGEID_FOUND_BILLBOARD  = "updatesfoundbillboard"; // Done
 const PAGEID_LICENSE          = "license";               // Done
 const PAGEID_INCOMPAT_LIST    = "incompatibleList";      // Done
 const PAGEID_DOWNLOADING      = "downloading";           // Done
 const PAGEID_ERRORS           = "errors";                // Done
 const PAGEID_ERROR_EXTRA      = "errorextra";            // Done
@@ -548,16 +549,17 @@ function getExpectedButtonStates() {
                next  : { disabled: false, hidden: false } };
     case PAGEID_INCOMPAT_LIST:
       return { extra1: { disabled: false, hidden: false },
                next  : { disabled: false, hidden: false } };
     case PAGEID_DOWNLOADING:
       return { extra1: { disabled: false, hidden: false } };
     case PAGEID_NO_UPDATES_FOUND:
     case PAGEID_MANUAL_UPDATE:
+    case PAGEID_UNSUPPORTED:
     case PAGEID_ERRORS:
     case PAGEID_ERROR_EXTRA:
     case PAGEID_INSTALLED:
       return { finish: { disabled: false, hidden: false } };
     case PAGEID_ERROR_PATCHING:
       return { next  : { disabled: false, hidden: false } };
     case PAGEID_FINISHED:
     case PAGEID_FINISHED_BKGRD:
@@ -957,16 +959,20 @@ function resetPrefs() {
   if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_URL_DETAILS)) {
     Services.prefs.clearUserPref(PREF_APP_UPDATE_URL_DETAILS);
   }
 
   if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_SHOW_INSTALLED_UI)) {
     Services.prefs.clearUserPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI);
   }
 
+  if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED)) {
+    Services.prefs.clearUserPref(PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED);
+  }
+
   if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_LOG)) {
     Services.prefs.clearUserPref(PREF_APP_UPDATE_LOG);
   }
 
   if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_CERT_ERRORS)) {
     Services.prefs.clearUserPref(PREF_APP_UPDATE_CERT_ERRORS);
   }
 
--- a/toolkit/mozapps/update/test/shared.js
+++ b/toolkit/mozapps/update/test/shared.js
@@ -21,16 +21,17 @@ const PREF_APP_UPDATE_CERT_ERRORS       
 const PREF_APP_UPDATE_CERT_MAXERRORS      = "app.update.cert.maxErrors";
 const PREF_APP_UPDATE_CERT_REQUIREBUILTIN = "app.update.cert.requireBuiltIn";
 const PREF_APP_UPDATE_CHANNEL             = "app.update.channel";
 const PREF_APP_UPDATE_ENABLED             = "app.update.enabled";
 const PREF_APP_UPDATE_METRO_ENABLED       = "app.update.metro.enabled";
 const PREF_APP_UPDATE_IDLETIME            = "app.update.idletime";
 const PREF_APP_UPDATE_LOG                 = "app.update.log";
 const PREF_APP_UPDATE_NEVER_BRANCH        = "app.update.never.";
+const PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED = "app.update.notifiedUnsupported";
 const PREF_APP_UPDATE_PROMPTWAITTIME      = "app.update.promptWaitTime";
 const PREF_APP_UPDATE_SERVICE_ENABLED     = "app.update.service.enabled";
 const PREF_APP_UPDATE_SHOW_INSTALLED_UI   = "app.update.showInstalledUI";
 const PREF_APP_UPDATE_SILENT              = "app.update.silent";
 const PREF_APP_UPDATE_STAGING_ENABLED     = "app.update.staging.enabled";
 const PREF_APP_UPDATE_URL                 = "app.update.url";
 const PREF_APP_UPDATE_URL_DETAILS         = "app.update.url.details";
 const PREF_APP_UPDATE_URL_OVERRIDE        = "app.update.url.override";