Bug 610654 - test failure xpcshell/tests/netwerk/test/unit/test_bug596443.js | Response1 == Response0, r=bz, a=bz
authorbjarne@runitsoft.com
Wed, 10 Nov 2010 13:21:48 +0200
changeset 57200 45d981693fe0681d8ffca08e635bf67de90aa807
parent 57199 df1d1ff6b48909528d670a829e3be11e12cbe38c
child 57201 212a391d3b79caa2e953bb70e4a00460089e844e
push id16844
push useropettay@mozilla.com
push dateWed, 10 Nov 2010 11:22:33 +0000
treeherdermozilla-central@45d981693fe0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, bz
bugs610654, 596443
milestone2.0b8pre
first release with
nightly win64
45d981693fe0 / 4.0b8pre / 20101110055540 / files
nightly linux32
nightly linux64
nightly mac
nightly win32
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly win64
Bug 610654 - test failure xpcshell/tests/netwerk/test/unit/test_bug596443.js | Response1 == Response0, r=bz, a=bz
netwerk/test/unit/test_bug596443.js
--- a/netwerk/test/unit/test_bug596443.js
+++ b/netwerk/test/unit/test_bug596443.js
@@ -10,24 +10,26 @@ function setupChannel(suffix, flags) {
     var ios = Components.classes["@mozilla.org/network/io-service;1"]
             .getService(Ci.nsIIOService);
     var chan = ios.newChannel("http://localhost:4444" + suffix, "", null);
     if (flags)
         chan.loadFlags |= flags;
     return chan;
 }
 
-function Listener(response, finalResponse) {
+function Listener(response, finalResponse, chainedHandler) {
     this._response = response;
     this._finalResponse = finalResponse;
+    this._chainedHandler = chainedHandler;
 }
 Listener.prototype = {
     _response: null,
     _buffer: null,
     _finalResponse: false,
+    _chainedHandler: undefined,
 
     QueryInterface: function(iid) {
         if (iid.equals(Components.interfaces.nsIStreamListener) ||
             iid.equals(Components.interfaces.nsIRequestObserver) ||
             iid.equals(Components.interfaces.nsISupports))
           return this;
         throw Components.results.NS_ERROR_NO_INTERFACE;
     },
@@ -40,47 +42,46 @@ Listener.prototype = {
     },
     onStopRequest: function (request, ctx, status) {
         var expected = "Response"+this._response;
         do_check_eq(this._buffer, expected);
         if (this._finalResponse)
             do_timeout(10, function() {
                         httpserver.stop(do_test_finished);
                     });
+        if (this._chainedHandler != undefined)
+            do_timeout(10, initialHandlers[this._chainedHandler]);
     }
 };
 
 function run_test() {
     httpserver.registerPathHandler("/bug596443", handler);
     httpserver.start(4444);
 
     // make sure we have a profile so we can use the disk-cache
     do_get_profile();
 
     // clear cache
     getCacheService().evictEntries(
             Components.interfaces.nsICache.STORE_ANYWHERE);
 
     var ch0 = setupChannel("/bug596443", Ci.nsIRequest.LOAD_BYPASS_CACHE);
-    ch0.asyncOpen(new Listener(0), null);
+    ch0.asyncOpen(new Listener(0, false), null);
 
     var ch1 = setupChannel("/bug596443", Ci.nsIRequest.LOAD_BYPASS_CACHE);
-    ch1.asyncOpen(new Listener(1), null);
+    ch1.asyncOpen(new Listener(1, false, 0), null);
 
     var ch2 = setupChannel("/bug596443");
     ch2.asyncOpen(new Listener(1, true), null); // Note param: we expect this to come from cache
 
     do_test_pending();
 }
 
 function triggerHandlers() {
-    do_timeout(100, function() {
-        do_timeout(100, initialHandlers[1]);
-        do_timeout(100, initialHandlers[0]);
-    });
+    do_timeout(100, initialHandlers[1]);
 }
 
 var initialHandlers = [];
 var handlerNo = 0;
 function handler(metadata, response) {
     var func = function(body) {
         return function() {
             response.setStatusLine(metadata.httpVersion, 200, "Ok");