зеркало из https://github.com/mozilla/gecko-dev.git
Make mochitests not build and search the results table when run inside the harness. (Bug 466104) r=sayrer a=tests
This commit is contained in:
Родитель
df90903560
Коммит
d9ce700006
|
@ -216,23 +216,17 @@ 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 () {
|
||||
SimpleTest.showReport();
|
||||
SimpleTest.talkToRunner();
|
||||
if (parentRunner) {
|
||||
/* We're running in an iframe, and the parent has a TestRunner */
|
||||
parentRunner.testFinished(document);
|
||||
} else {
|
||||
SimpleTest.showReport();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -162,21 +162,26 @@ TestRunner.testFinished = function(doc) {
|
|||
/**
|
||||
* Get the results.
|
||||
*/
|
||||
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;
|
||||
TestRunner.countResults = function(win) {
|
||||
var nOK = 0;
|
||||
var nNotOK = 0;
|
||||
var nTodo = 0;
|
||||
var tests = win.SimpleTest._tests;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
return {"OK": nOK, "notOK": nNotOK, "todo": nTodo};
|
||||
}
|
||||
|
||||
TestRunner.updateUI = function() {
|
||||
var results = TestRunner.countResults($('testframe').contentDocument);
|
||||
var results = TestRunner.countResults($('testframe').contentWindow);
|
||||
var passCount = parseInt($("pass-count").innerHTML) + results.OK;
|
||||
var failCount = parseInt($("fail-count").innerHTML) + results.notOK;
|
||||
var todoCount = parseInt($("todo-count").innerHTML) + results.todo;
|
||||
|
|
Загрузка…
Ссылка в новой задаче