summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/test_flush_on_paint.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /layout/base/tests/test_flush_on_paint.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/base/tests/test_flush_on_paint.html')
-rw-r--r--layout/base/tests/test_flush_on_paint.html64
1 files changed, 64 insertions, 0 deletions
diff --git a/layout/base/tests/test_flush_on_paint.html b/layout/base/tests/test_flush_on_paint.html
new file mode 100644
index 000000000..de088b4de
--- /dev/null
+++ b/layout/base/tests/test_flush_on_paint.html
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test that we flush before painting</title>
+ <script type="application/javascript" 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>