mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 964684 - Fix for intermittent TEST-UNEXPECTED-FAIL | browser_webconsole_bug_642108_pruneTest.js | Test timed out; r=me
This commit is contained in:
parent
bdc751a5dd
commit
2de8056cf0
@ -12,53 +12,45 @@ const TEST_URI = "data:text/html;charset=utf-8,<p>test for bug 642108.";
|
||||
const LOG_LIMIT = 20;
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
browser.addEventListener("load", function onLoad(){
|
||||
browser.removeEventListener("load", onLoad, false);
|
||||
let hud;
|
||||
|
||||
Task.spawn(runner).then(finishTest);
|
||||
|
||||
function* runner() {
|
||||
let {tab} = yield loadTab(TEST_URI);
|
||||
|
||||
Services.prefs.setIntPref("devtools.hud.loglimit.cssparser", LOG_LIMIT);
|
||||
Services.prefs.setBoolPref("devtools.webconsole.filter.cssparser", true);
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref("devtools.hud.loglimit.cssparser");
|
||||
Services.prefs.clearUserPref("devtools.webconsole.filter.cssparser");
|
||||
});
|
||||
|
||||
openConsole(null, testCSSPruning);
|
||||
}, true);
|
||||
}
|
||||
hud = yield openConsole(tab);
|
||||
|
||||
function populateConsoleRepeats(aHudRef) {
|
||||
for (let i = 0; i < 5; i++) {
|
||||
let node = aHudRef.ui.createMessageNode(CATEGORY_CSS, SEVERITY_WARNING,
|
||||
"css log x");
|
||||
aHudRef.ui.outputMessage(CATEGORY_CSS, node);
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < 5; i++) {
|
||||
logCSSMessage("css log x");
|
||||
}
|
||||
|
||||
function populateConsole(aHudRef) {
|
||||
for (let i = 0; i < LOG_LIMIT + 5; i++) {
|
||||
let node = aHudRef.ui.createMessageNode(CATEGORY_CSS, SEVERITY_WARNING,
|
||||
"css log " + i);
|
||||
aHudRef.ui.outputMessage(CATEGORY_CSS, node);
|
||||
}
|
||||
}
|
||||
|
||||
function testCSSPruning(hudRef) {
|
||||
populateConsoleRepeats(hudRef);
|
||||
|
||||
waitForMessages({
|
||||
webconsole: hudRef,
|
||||
messages: [{
|
||||
text: "css log x",
|
||||
category: CATEGORY_CSS,
|
||||
severity: SEVERITY_WARNING,
|
||||
repeats: 5,
|
||||
}],
|
||||
}).then(() => {
|
||||
populateConsole(hudRef);
|
||||
waitForMessages({
|
||||
webconsole: hudRef,
|
||||
yield waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [{
|
||||
text: "css log 0",
|
||||
text: "css log x",
|
||||
category: CATEGORY_CSS,
|
||||
severity: SEVERITY_WARNING,
|
||||
repeats: 5,
|
||||
}],
|
||||
});
|
||||
|
||||
for (let i = 0; i < LOG_LIMIT + 5; i++) {
|
||||
logCSSMessage("css log " + i);
|
||||
}
|
||||
|
||||
let [result] = yield waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [{
|
||||
text: "css log 5",
|
||||
category: CATEGORY_CSS,
|
||||
severity: SEVERITY_WARNING,
|
||||
},
|
||||
@ -67,23 +59,22 @@ function testCSSPruning(hudRef) {
|
||||
category: CATEGORY_CSS,
|
||||
severity: SEVERITY_WARNING,
|
||||
}],
|
||||
}).then(([result]) => {
|
||||
is(countMessageNodes(), LOG_LIMIT, "number of messages");
|
||||
|
||||
is(Object.keys(hudRef.ui._repeatNodes).length, LOG_LIMIT,
|
||||
"repeated nodes pruned from repeatNodes");
|
||||
|
||||
let msg = [...result.matched][0];
|
||||
let repeats = msg.querySelector(".message-repeats");
|
||||
is(repeats.getAttribute("value"), 1,
|
||||
"repeated nodes pruned from repeatNodes (confirmed)");
|
||||
|
||||
finishTest();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function countMessageNodes() {
|
||||
let outputNode = HUDService.getHudByWindow(content).outputNode;
|
||||
return outputNode.querySelectorAll(".message").length;
|
||||
is(hud.ui.outputNode.querySelectorAll(".message").length, LOG_LIMIT,
|
||||
"number of messages");
|
||||
|
||||
is(Object.keys(hud.ui._repeatNodes).length, LOG_LIMIT,
|
||||
"repeated nodes pruned from repeatNodes");
|
||||
|
||||
let msg = [...result.matched][0];
|
||||
let repeats = msg.querySelector(".message-repeats");
|
||||
is(repeats.getAttribute("value"), 1,
|
||||
"repeated nodes pruned from repeatNodes (confirmed)");
|
||||
}
|
||||
|
||||
function logCSSMessage(msg) {
|
||||
let node = hud.ui.createMessageNode(CATEGORY_CSS, SEVERITY_WARNING, msg);
|
||||
hud.ui.outputMessage(CATEGORY_CSS, node);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user