Skip to content

Commit 3e71b3a

Browse files
committed
Merge pull request #4541 from yurydelendik/chrometest
Cools down Chrome/Windows during testing
2 parents 7075032 + 4d3b15a commit 3e71b3a

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

test/driver.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ var appPath, masterMode, browser, canvas, dummyCanvas, currentTaskIdx,
3535
manifest, stdout;
3636
var inFlightRequests = 0;
3737

38+
// Chrome for Windows locks during testing on low end machines
39+
var letItCooldown = /Windows.*?Chrom/i.test(navigator.userAgent);
40+
3841
function queryParams() {
3942
var qs = window.location.search.substring(1);
4043
var kvs = qs.split('&');
@@ -84,7 +87,7 @@ window.load = function load() {
8487
}, delay);
8588
};
8689

87-
function cleanup() {
90+
function cleanup(callback) {
8891
// Clear out all the stylesheets since a new one is created for each font.
8992
while (document.styleSheets.length > 0) {
9093
var styleSheet = document.styleSheets[0];
@@ -107,6 +110,11 @@ function cleanup() {
107110
delete manifest[i].pdfDoc;
108111
}
109112
}
113+
if (letItCooldown) {
114+
setTimeout(callback, 500);
115+
} else {
116+
callback();
117+
}
110118
}
111119

112120
function exceptionToString(e) {
@@ -120,8 +128,10 @@ function exceptionToString(e) {
120128
}
121129

122130
function nextTask() {
123-
cleanup();
131+
cleanup(continueNextTask);
132+
}
124133

134+
function continueNextTask() {
125135
if (currentTaskIdx == manifest.length) {
126136
done();
127137
return;
@@ -401,7 +411,11 @@ function send(url, message, callback) {
401411
});
402412
}
403413
if (callback) {
404-
callback();
414+
if (letItCooldown) {
415+
setTimeout(callback, 100);
416+
} else {
417+
callback();
418+
}
405419
}
406420
}
407421
};

test/webserver.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function WebServer() {
4747
this.port = 8000;
4848
this.server = null;
4949
this.verbose = false;
50+
this.disableRangeRequests = false;
5051
this.hooks = {
5152
'GET': [],
5253
'POST': []
@@ -89,8 +90,7 @@ WebServer.prototype = {
8990
return;
9091
}
9192

92-
// disables range requests for chrome windows -- locks during testing
93-
var disableRangeRequests = /Windows.*?Chrom/i.test(agent);
93+
var disableRangeRequests = this.disableRangeRequests;
9494

9595
var filePath;
9696
fs.realpath(path.join(this.root, pathPart), checkFile);

0 commit comments

Comments
 (0)