Bug 886199 - Fix for intermittent browser_webconsole_bug_644419_log_limits.js | Timed out while waiting for: 10 console.log messages displayed and one pruned, and several more; r=me

This commit is contained in:
Mihai Sucan 2013-06-26 15:03:23 +03:00
Родитель b8077c2b8c
Коммит 68f2df112d
5 изменённых файлов: 137 добавлений и 149 удалений

Просмотреть файл

@ -13,15 +13,14 @@ function test() {
openConsole(null, function(hud) { openConsole(null, function(hud) {
content.location.reload(); content.location.reload();
waitForSuccess({ waitForMessages({
name: "network message displayed", webconsole: hud,
validatorFn: function() messages: [{
{ text: "test-console.html",
return hud.outputNode.querySelector(".webconsole-msg-network"); category: CATEGORY_NETWORK,
}, severity: SEVERITY_LOG,
successFn: performTest, }],
failureFn: finishTest, }).then(performTest);
});
}); });
}, true); }, true);
} }

Просмотреть файл

@ -10,7 +10,7 @@
const TEST_URI = "http://example.com/browser/browser/devtools/" + const TEST_URI = "http://example.com/browser/browser/devtools/" +
"webconsole/test/test-bug-644419-log-limits.html"; "webconsole/test/test-bug-644419-log-limits.html";
var gOldPref; let hud, outputNode;
function test() { function test() {
addTab("data:text/html;charset=utf-8,Web Console test for bug 644419: Console should " + addTab("data:text/html;charset=utf-8,Web Console test for bug 644419: Console should " +
@ -34,19 +34,17 @@ function onLoad(aEvent) {
function testWebDevLimits(aEvent) { function testWebDevLimits(aEvent) {
browser.removeEventListener(aEvent.type, testWebDevLimits, true); browser.removeEventListener(aEvent.type, testWebDevLimits, true);
gOldPref = Services.prefs.getIntPref("devtools.hud.loglimit.console");
Services.prefs.setIntPref("devtools.hud.loglimit.console", 10); Services.prefs.setIntPref("devtools.hud.loglimit.console", 10);
// Find the sentinel entry. // Find the sentinel entry.
waitForSuccess({ waitForMessages({
name: "bar is not defined", webconsole: hud,
validatorFn: function() messages: [{
{ text: "bar is not defined",
return outputNode.textContent.indexOf("bar is not defined") > -1; category: CATEGORY_JS,
}, severity: SEVERITY_ERROR,
successFn: testWebDevLimits2, }],
failureFn: testWebDevLimits2, }).then(testWebDevLimits2);
});
} }
function testWebDevLimits2() { function testWebDevLimits2() {
@ -55,44 +53,39 @@ function testWebDevLimits2() {
content.console.log("test message " + i); content.console.log("test message " + i);
} }
waitForSuccess({ waitForMessages({
name: "10 console.log messages displayed and one pruned", webconsole: hud,
validatorFn: function() messages: [{
{ text: "test message 10",
let message0 = outputNode.textContent.indexOf("test message 0"); category: CATEGORY_WEBDEV,
let message10 = outputNode.textContent.indexOf("test message 10"); severity: SEVERITY_LOG,
return message0 == -1 && message10 > -1; }],
}, }).then(() => {
successFn: function() testLogEntry(outputNode, "test message 0", "first message is pruned", false, true);
{
findLogEntry("test message 1"); findLogEntry("test message 1");
// Check if the sentinel entry is still there. // Check if the sentinel entry is still there.
findLogEntry("bar is not defined"); findLogEntry("bar is not defined");
Services.prefs.setIntPref("devtools.hud.loglimit.console", gOldPref); Services.prefs.clearUserPref("devtools.hud.loglimit.console");
testJsLimits(); testJsLimits();
},
failureFn: testJsLimits,
}); });
} }
function testJsLimits() { function testJsLimits() {
gOldPref = Services.prefs.getIntPref("devtools.hud.loglimit.exception");
Services.prefs.setIntPref("devtools.hud.loglimit.exception", 10); Services.prefs.setIntPref("devtools.hud.loglimit.exception", 10);
hud.jsterm.clearOutput(); hud.jsterm.clearOutput();
content.console.log("testing JS limits"); content.console.log("testing JS limits");
// Find the sentinel entry. // Find the sentinel entry.
waitForSuccess({ waitForMessages({
name: "console.log 'testing JS limits'", webconsole: hud,
validatorFn: function() messages: [{
{ text: "testing JS limits",
return outputNode.textContent.indexOf("testing JS limits") > -1; category: CATEGORY_WEBDEV,
}, severity: SEVERITY_LOG,
successFn: testJsLimits2, }],
failureFn: testNetLimits, }).then(testJsLimits2);
});
} }
function testJsLimits2() { function testJsLimits2() {
@ -105,49 +98,44 @@ function testJsLimits2() {
head.insertBefore(script, head.firstChild); head.insertBefore(script, head.firstChild);
} }
waitForSuccess({ waitForMessages({
name: "10 JS errors shown", webconsole: hud,
validatorFn: function() messages: [{
{ text: "fubar10 is not defined",
return outputNode.textContent.indexOf("fubar10 is not defined") > -1; category: CATEGORY_JS,
}, severity: SEVERITY_ERROR,
successFn: function() }],
{ }).then(() => {
testLogEntry(outputNode, "fubar0 is not defined", "first message is pruned", false, true); testLogEntry(outputNode, "fubar0 is not defined", "first message is pruned", false, true);
findLogEntry("fubar1 is not defined"); findLogEntry("fubar1 is not defined");
// Check if the sentinel entry is still there. // Check if the sentinel entry is still there.
findLogEntry("testing JS limits"); findLogEntry("testing JS limits");
Services.prefs.setIntPref("devtools.hud.loglimit.exception", gOldPref); Services.prefs.clearUserPref("devtools.hud.loglimit.exception");
testNetLimits(); testNetLimits();
},
failureFn: testNetLimits,
}); });
} }
var gCounter, gImage; var gCounter, gImage;
function testNetLimits() { function testNetLimits() {
gOldPref = Services.prefs.getIntPref("devtools.hud.loglimit.network");
Services.prefs.setIntPref("devtools.hud.loglimit.network", 10); Services.prefs.setIntPref("devtools.hud.loglimit.network", 10);
hud.jsterm.clearOutput(); hud.jsterm.clearOutput();
content.console.log("testing Net limits"); content.console.log("testing Net limits");
// Find the sentinel entry. // Find the sentinel entry.
waitForSuccess({ waitForMessages({
name: "console.log 'testing Net limits'", webconsole: hud,
validatorFn: function() messages: [{
{ text: "testing Net limits",
return outputNode.textContent.indexOf("testing Net limits") > -1; category: CATEGORY_WEBDEV,
}, severity: SEVERITY_LOG,
successFn: function() }],
{ }).then(() => {
// Fill the log with network messages. // Fill the log with network messages.
gCounter = 0; gCounter = 0;
loadImage(); loadImage();
},
failureFn: testCssLimits,
}); });
} }
@ -165,44 +153,39 @@ function loadImage() {
is(gCounter, 11, "loaded 11 files"); is(gCounter, 11, "loaded 11 files");
waitForSuccess({ waitForMessages({
name: "loaded 11 files, one message pruned", webconsole: hud,
validatorFn: function() messages: [{
{ text: "test-image.png?_fubar=10",
let message0 = outputNode.querySelector('*[value*="test-image.png?_fubar=0"]'); category: CATEGORY_NETWORK,
let message10 = outputNode.querySelector('*[value*="test-image.png?_fubar=10"]'); severity: SEVERITY_LOG,
return !message0 && message10; }],
}, }).then(() => {
successFn: function() testLogEntry(outputNode, "test-image.png?_fubar=0", "first message is pruned", false, true);
{
findLogEntry("test-image.png?_fubar=1"); findLogEntry("test-image.png?_fubar=1");
// Check if the sentinel entry is still there. // Check if the sentinel entry is still there.
findLogEntry("testing Net limits"); findLogEntry("testing Net limits");
Services.prefs.setIntPref("devtools.hud.loglimit.network", gOldPref); Services.prefs.clearUserPref("devtools.hud.loglimit.network");
testCssLimits(); testCssLimits();
},
failureFn: testCssLimits,
}); });
} }
function testCssLimits() { function testCssLimits() {
gOldPref = Services.prefs.getIntPref("devtools.hud.loglimit.cssparser");
Services.prefs.setIntPref("devtools.hud.loglimit.cssparser", 10); Services.prefs.setIntPref("devtools.hud.loglimit.cssparser", 10);
hud.jsterm.clearOutput(); hud.jsterm.clearOutput();
content.console.log("testing CSS limits"); content.console.log("testing CSS limits");
// Find the sentinel entry. // Find the sentinel entry.
waitForSuccess({ waitForMessages({
name: "console.log 'testing CSS limits'", webconsole: hud,
validatorFn: function() messages: [{
{ text: "testing CSS limits",
return outputNode.textContent.indexOf("testing CSS limits") > -1; category: CATEGORY_WEBDEV,
}, severity: SEVERITY_LOG,
successFn: testCssLimits2, }],
failureFn: finishTest, }).then(testCssLimits2);
});
} }
function testCssLimits2() { function testCssLimits2() {
@ -214,23 +197,21 @@ function testCssLimits2() {
body.insertBefore(div, body.firstChild); body.insertBefore(div, body.firstChild);
} }
waitForSuccess({ waitForMessages({
name: "10 CSS errors shown", webconsole: hud,
validatorFn: function() messages: [{
{ text: "-moz-foobar10",
return outputNode.textContent.indexOf("-moz-foobar10") > -1; category: CATEGORY_CSS,
}, severity: SEVERITY_WARNING,
successFn: function() }],
{ }).then(() => {
testLogEntry(outputNode, "Unknown property '-moz-foobar0'", testLogEntry(outputNode, "Unknown property '-moz-foobar0'",
"first message is pruned", false, true); "first message is pruned", false, true);
findLogEntry("Unknown property '-moz-foobar1'"); findLogEntry("Unknown property '-moz-foobar1'");
// Check if the sentinel entry is still there. // Check if the sentinel entry is still there.
findLogEntry("testing CSS limits"); findLogEntry("testing CSS limits");
Services.prefs.setIntPref("devtools.hud.loglimit.cssparser", gOldPref); Services.prefs.clearUserPref("devtools.hud.loglimit.cssparser");
finishTest(); finishTest();
},
failureFn: finishTest,
}); });
} }

Просмотреть файл

@ -12,6 +12,8 @@
const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 586142"; const TEST_URI = "data:text/html;charset=utf-8,Web Console test for bug 586142";
let hud;
function test() function test()
{ {
addTab(TEST_URI); addTab(TEST_URI);
@ -31,20 +33,22 @@ function testNewlines(aHud) {
content.console.log("Hello world #" + i); content.console.log("Hello world #" + i);
} }
waitForSuccess({ waitForMessages({
name: "20 console.log messages displayed", webconsole: hud,
validatorFn: function() messages: [{
{ text: "Hello world #19",
return hud.outputNode.itemCount == 20; category: CATEGORY_WEBDEV,
}, severity: SEVERITY_LOG,
successFn: testClipboard, }],
failureFn: finishTest, }).then(testClipboard);
});
} }
function testClipboard() { function testClipboard() {
let outputNode = hud.outputNode; let outputNode = hud.outputNode;
info("messages in output: " + outputNode.itemCount);
ok(outputNode.itemCount >= 20, "expected number of messages");
outputNode.selectAll(); outputNode.selectAll();
outputNode.focus(); outputNode.focus();

Просмотреть файл

@ -7,6 +7,8 @@
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html"; const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
let hud;
function test() { function test() {
addTab(TEST_URI); addTab(TEST_URI);
browser.addEventListener("load", function onLoad() { browser.addEventListener("load", function onLoad() {
@ -22,21 +24,22 @@ function consoleOpened(aHud) {
let console = content.console; let console = content.console;
for (let i = 0; i < 50; i++) { for (let i = 0; i < 50; i++) {
console.log("http://www.example.com/" + i); console.log("foobarz #" + i);
} }
waitForSuccess({ waitForMessages({
name: "50 console.log messages displayed", webconsole: hud,
validatorFn: function() messages: [{
{ text: "foobarz #49",
return hud.outputNode.itemCount == 50; category: CATEGORY_WEBDEV,
}, severity: SEVERITY_LOG,
successFn: testLiveFilteringOfMessageTypes, }],
failureFn: finishTest, }).then(testLiveFilteringOfMessageTypes);
});
} }
function testLiveFilteringOfMessageTypes() { function testLiveFilteringOfMessageTypes() {
is(hud.outputNode.itemCount, 50, "number of messages");
hud.setFilterState("log", false); hud.setFilterState("log", false);
is(countMessageNodes(), 0, "the log nodes are hidden when the " + is(countMessageNodes(), 0, "the log nodes are hidden when the " +
"corresponding filter is switched off"); "corresponding filter is switched off");

Просмотреть файл

@ -26,18 +26,19 @@ function consoleOpened(aHud) {
console.log("http://www.example.com/ " + i); console.log("http://www.example.com/ " + i);
} }
waitForSuccess({ waitForMessages({
name: "50 console.log messages displayed", webconsole: hud,
validatorFn: function() messages: [{
{ text: "http://www.example.com/ 49",
return hud.outputNode.itemCount == 50; category: CATEGORY_WEBDEV,
}, severity: SEVERITY_LOG,
successFn: testLiveFilteringOnSearchStrings, }],
failureFn: finishTest, }).then(testLiveFilteringOnSearchStrings);
});
} }
function testLiveFilteringOnSearchStrings() { function testLiveFilteringOnSearchStrings() {
is(hud.outputNode.itemCount, 50, "number of messages");
setStringFilter("http"); setStringFilter("http");
isnot(countMessageNodes(), 0, "the log nodes are not hidden when the " + isnot(countMessageNodes(), 0, "the log nodes are not hidden when the " +
"search string is set to \"http\""); "search string is set to \"http\"");