Backed out changeset 957a4fed14af (bug 466104) due to leaks

This commit is contained in:
L. David Baron 2008-12-08 23:13:12 -08:00
parent c82c191aec
commit 65e471ed74
2 changed files with 26 additions and 24 deletions

View File

@ -216,17 +216,23 @@ SimpleTest.executeSoon = function(aFunc) {
}, Components.interfaces.nsIThread.DISPATCH_NORMAL);
}
/**
* Talks to the TestRunner if being ran on a iframe and the parent has a
* TestRunner object.
**/
SimpleTest.talkToRunner = function () {
if (parentRunner) {
parentRunner.testFinished(document);
}
};
/**
* Finishes the tests. This is automatically called, except when
* SimpleTest.waitForExplicitFinish() has been invoked.
**/
SimpleTest.finish = function () {
if (parentRunner) {
/* We're running in an iframe, and the parent has a TestRunner */
parentRunner.testFinished(SimpleTest._tests);
} else {
SimpleTest.showReport();
}
SimpleTest.showReport();
SimpleTest.talkToRunner();
};

View File

@ -148,13 +148,13 @@ TestRunner.runNextTest = function() {
/**
* This stub is called by SimpleTest when a test is finished.
**/
TestRunner.testFinished = function(tests) {
TestRunner.testFinished = function(doc) {
var finishedURL = TestRunner._urls[TestRunner._currentTest];
if (TestRunner.logEnabled)
TestRunner.logger.debug("SimpleTest finished " + finishedURL);
TestRunner.updateUI(tests);
TestRunner.updateUI();
TestRunner._currentTest++;
TestRunner.runNextTest();
};
@ -162,25 +162,21 @@ TestRunner.testFinished = function(tests) {
/**
* Get the results.
*/
TestRunner.countResults = function(tests) {
var nOK = 0;
var nNotOK = 0;
var nTodo = 0;
for (var i = 0; i < tests.length; ++i) {
var test = tests[i];
if (test.todo && !test.result) {
nTodo++;
} else if (test.result && !test.todo) {
nOK++;
} else {
nNotOK++;
}
}
TestRunner.countResults = function(doc) {
var nOK = withDocument(doc,
partial(getElementsByTagAndClassName, 'div', 'test_ok')
).length;
var nNotOK = withDocument(doc,
partial(getElementsByTagAndClassName, 'div', 'test_not_ok')
).length;
var nTodo = withDocument(doc,
partial(getElementsByTagAndClassName, 'div', 'test_todo')
).length;
return {"OK": nOK, "notOK": nNotOK, "todo": nTodo};
}
TestRunner.updateUI = function(tests) {
var results = TestRunner.countResults(tests);
TestRunner.updateUI = function() {
var results = TestRunner.countResults($('testframe').contentDocument);
var passCount = parseInt($("pass-count").innerHTML) + results.OK;
var failCount = parseInt($("fail-count").innerHTML) + results.notOK;
var todoCount = parseInt($("todo-count").innerHTML) + results.todo;