From: isaacs Date: Thu, 13 Dec 2012 17:52:08 +0000 (-0800) Subject: test: Fix many tests for http streams2 refactor X-Git-Tag: v0.9.4~42^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0977638ffb016c9e1ace5a9f6299d4bd4c27688c;p=platform%2Fupstream%2Fnodejs.git test: Fix many tests for http streams2 refactor --- diff --git a/test/simple/test-cluster-http-pipe.js b/test/simple/test-cluster-http-pipe.js index 46d429a..7123bf6 100644 --- a/test/simple/test-cluster-http-pipe.js +++ b/test/simple/test-cluster-http-pipe.js @@ -53,6 +53,7 @@ http.createServer(function(req, res) { }).listen(common.PIPE, function() { var self = this; http.get({ socketPath: common.PIPE, path: '/' }, function(res) { + res.resume(); res.on('end', function(err) { if (err) throw err; process.send('DONE'); diff --git a/test/simple/test-domain-http-server.js b/test/simple/test-domain-http-server.js index f9962d3..b337f00 100644 --- a/test/simple/test-domain-http-server.js +++ b/test/simple/test-domain-http-server.js @@ -33,6 +33,7 @@ var disposeEmit = 0; var server = http.createServer(function(req, res) { var dom = domain.create(); + req.resume(); dom.add(req); dom.add(res); diff --git a/test/simple/test-http-abort-client.js b/test/simple/test-http-abort-client.js index 6acdd6f..f15238a 100644 --- a/test/simple/test-http-abort-client.js +++ b/test/simple/test-http-abort-client.js @@ -46,13 +46,21 @@ server.listen(common.PORT, function() { res.on('data', function(chunk) { console.log('Read ' + chunk.length + ' bytes'); - console.log(chunk.toString()); + console.log(' chunk=%j', chunk.toString()); }); res.on('end', function() { console.log('Response ended.'); }); + res.on('aborted', function() { + console.log('Response aborted.'); + }); + + res.socket.on('close', function() { + console.log('socket closed, but not res'); + }) + // it would be nice if this worked: res.on('close', function() { console.log('Response aborted'); diff --git a/test/simple/test-http-client-agent.js b/test/simple/test-http-client-agent.js index f7112e3..aedf64b 100644 --- a/test/simple/test-http-client-agent.js +++ b/test/simple/test-http-client-agent.js @@ -61,6 +61,7 @@ function request(i) { server.close(); } }); + res.resume(); }); } diff --git a/test/simple/test-http-client-pipe-end.js b/test/simple/test-http-client-pipe-end.js index 7cb592e..51edebb 100644 --- a/test/simple/test-http-client-pipe-end.js +++ b/test/simple/test-http-client-pipe-end.js @@ -26,6 +26,7 @@ var assert = require('assert'); var http = require('http'); var server = http.createServer(function(req, res) { + req.resume(); req.once('end', function() { res.writeHead(200); res.end(); @@ -50,9 +51,9 @@ server.listen(common.PIPE, function() { function sched(cb, ticks) { function fn() { if (--ticks) - process.nextTick(fn); + setImmediate(fn); else cb(); } - process.nextTick(fn); + setImmediate(fn); }