"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/module/webpage/capture-content.js" between
phantomjs-2.1.0.tar.gz and phantomjs-2.1.1.tar.gz

About: PhantomJS is a scriptable headless browser (development is suspended).

capture-content.js  (phantomjs-2.1.0):capture-content.js  (phantomjs-2.1.1)
var content; var content;
setup(function () { setup(function () {
var fs = require('fs'); var fs = require('fs');
// libraryPath is test/module/webpage // libraryPath is test/module/webpage
content = fs.read(fs.join(phantom.libraryPath, content = fs.read(fs.join(phantom.libraryPath,
"../../www/hello.html")); "../../www/hello.html"));
}); });
// XFAIL: This feature had to be backed out for breaking WebSockets.
async_test(function () { async_test(function () {
var page = require('webpage').create(); var page = require('webpage').create();
var lastChunk = ""; var lastChunk = "";
var bodySize = 0; var bodySize = 0;
page.captureContent = ['.*']; page.captureContent = ['.*'];
// Not a step function because it may be called several times // Not a step function because it may be called several times
// and doesn't need to make assertions. // and doesn't need to make assertions.
page.onResourceReceived = function (resource) { page.onResourceReceived = function (resource) {
lastChunk = resource.body; lastChunk = resource.body;
bodySize = resource.bodySize; bodySize = resource.bodySize;
}; };
page.open(TEST_HTTP_BASE + "hello.html", page.open(TEST_HTTP_BASE + "hello.html",
this.step_func_done(function (status) { this.step_func_done(function (status) {
assert_equals(status, "success"); assert_equals(status, "success");
assert_equals(bodySize, content.length); assert_equals(bodySize, content.length);
assert_equals(lastChunk, content); assert_equals(lastChunk, content);
})); }));
}, "onResourceReceived sees the body if captureContent is activated"); }, "onResourceReceived sees the body if captureContent is activated",
{ expected_fail: true }
);
async_test(function () { async_test(function () {
var page = require('webpage').create(); var page = require('webpage').create();
var lastChunk = ""; var lastChunk = "";
var bodySize = 0; var bodySize = 0;
page.captureContent = ['/some/other/url']; page.captureContent = ['/some/other/url'];
// Not a step function because it may be called several times // Not a step function because it may be called several times
// and doesn't need to make assertions. // and doesn't need to make assertions.
page.onResourceReceived = function (resource) { page.onResourceReceived = function (resource) {
lastChunk = resource.body; lastChunk = resource.body;
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)