mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-05 00:02:37 +00:00

This excludes dom/, otherwise the file size is too large for phabricator to handle. This is an autogenerated commit to handle scripts loading mochitest harness files, in the simple case where the script src is on the same line as the tag. This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170 using the `--part 2` argument. Differential Revision: https://phabricator.services.mozilla.com/D27456 --HG-- extra : moz-landing-system : lando
65 lines
1.9 KiB
HTML
65 lines
1.9 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test that we flush before painting</title>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body onload="doIteration()">
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
</div>
|
|
<embed type="application/x-test" id="plugin" drawmode="solid" style="width:200px; height:200px;"></embed>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
SimpleTest.waitForExplicitFinish();
|
|
SimpleTest.requestFlakyTimeout("This test deals with painting and invalidation. " +
|
|
"Those are tricky to detect, so we have to poll here, which means that we have to rely on flaky timeouts. " +
|
|
"This special case is safe because we're only polling for events.");
|
|
|
|
var iterations = 0;
|
|
var plugin = document.getElementById("plugin");
|
|
var lastPaintCount;
|
|
var expectedWidth;
|
|
|
|
var toggle = true;
|
|
function invalidationLoop() {
|
|
toggle = !toggle;
|
|
var color = toggle ? "8F" : "00";
|
|
plugin.setColor("FFFFFF" + color);
|
|
setTimeout(invalidationLoop, 20);
|
|
}
|
|
invalidationLoop();
|
|
|
|
function doIteration() {
|
|
lastPaintCount = window.mozPaintCount;
|
|
ok(true, "Beginning iteration " + iterations + ", last paint count: " + lastPaintCount);
|
|
|
|
expectedWidth = 201 + iterations;
|
|
plugin.style.width = expectedWidth + "px";
|
|
checkDone();
|
|
}
|
|
|
|
function checkDone() {
|
|
ok(true, "Check to see if we're done: " + window.mozPaintCount);
|
|
if (window.mozPaintCount == lastPaintCount) {
|
|
setTimeout(checkDone, 30);
|
|
return;
|
|
}
|
|
|
|
var utils = SpecialPowers.getDOMWindowUtils(window);
|
|
is(plugin.getWidthAtLastPaint(), utils.screenPixelsPerCSSPixel*expectedWidth,
|
|
"Check that we set width before painting");
|
|
|
|
++iterations;
|
|
if (iterations < 100) {
|
|
doIteration();
|
|
} else {
|
|
SimpleTest.finish();
|
|
}
|
|
}
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|