Test only fix - Bug 553763 - [SeaMonkey 2.1] mochitest-chrome: bug 530872 update ui tests time out. r=me
authorRobert Strong <robert.bugzilla@gmail.com>
Tue, 06 Apr 2010 19:49:46 -0700
changeset 40529 e0321787e483d7911834bfebee67811ba0f89c6e
parent 40528 8722c089c3e6ac924aab59828f01306927fbf286
child 40530 6f1a38b947547060aeb6967afb74f632a944d655
push idunknown
push userunknown
push dateunknown
reviewersme
bugs553763, 530872
milestone1.9.3a4pre
Test only fix - Bug 553763 - [SeaMonkey 2.1] mochitest-chrome: bug 530872 update ui tests time out. r=me
toolkit/mozapps/update/test/chrome/test_0011_check_billboard_noLicense_noAddons.xul
toolkit/mozapps/update/test/chrome/test_0012_check_billboard_noAddons.xul
toolkit/mozapps/update/test/chrome/test_0021_check_noBillboard_noLicense_noAddons.xul
toolkit/mozapps/update/test/chrome/test_0022_check_noBillboard_noAddons.xul
toolkit/mozapps/update/test/chrome/test_0031_available_billboard_noLicense_noAddons.xul
toolkit/mozapps/update/test/chrome/test_0032_available_billboard_noAddons.xul
toolkit/mozapps/update/test/chrome/test_0041_available_noBillboard_noLicense_noAddons.xul
toolkit/mozapps/update/test/chrome/test_0042_available_noBillboard_noAddons.xul
toolkit/mozapps/update/test/chrome/test_0053_check_billboard_license_noAttr.xul
toolkit/mozapps/update/test/chrome/test_0054_check_billboard_license_404.xul
toolkit/mozapps/update/test/chrome/test_0081_error_patchApplyFailure_partial_only.xul
toolkit/mozapps/update/test/chrome/test_0082_error_patchApplyFailure_complete_only.xul
toolkit/mozapps/update/test/chrome/test_0083_error_patchApplyFailure_partial_complete.xul
toolkit/mozapps/update/test/chrome/test_0084_error_patchApplyFailure_verify_failed.xul
toolkit/mozapps/update/test/chrome/test_0091_installed.xul
toolkit/mozapps/update/test/chrome/test_0092_finishedBackground.xul
toolkit/mozapps/update/test/chrome/test_0111_neverButton_billboard.xul
toolkit/mozapps/update/test/chrome/test_0112_neverButton_noBillboard.xul
toolkit/mozapps/update/test/chrome/utils.js
--- a/toolkit/mozapps/update/test/chrome/test_0011_check_billboard_noLicense_noAddons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0011_check_billboard_noLicense_noAddons.xul
@@ -60,17 +60,17 @@ SimpleTest.waitForExplicitFinish();
  * test preparation
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   removeUpdateDirsAndFiles();
   reloadUpdateManagerData();
 
