Bug 586802 - e10s http: fix test_httpcancel.js. r=jduell, a=wewanttoshipafennecalpha
authorDan Witte <dwitte@mozilla.com>
Thu, 12 Aug 2010 16:09:16 -0700
changeset 50563 6ee35465efab8cd76e59c4b0147241b3751d0690
parent 50562 d31ddf6547d748569f7d07a346b2179b157ff445
child 50564 6a52899cc5b2331a8cfa540192511712445c5ad6
push idunknown
push userunknown
push dateunknown
reviewersjduell, wewanttoshipafennecalpha
bugs586802
milestone2.0b4pre
Bug 586802 - e10s http: fix test_httpcancel.js. r=jduell, a=wewanttoshipafennecalpha
netwerk/test/unit/test_httpcancel.js
--- a/netwerk/test/unit/test_httpcancel.js
+++ b/netwerk/test/unit/test_httpcancel.js
@@ -1,15 +1,14 @@
 // This file ensures that canceling a channel early does not
 // send the request to the server (bug 350790)
 
 do_load_httpd_js();
 
 const NS_BINDING_ABORTED = 0x804b0002;
-const TEST_COUNT = 2;
 
 var observer = {
   QueryInterface: function eventsink_qi(iid) {
     if (iid.equals(Components.interfaces.nsISupports) ||
         iid.equals(Components.interfaces.nsIObserver))
       return this;
     throw Components.results.NS_ERROR_NO_INTERFACE;
   },
@@ -29,62 +28,47 @@ var listener = {
     do_check_eq(request.status, NS_BINDING_ABORTED);
   },
 
   onDataAvailable: function test_ODA() {
     do_throw("Should not get any data!");
   },
 
   onStopRequest: function test_onStopR(request, ctx, status) {
-    this.currentTest++;
-    if (this.currentTest == TEST_COUNT)
-      httpserv.stop(do_test_finished);
-    else
-      execute_test(this.currentTest)
-  },
-
-  currentTest : 0
+    httpserv.stop(do_test_finished);
+  }
 };
 
 function makeChan(url) {
   var ios = Components.classes["@mozilla.org/network/io-service;1"]
                       .getService(Components.interfaces.nsIIOService);
   var chan = ios.newChannel(url, null, null)
                 .QueryInterface(Components.interfaces.nsIHttpChannel);
 
   return chan;
 }
 
 var httpserv = null;
 
-function execute_test(id) {
-  if (id < 0 || id >= TEST_COUNT)
-    do_throw("Invalid test id.");
-
+function execute_test() {
   var chan = makeChan("http://localhost:4444/failtest");
  
-  if (id == 0) { 
-    listener.shouldNotStart = true;
-    var obs = Components.classes["@mozilla.org/observer-service;1"].getService();
-    obs = obs.QueryInterface(Components.interfaces.nsIObserverService);
-    obs.addObserver(observer, "http-on-modify-request", false); 
-  }
+  var obs = Components.classes["@mozilla.org/observer-service;1"].getService();
+  obs = obs.QueryInterface(Components.interfaces.nsIObserverService);
+  obs.addObserver(observer, "http-on-modify-request", false); 
  
   chan.asyncOpen(listener, null);
-
-  if (id == 1) 
-    chan.cancel(NS_BINDING_ABORTED);
 }
 
 function run_test() {
   httpserv = new nsHttpServer();
   httpserv.registerPathHandler("/failtest", failtest);
   httpserv.start(4444);
   
-  execute_test(0);
+  execute_test();
 
   do_test_pending();
 }
 
 // PATHS
 
 // /failtest
 function failtest(metadata, response) {