Bug 467438: EM tests are touching the network. r=robstrong, CLOSED TREE
authorDave Townsend <dtownsend@oxymoronical.com>
Mon, 01 Dec 2008 18:13:42 -0600
changeset 22141 8170fbbdb42686f5bf32d5995507ef56208dcaa7
parent 22140 2ad9a0f79e7db69871e8f65a243fb857698d4644
child 22142 501f6484deca54807a1c870a69e4630e16e09973
push id3821
push userdtownsend@mozilla.com
push dateTue, 02 Dec 2008 00:23:05 +0000
treeherderautoland@8170fbbdb426 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrobstrong, CLOSED
bugs467438
milestone1.9.2a1pre
Bug 467438: EM tests are touching the network. r=robstrong, CLOSED TREE
toolkit/mozapps/extensions/test/unit/test_bug396129.js
toolkit/mozapps/extensions/test/unit/test_bug428341.js
--- a/toolkit/mozapps/extensions/test/unit/test_bug396129.js
+++ b/toolkit/mozapps/extensions/test/unit/test_bug396129.js
@@ -34,16 +34,19 @@
  * the terms of any one of the MPL, the GPL or the LGPL
  *
  * ***** END LICENSE BLOCK *****
  */
 
 // Disables security checking our updates which haven't been signed
 gPrefs.setBoolPref("extensions.checkUpdateSecurity", false);
 
+// Use the internal webserver for regular update pings, will just return an error
+gPrefs.setCharPref("extensions.update.url", "http://localhost:4444/");
+
 // Get the HTTP server.
 do_import_script("netwerk/test/httpserver/httpd.js");
 var testserver;
 
 var next_state = null;
 var needs_compatibility = false;
 var next_test = null;
 
--- a/toolkit/mozapps/extensions/test/unit/test_bug428341.js
+++ b/toolkit/mozapps/extensions/test/unit/test_bug428341.js
@@ -31,16 +31,22 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL
  *
  * ***** END LICENSE BLOCK *****
  */
 
+// Use the internal webserver for regular update pings, will just return an error
+gPrefs.setCharPref("extensions.update.url", "http://localhost:4444/");
+
+do_import_script("netwerk/test/httpserver/httpd.js");
+var testserver;
+
 // This allows the EM to attempt to display errors to the user without failing
 var promptService = {
   alert: function(aParent, aDialogTitle, aText) {
   },
   
   alertCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
   },
   
@@ -227,16 +233,17 @@ var installListener = {
 
   onDownloadProgress: function onProgress(aAddon, aValue, aMaxValue) {
     do_throw("onDownloadProgress should not be called for a direct install");
   }
 }
 
 function installNextAddon() {
   if (gIndex >= ADDONS.length) {
+    testserver.stop();
     do_test_finished();
     return;
   }
 
   gNextState = "onInstallStarted";
   try {
     dump("Installing add-on " + ADDONS[gIndex].addon + "\n");
     gEM.installItemFromFile(do_get_addon(ADDONS[gIndex].addon),
@@ -249,10 +256,14 @@ function installNextAddon() {
 
 function run_test() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
   startupEM();
   gEM.addInstallListener(installListener);
   gIndex = 0;
   do_test_pending();
 
+  // Create and configure the HTTP server.
+  testserver = new nsHttpServer();
+  testserver.start(4444);
+
   installNextAddon();
 }