Bug 795262. Highlighter test should not depend on MozAfterPaint firing for changes to invisible elements. Also, poll for the value to change instead of assuming a constant 1000ms timeout. r=dao,cjones

This commit is contained in:
Robert O'Callahan 2012-09-28 23:19:39 +12:00
parent 4af0a9996d
commit 3ced0b7534

View File

@ -7,7 +7,7 @@ let div;
function createDocument()
{
div = doc.createElement("div");
div.setAttribute("style", "width: 100px; height: 100px;");
div.setAttribute("style", "width: 100px; height: 100px; background:yellow;");
doc.body.appendChild(div);
Services.obs.addObserver(runTest,
@ -27,12 +27,17 @@ function runTest(subject)
is(outline.style.width, "100px", "selection has the right width");
div.style.width = "200px";
setTimeout(function () {
function pollTest() {
if (outline.style.width == "100px") {
setTimeout(pollTest, 10);
return;
}
is(outline.style.width, "200px", "selection updated");
InspectorUI.closeInspectorUI();
gBrowser.removeCurrentTab();
finish();
}, 1000);
}
setTimeout(pollTest, 10);
});
}