Allow tests to be deferred by adding "defer": true to test JSON.

This commit is contained in:
Simon Kornblith 2012-02-23 00:18:29 -05:00
parent e116f7a174
commit 3c33768116

View file

@ -187,12 +187,19 @@ Zotero_TranslatorTester.prototype._runTestsRecursively = function(testDoneCallba
*/
Zotero_TranslatorTester.prototype.fetchPageAndRunTest = function(test, testDoneCallback) {
var me = this;
var runTest = function(doc) {
me.runTest(test, doc, function(obj, test, status, message) {
if(hiddenBrowser) Zotero.Browser.deleteHiddenBrowser(hiddenBrowser);
testDoneCallback(obj, test, status, message);
});
};
var hiddenBrowser = Zotero.HTTP.processDocuments(test.url,
function(doc) {
me.runTest(test, doc, function(obj, test, status, message) {
if(hiddenBrowser) Zotero.Browser.deleteHiddenBrowser(hiddenBrowser);
testDoneCallback(obj, test, status, message);
});
if(test.defer) {
Zotero.setTimeout(function() { runTest(doc) }, 10000, true);
} else {
runTest(doc);
}
},
null,
function(e) {