Skip to content

Commit

Permalink
Port the test for onRepaintRequested handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
ariya committed Sep 11, 2014
1 parent d52df7a commit dca6f77
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 30 deletions.
16 changes: 16 additions & 0 deletions test/module/webpage/repaint-requested.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var assert = require('../../assert');
var webpage = require('webpage');

var page = webpage.create();

var requestCount = 0;

page.onRepaintRequested = function(x, y, w, h) {
if ((w > 0) && (h > 0)) {
++requestCount;
}
};

page.open('http://localhost:9180/hello.html', function (status) {
assert.isTrue(requestCount > 0);
});
1 change: 1 addition & 0 deletions test/run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
'module/webpage/add-header.js',
'module/webpage/remove-header.js',
'module/webpage/modify-header.js',
'module/webpage/repaint-requested.js',
'module/webpage/abort-network-request.js',
'module/webpage/resource-request-error.js',
'module/webpage/resource-received-error.js',
Expand Down
30 changes: 0 additions & 30 deletions test/webpage-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1894,36 +1894,6 @@ describe('WebPage navigation events', function() {
});


describe('WebPage repaint requests', function() {
it('should report when a repaint is requested, together with the area being repainted', function () {
var server = require("webserver").create();
server.listen(12345, function(request, response) {
response.status = 200;
response.write("<html><body><p>some text some text some text</p></body></html>");
response.close();
});

var page = require("webpage").create();
var base = "http://localhost:12345/";
var isHandled = false;

runs(function() {
page.onRepaintRequested = function(x, y, width, height) {
isHandled = true;
};

page.open(base);
});

waits(3000);

runs(function() {
expect(isHandled).toEqual(true);
server.close();
});
});
});

describe("WebPage render image", function(){
var TEST_FILE_DIR = "webpage-spec-renders/";

Expand Down

0 comments on commit dca6f77

Please sign in to comment.