зеркало из https://github.com/mozilla/gecko-dev.git
Bug 620875 - Intermittent browser_webconsole_bug_595934_message_categories.js | Test timed out followed by failures to give up and stop running; r=sdwilsh a=sdwilsh
This commit is contained in:
Родитель
5829e48552
Коммит
3bde156412
|
@ -108,6 +108,11 @@ const TESTS = [
|
||||||
|
|
||||||
let pos = -1;
|
let pos = -1;
|
||||||
|
|
||||||
|
let foundCategory = false;
|
||||||
|
let foundText = false;
|
||||||
|
let output = null;
|
||||||
|
let jsterm = null;
|
||||||
|
|
||||||
let TestObserver = {
|
let TestObserver = {
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
|
||||||
|
|
||||||
|
@ -121,10 +126,13 @@ let TestObserver = {
|
||||||
"test #" + pos + ": error category '" + TESTS[pos].category + "'");
|
"test #" + pos + ": error category '" + TESTS[pos].category + "'");
|
||||||
|
|
||||||
if (aSubject.category == TESTS[pos].category) {
|
if (aSubject.category == TESTS[pos].category) {
|
||||||
executeSoon(performTest);
|
foundCategory = true;
|
||||||
|
if (foundText) {
|
||||||
|
executeSoon(testNext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
testEnd();
|
executeSoon(finish);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -135,7 +143,10 @@ function tabLoad(aEvent) {
|
||||||
openConsole();
|
openConsole();
|
||||||
|
|
||||||
let hudId = HUDService.getHudIdByWindow(content);
|
let hudId = HUDService.getHudIdByWindow(content);
|
||||||
hud = HUDService.hudReferences[hudId];
|
let hud = HUDService.hudReferences[hudId];
|
||||||
|
output = hud.outputNode;
|
||||||
|
output.addEventListener("DOMNodeInserted", onDOMNodeInserted, false);
|
||||||
|
jsterm = hud.jsterm;
|
||||||
|
|
||||||
Services.console.registerListener(TestObserver);
|
Services.console.registerListener(TestObserver);
|
||||||
|
|
||||||
|
@ -143,7 +154,9 @@ function tabLoad(aEvent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function testNext() {
|
function testNext() {
|
||||||
hud.jsterm.clearOutput();
|
jsterm.clearOutput();
|
||||||
|
foundCategory = false;
|
||||||
|
foundText = false;
|
||||||
|
|
||||||
pos++;
|
pos++;
|
||||||
if (pos < TESTS.length) {
|
if (pos < TESTS.length) {
|
||||||
|
@ -157,24 +170,32 @@ function testNext() {
|
||||||
content.location = TESTS_PATH + TESTS[pos].file;
|
content.location = TESTS_PATH + TESTS[pos].file;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
testEnd();
|
executeSoon(finish);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function testEnd() {
|
function testEnd() {
|
||||||
Services.console.unregisterListener(TestObserver);
|
Services.console.unregisterListener(TestObserver);
|
||||||
|
output.removeEventListener("DOMNodeInserted", onDOMNodeInserted, false);
|
||||||
|
output = jsterm = null;
|
||||||
finishTest();
|
finishTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
function performTest() {
|
function onDOMNodeInserted(aEvent) {
|
||||||
let textContent = hud.outputNode.textContent;
|
let textContent = output.textContent;
|
||||||
isnot(textContent.indexOf(TESTS[pos].matchString), -1,
|
foundText = textContent.indexOf(TESTS[pos].matchString) > -1;
|
||||||
"test #" + pos + ": message found '" + TESTS[pos].matchString + "'");
|
if (foundText) {
|
||||||
|
ok(foundText, "test #" + pos + ": message found '" + TESTS[pos].matchString + "'");
|
||||||
|
}
|
||||||
|
|
||||||
testNext();
|
if (foundCategory) {
|
||||||
|
executeSoon(testNext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
|
registerCleanupFunction(testEnd);
|
||||||
|
|
||||||
addTab("data:text/html,Web Console test for bug 595934 - message categories coverage.");
|
addTab("data:text/html,Web Console test for bug 595934 - message categories coverage.");
|
||||||
browser.addEventListener("load", tabLoad, true);
|
browser.addEventListener("load", tabLoad, true);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче