forked from ariya/phantomjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bodySize in onResourceReceived end, fix ariya#10156
- Loading branch information
1 parent
c7d7c65
commit 80ce3e5
Showing
7 changed files
with
61 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
var port; | ||
setup(function () { | ||
var server = require("webserver").create(); | ||
|
||
// Find an unused port in the 1024--32767 range on which to run the | ||
// rest of the tests. | ||
for (var i = 1024; i < 32768; i++) { | ||
if (server.listen(i, function(rq,rs){ | ||
rs.statusCode = 200; | ||
rs.write('test'); | ||
setTimeout(function() { | ||
rs.write('test'); | ||
rs.close(); | ||
}, 100); | ||
})) { | ||
port = server.port; | ||
return; | ||
} | ||
} | ||
assert_unreached("unable to find a free TCP port for server tests"); | ||
}, { "test_timeout": 2000 }); | ||
|
||
async_test(function () { | ||
var page = require('webpage').create(); | ||
|
||
// Do NOT capture any body. | ||
page.captureContent = []; | ||
|
||
var size = 0; | ||
page.onResourceReceived = function (req) { | ||
if (req.stage == 'end') { | ||
size = req.bodySize; | ||
} | ||
}; | ||
|
||
page.open('http://localhost:' + port, this.step_func_done(function() { | ||
assert_equals(size, 8); | ||
})); | ||
|
||
}, "bodysize"); |