Fix errors with deferred translator tests

In translation-server, the test timeout is overridden to 30 seconds, which was
also the deferred test delay, so there was a race condition that could cause
deferred tests to fail. This sets the deferred delay to 20 seconds.
This commit is contained in:
Dan Stillman 2016-09-06 01:32:59 -04:00
parent 43bd1b7082
commit 3ef9b93573

View file

@ -235,7 +235,7 @@ Zotero_TranslatorTester = function(translator, type, debugCallback) {
} }
}; };
Zotero_TranslatorTester.DEFER_DELAY = 30000; // Delay for deferred tests Zotero_TranslatorTester.DEFER_DELAY = 20000; // Delay for deferred tests
/** /**
* Removes document objects, which contain cyclic references, and other fields to be ignored from items * Removes document objects, which contain cyclic references, and other fields to be ignored from items
@ -401,7 +401,7 @@ Zotero_TranslatorTester.prototype.fetchPageAndRunTest = function(test, testDoneC
createInstance(Components.interfaces.nsITimer); createInstance(Components.interfaces.nsITimer);
timer.initWithCallback({"notify":function() { timer.initWithCallback({"notify":function() {
try { try {
Zotero.Browser.deleteHiddenBrowser(hiddenBrowser); if (hiddenBrowser) Zotero.Browser.deleteHiddenBrowser(hiddenBrowser);
} catch(e) {} } catch(e) {}
}}, TEST_RUN_TIMEOUT, Components.interfaces.nsITimer.TYPE_ONE_SHOT); }}, TEST_RUN_TIMEOUT, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
@ -422,10 +422,7 @@ Zotero_TranslatorTester.prototype.fetchPageAndRunTest = function(test, testDoneC
+ (Zotero_TranslatorTester.DEFER_DELAY/1000) + (Zotero_TranslatorTester.DEFER_DELAY/1000)
+ " second(s) for page content to settle" + " second(s) for page content to settle"
); );
Zotero.setTimeout( Zotero.setTimeout(() => runTest(doc), Zotero_TranslatorTester.DEFER_DELAY);
function() {runTest(hiddenBrowser.contentDocument) },
Zotero_TranslatorTester.DEFER_DELAY, true
);
} else { } else {
runTest(doc); runTest(doc);
} }