Report testing done
This commit is contained in:
parent
a2da4fffb0
commit
7d27df9868
1 changed files with 19 additions and 8 deletions
27
js/test.js
27
js/test.js
|
@ -22,12 +22,24 @@ var exclusiveRunning = -1;
|
||||||
var exclusiveTestsWaiting = [];
|
var exclusiveTestsWaiting = [];
|
||||||
|
|
||||||
var maxTestId = 0;
|
var maxTestId = 0;
|
||||||
|
var forceNextTestInverval;
|
||||||
|
|
||||||
|
var allTestsDefined = false;
|
||||||
|
function printTestsDone() {
|
||||||
|
if (!allTestsDefined)
|
||||||
|
return;
|
||||||
|
for (var i = 0; i < maxTestId; i++)
|
||||||
|
if (testsOutstanding[i] !== undefined)
|
||||||
|
return;
|
||||||
|
testsdiv.append('<p>All tests done</p>');
|
||||||
|
window.clearInterval(forceNextTestInverval);
|
||||||
|
}
|
||||||
|
|
||||||
function startNextExclusiveTest() {
|
function startNextExclusiveTest() {
|
||||||
for (var i = 0; i < maxTestId; i++) {
|
for (var i = 0; i < maxTestId; i++) {
|
||||||
if (exclusiveTestsWaiting[i] !== undefined) {
|
if (exclusiveTestsWaiting[i] !== undefined) {
|
||||||
exclusiveTestsWaiting[i]();
|
exclusiveTestsWaiting[i]();
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +76,7 @@ function TEST(func, name, exclusive) {
|
||||||
delete exclusiveTestsWaiting[exclusiveIndex];
|
delete exclusiveTestsWaiting[exclusiveIndex];
|
||||||
startNextExclusiveTest();
|
startNextExclusiveTest();
|
||||||
}
|
}
|
||||||
|
printTestsDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,8 +109,6 @@ function hexToArrayBuffer(str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
textsecure.registerOnLoadFunction(function() {
|
textsecure.registerOnLoadFunction(function() {
|
||||||
localStorage.clear();
|
|
||||||
|
|
||||||
TEST(function() {
|
TEST(function() {
|
||||||
var b = new ArrayBuffer(3);
|
var b = new ArrayBuffer(3);
|
||||||
var a = new Uint8Array(b);
|
var a = new Uint8Array(b);
|
||||||
|
@ -548,9 +559,8 @@ textsecure.registerOnLoadFunction(function() {
|
||||||
});
|
});
|
||||||
}, "Decrypt AES-CBC", false);
|
}, "Decrypt AES-CBC", false);
|
||||||
|
|
||||||
// Setup test timeouts (note that this will only work if things are actually
|
// Setup test timeouts
|
||||||
// being run async, ie in the case of NaCL)
|
forceNextTestInverval = window.setInterval(function() {
|
||||||
window.setInterval(function() {
|
|
||||||
for (var i = 0; i < maxTestId; i++) {
|
for (var i = 0; i < maxTestId; i++) {
|
||||||
if (testsOutstanding[i] !== undefined) {
|
if (testsOutstanding[i] !== undefined) {
|
||||||
testsdiv.append('<p style="color: red;">' + testsOutstanding[i] + ' timed out</p>');
|
testsdiv.append('<p style="color: red;">' + testsOutstanding[i] + ' timed out</p>');
|
||||||
|
@ -563,7 +573,8 @@ textsecure.registerOnLoadFunction(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
startNextExclusiveTest();
|
startNextExclusiveTest();
|
||||||
|
|
||||||
localStorage.clear();
|
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
||||||
|
allTestsDefined = true;
|
||||||
|
printTestsDone();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue