diff options
Diffstat (limited to '')
-rw-r--r-- | dom/plugins/test/reftest/update-1.html | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/dom/plugins/test/reftest/update-1.html b/dom/plugins/test/reftest/update-1.html new file mode 100644 index 0000000000..cff85bc9f0 --- /dev/null +++ b/dom/plugins/test/reftest/update-1.html @@ -0,0 +1,62 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<head> + <title>Test for bugs 807728 and 810426</title> + <script src="utils.js"> + </script> + <script> +function start() +{ + document.removeEventListener("MozReftestInvalidate", start); + + var plugin = document.getElementById("plugin"); + var color = "FF000000"; + var color_count = 0; + var last_paint_count = 0; + // Enough paints to test reusing a surface after it has been + // moved from front to back buffer. + // FIXME: Stop using mozPaintCount for this test. + // Can't make it a chrome:// url because it needs http, thus no + // SpecialPowers :/ + var final_paint_count = window.mozPaintCount + 10; + var final_color = "FFFF0000"; + + // Using mozPaintCount to track when content has been updated as an + // indication that the browser has received updates, instead of + // plugin.getPaintCount() which tracks when the plugin sends updates or + // MozAfterPaint events which track OS paints. Not using + // MozPaintWaitFinished because invalidation causes no geometry changes. + function wait_for_paints() { + var paint_count = window.mozPaintCount; + if (paint_count >= final_paint_count && color == final_color) { + document.documentElement.removeAttribute("class"); + return; + } + if (paint_count != last_paint_count) { + last_paint_count = paint_count; + if (paint_count + 1 >= final_paint_count) { + color = final_color; + // Wait for the paint with the final color + final_paint_count = paint_count + 1; + } else { + ++color_count; + color = "FF00000" + color_count; + } + plugin.setColor(color); + } + setTimeout(wait_for_paints, 0); + } + + wait_for_paints(); +} + +// MozReftestInvalidate is delivered after initial painting has settled. +document.addEventListener("MozReftestInvalidate", start); + </script> +</head> +<body onLoad="forceLoadPlugin('plugin', true)"> + <embed id="plugin" type="application/x-test" + drawmode="solid" color="FF000000" width="30" height="50"> + </embed> +</body> +</html> |