-  var queryString = "?showBillboard=1&showDetails=1";
+  var queryString = "?showBillboard=1&showDetails=1" + getVersionParams();
   setUpdateURLOverride(URL_UPDATE + queryString);
 
   gNextFunc = test02;
   gPageId = PAGEID_CHECKING;
   gUP.checkForUpdates();
 }
 
 /**
--- a/toolkit/mozapps/update/test/chrome/test_0012_check_billboard_noAddons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0012_check_billboard_noAddons.xul
@@ -60,17 +60,18 @@ SimpleTest.waitForExplicitFinish();
  * test preparation
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   removeUpdateDirsAndFiles();
   reloadUpdateManagerData();
 
-  var queryString = "?showBillboard=1&showLicense=1&showDetails=1";
+  var queryString = "?showBillboard=1&showLicense=1&showDetails=1" +
+                    getVersionParams();
   setUpdateURLOverride(URL_UPDATE + queryString);
 
   gNextFunc = test02;
   gPageId = PAGEID_CHECKING;
   gUP.checkForUpdates();
 }
 
 /**
--- a/toolkit/mozapps/update/test/chrome/test_0021_check_noBillboard_noLicense_noAddons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0021_check_noBillboard_noLicense_noAddons.xul
@@ -60,17 +60,17 @@ SimpleTest.waitForExplicitFinish();
  * test preparation
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   removeUpdateDirsAndFiles();
   reloadUpdateManagerData();
 
-  var queryString = "?showDetails=1";
+  var queryString = "?showDetails=1" + getVersionParams();
   setUpdateURLOverride(URL_UPDATE + queryString);
 
   gNextFunc = test02;
   gPageId = PAGEID_CHECKING;
   gUP.checkForUpdates();
 }
 
 /**
--- a/toolkit/mozapps/update/test/chrome/test_0022_check_noBillboard_noAddons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0022_check_noBillboard_noAddons.xul
@@ -60,17 +60,17 @@ SimpleTest.waitForExplicitFinish();
  * test preparation
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   removeUpdateDirsAndFiles();
   reloadUpdateManagerData();
 
-  var queryString = "?showLicense=1&showDetails=1";
+  var queryString = "?showLicense=1&showDetails=1" + getVersionParams();
   setUpdateURLOverride(URL_UPDATE + queryString);
 
   gNextFunc = test02;
   gPageId = PAGEID_CHECKING;
   gUP.checkForUpdates();
 }
 
 /**
--- a/toolkit/mozapps/update/test/chrome/test_0031_available_billboard_noLicense_noAddons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0031_available_billboard_noLicense_noAddons.xul
@@ -61,17 +61,18 @@ SimpleTest.waitForExplicitFinish();
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   removeUpdateDirsAndFiles();
   reloadUpdateManagerData();
 
   gPref.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
-  var queryString = "?showBillboard=1&showDetails=1&showPrompt=1";
+  var queryString = "?showBillboard=1&showDetails=1&showPrompt=1" +
+                    getVersionParams();
   setUpdateURLOverride(URL_UPDATE + queryString);
 
   gNextFunc = test02;
   gPageId = PAGEID_FOUND_BILLBOARD;
   gAUS.notify(null);
 }
 
 /**
--- a/toolkit/mozapps/update/test/chrome/test_0032_available_billboard_noAddons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0032_available_billboard_noAddons.xul
@@ -61,17 +61,18 @@ SimpleTest.waitForExplicitFinish();
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   removeUpdateDirsAndFiles();
   reloadUpdateManagerData();
 
   gPref.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
-  var queryString = "?showBillboard=1&showLicense=1&showDetails=1&showPrompt=1";
+  var queryString = "?showBillboard=1&showLicense=1&showDetails=1" +
+                    "&showPrompt=1" + getVersionParams();
   setUpdateURLOverride(URL_UPDATE + queryString);
 
   gNextFunc = test02;
   gPageId = PAGEID_FOUND_BILLBOARD;
   gAUS.notify(null);
 }
 
 /**
--- a/toolkit/mozapps/update/test/chrome/test_0041_available_noBillboard_noLicense_noAddons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0041_available_noBillboard_noLicense_noAddons.xul
@@ -61,17 +61,17 @@ SimpleTest.waitForExplicitFinish();
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   removeUpdateDirsAndFiles();
   reloadUpdateManagerData();
 
   gPref.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
-  var queryString = "?showDetails=1&showPrompt=1";
+  var queryString = "?showDetails=1&showPrompt=1" + getVersionParams();
   setUpdateURLOverride(URL_UPDATE + queryString);
 
   gNextFunc = test02;
   gPageId = PAGEID_FOUND_BASIC;
   gAUS.notify(null);
 }
 
 /**
--- a/toolkit/mozapps/update/test/chrome/test_0042_available_noBillboard_noAddons.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0042_available_noBillboard_noAddons.xul
@@ -61,17 +61,18 @@ SimpleTest.waitForExplicitFinish();
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   removeUpdateDirsAndFiles();
   reloadUpdateManagerData();
 
   gPref.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
-  var queryString = "?showLicense=1&showDetails=1&showPrompt=1";
+  var queryString = "?showLicense=1&showDetails=1&showPrompt=1" +
+                    getVersionParams();
   setUpdateURLOverride(URL_UPDATE + queryString);
 
   gNextFunc = test02;
   gPageId = PAGEID_FOUND_BASIC;
   gAUS.notify(null);
 }
 
 /**
--- a/toolkit/mozapps/update/test/chrome/test_0053_check_billboard_license_noAttr.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0053_check_billboard_license_noAttr.xul
@@ -60,17 +60,18 @@ SimpleTest.waitForExplicitFinish();
  * test preparation
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   removeUpdateDirsAndFiles();
   reloadUpdateManagerData();
 
-  var queryString = "?showBillboard=1&showLicense=1&remoteNoTypeAttr=1&showDetails=1";
+  var queryString = "?showBillboard=1&showLicense=1&remoteNoTypeAttr=1" +
+                    "&showDetails=1" + getVersionParams();
   setUpdateURLOverride(URL_UPDATE + queryString);
 
   gNextFunc = test02;
   gPageId = PAGEID_CHECKING;
   gUP.checkForUpdates();
 }
 
 /**
--- a/toolkit/mozapps/update/test/chrome/test_0054_check_billboard_license_404.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0054_check_billboard_license_404.xul
@@ -60,17 +60,18 @@ SimpleTest.waitForExplicitFinish();
  * test preparation
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   removeUpdateDirsAndFiles();
   reloadUpdateManagerData();
 
-  var queryString = "?billboard404=1&license404=1&showDetails=1";
+  var queryString = "?billboard404=1&license404=1&showDetails=1" +
+                    getVersionParams();
   setUpdateURLOverride(URL_UPDATE + queryString);
 
   gNextFunc = test02;
   gPageId = PAGEID_CHECKING;
   gUP.checkForUpdates();
 }
 
 /**
--- a/toolkit/mozapps/update/test/chrome/test_0081_error_patchApplyFailure_partial_only.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0081_error_patchApplyFailure_partial_only.xul
@@ -59,17 +59,18 @@ SimpleTest.waitForExplicitFinish();
 /**
  * test preparation:
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   var patches = getLocalPatchString("partial", null, null, null, null, null,
                                     STATE_PENDING);
-  var updates = getLocalUpdateString(patches, "Existing", "major");
+  var updates = getLocalUpdateString(patches, null, null, null,
+                                     gApp.version, gApp.platformVersion);
 
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
 
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
   writeStatusFile(STATE_FAILED + ": " + CRC_ERROR);
   reloadUpdateManagerData();
 
   gNextFunc = test02;
--- a/toolkit/mozapps/update/test/chrome/test_0082_error_patchApplyFailure_complete_only.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0082_error_patchApplyFailure_complete_only.xul
@@ -59,17 +59,18 @@ SimpleTest.waitForExplicitFinish();
 /**
  * test preparation:
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   var patches = getLocalPatchString("complete", null, null, null, null, null,
                                     STATE_PENDING);
-  var updates = getLocalUpdateString(patches, "Existing", "major");
+  var updates = getLocalUpdateString(patches, null, null, null,
+                                     gApp.version, gApp.platformVersion);
 
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
 
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
   writeStatusFile(STATE_FAILED + ": " + CRC_ERROR);
   reloadUpdateManagerData();
 
   gNextFunc = test02;
--- a/toolkit/mozapps/update/test/chrome/test_0083_error_patchApplyFailure_partial_complete.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0083_error_patchApplyFailure_partial_complete.xul
@@ -63,17 +63,18 @@ function test01() {
   ok(true, "Entering test01 - test preparation");
 
   // Specify the url to update.sjs with a slowDownloadMar param so the ui can
   // load before the download completes.
   var slowDownloadURL = URL_UPDATE + "?slowDownloadMar=1";
   var patches = getLocalPatchString("partial", null, null, null, null, null,
                                     STATE_PENDING) +
                 getLocalPatchString("complete", slowDownloadURL);
-  var updates = getLocalUpdateString(patches);
+  var updates = getLocalUpdateString(patches, null, null, null,
+                                     gApp.version, gApp.platformVersion);
 
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
 
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
   writeStatusFile(STATE_FAILED + ": " + CRC_ERROR);
   reloadUpdateManagerData();
 
   gNextFunc = test02;
--- a/toolkit/mozapps/update/test/chrome/test_0084_error_patchApplyFailure_verify_failed.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0084_error_patchApplyFailure_verify_failed.xul
@@ -64,18 +64,18 @@ function test01() {
 
   // Specify the url to update.sjs with a slowDownloadMar param so the ui can
   // load before the download completes.
   var slowDownloadURL = URL_UPDATE + "?slowDownloadMar=1";
   var patches = getLocalPatchString("partial", null, null, null, null, null,
                                     STATE_PENDING) +
                 getLocalPatchString("complete", slowDownloadURL, "MD5",
                                     "1234cd43a1c77e30191c53a329a3f99d");
-
-  var updates = getLocalUpdateString(patches);
+  var updates = getLocalUpdateString(patches, null, null, null,
+                                     gApp.version, gApp.platformVersion);
 
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
 
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
   writeStatusFile(STATE_FAILED + ": " + CRC_ERROR);
   reloadUpdateManagerData();
 
   gNextFunc = test02;
--- a/toolkit/mozapps/update/test/chrome/test_0091_installed.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0091_installed.xul
@@ -60,17 +60,18 @@ SimpleTest.waitForExplicitFinish();
  * test preparation:
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   gPref.setBoolPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI, true);
   var patches = getLocalPatchString("complete", null, null, null, null, null,
                                     STATE_PENDING);
-  var updates = getLocalUpdateString(patches);
+  var updates = getLocalUpdateString(patches, null, null, null,
+                                     gApp.version, gApp.platformVersion);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
   writeStatusFile(STATE_SUCCEEDED);
 
   gNextFunc = test02;
   gPageId = PAGEID_INSTALLED;
   initUpdateServiceStub();
 }
--- a/toolkit/mozapps/update/test/chrome/test_0092_finishedBackground.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0092_finishedBackground.xul
@@ -59,17 +59,18 @@ SimpleTest.waitForExplicitFinish();
 /**
  * test preparation:
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   var patches = getLocalPatchString("complete", null, null, null, null, null,
                                     STATE_PENDING);
-  var updates = getLocalUpdateString(patches);
+  var updates = getLocalUpdateString(patches, null, null, null,
+                                     gApp.version, gApp.platformVersion);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
   writeStatusFile(STATE_SUCCEEDED);
 
   reloadUpdateManagerData();
 
   is(gUpdateManager.activeUpdate.state, "pending",
      "The active update should have a state of pending");
--- a/toolkit/mozapps/update/test/chrome/test_0111_neverButton_billboard.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0111_neverButton_billboard.xul
@@ -51,31 +51,31 @@
 <script type="application/javascript"
         src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
-const gNeverPref = PREF_APP_UPDATE_NEVER_BRANCH + "99.9";
+const gNeverPref = PREF_APP_UPDATE_NEVER_BRANCH + gApp.version;
 
 /**
  * test preparation
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   ok(!gPref.prefHasUserValue(gNeverPref),
      "preference " + gNeverPref + " should not have a user value");
 
   removeUpdateDirsAndFiles();
   reloadUpdateManagerData();
 
-  var queryString = "?showBillboard=1&showNever=1";
+  var queryString = "?showBillboard=1&showNever=1" + getVersionParams();
   setUpdateURLOverride(URL_UPDATE + queryString);
 
   // add the never preference for this version to verify that checking for
   // updates clears the preference.
   gPref.setBoolPref(gNeverPref, true)
 
   gNextFunc = test02;
   gPageId = PAGEID_FOUND_BILLBOARD;
--- a/toolkit/mozapps/update/test/chrome/test_0112_neverButton_noBillboard.xul
+++ b/toolkit/mozapps/update/test/chrome/test_0112_neverButton_noBillboard.xul
@@ -51,31 +51,31 @@
 <script type="application/javascript"
         src="chrome://mochikit/content/chrome/toolkit/mozapps/update/test/chrome/utils.js"/>
 
 <script type="application/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
-const gNeverPref = PREF_APP_UPDATE_NEVER_BRANCH + "99.9";
+const gNeverPref = PREF_APP_UPDATE_NEVER_BRANCH + gApp.version;
 
 /**
  * test preparation
  */
 function test01() {
   ok(true, "Entering test01 - test preparation");
 
   ok(!gPref.prefHasUserValue(gNeverPref),
      "preference " + gNeverPref + " should not have a user value");
 
   removeUpdateDirsAndFiles();
   reloadUpdateManagerData();
 
-  var queryString = "?showNever=1&showDetails=1";
+  var queryString = "?showNever=1&showDetails=1" + getVersionParams();
   setUpdateURLOverride(URL_UPDATE + queryString);
 
   // add the never preference for this version to verify that checking for
   // updates clears the preference.
   gPref.setBoolPref(gNeverPref, true)
 
   gNextFunc = test02;
   gPageId = PAGEID_FOUND_BASIC;
--- a/toolkit/mozapps/update/test/chrome/utils.js
+++ b/toolkit/mozapps/update/test/chrome/utils.js
@@ -99,16 +99,28 @@ function finishTestDefault() {
 
 __defineGetter__("gWW", function() {
   delete this.gWW;
   return this.gWW = AUS_Cc["@mozilla.org/embedcomp/window-watcher;1"].
                       getService(AUS_Ci.nsIWindowWatcher);
 });
 
 
+__defineGetter__("gApp", function() {
+  delete this.gApp;
+  return this.gApp = AUS_Cc["@mozilla.org/xre/app-info;1"].
+                     getService(AUS_Ci.nsIXULAppInfo).
+                     QueryInterface(AUS_Ci.nsIXULRuntime);
+});
+
+function getVersionParams() {
+  return "&appVersion=" + gApp.version +
+         "&platformVersion=" + gApp.platformVersion;
+}
+
 /**
  * Closes the update window in case a previous test failed to do so.
  */
 function closeUpdateWindow() {
   var updateWindow = getUpdateWindow();
   if (!updateWindow)
     return;