summaryrefslogtreecommitdiffstats
path: root/dom/plugins/test/mochitest/test_windowed_invalidate.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 /dom/plugins/test/mochitest/test_windowed_invalidate.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 'dom/plugins/test/mochitest/test_windowed_invalidate.html')
-rw-r--r--dom/plugins/test/mochitest/test_windowed_invalidate.html66
1 files changed, 66 insertions, 0 deletions
diff --git a/dom/plugins/test/mochitest/test_windowed_invalidate.html b/dom/plugins/test/mochitest/test_windowed_invalidate.html
new file mode 100644
index 000000000..a19e4c8c5
--- /dev/null
+++ b/dom/plugins/test/mochitest/test_windowed_invalidate.html
@@ -0,0 +1,66 @@
+<html>
+<head>
+ <title>Test NPN_Invalidate working for a windowed plugin</title>
+ <script type="text/javascript"
+ src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="plugin-utils.js"></script>
+ <link rel="stylesheet" type="text/css"
+ href="/tests/SimpleTest/test.css" />
+</head>
+<body onload="runTests()">
+ <script class="testbody" type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+ SimpleTest.requestFlakyTimeout("untriaged");
+ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
+
+ var lastPaintCount;
+ var p = null;
+
+ function checkPainted() {
+ if (p.getPaintCount() > lastPaintCount) {
+ ok(true, "Plugin did repaint");
+ SimpleTest.finish();
+ } else {
+ setTimeout(checkPainted, 100);
+ }
+ }
+
+ function doTest() {
+ // Cause the plugin to invalidate itself using NPN_Invalidate,
+ // and then wait for the plugin's paintCount to increase. This is the
+ // simplest way to check that a windowed plugin has repainted.
+ p.setColor("FF00FF00");
+ checkPainted();
+ }
+
+ function checkPaintCountStabilized() {
+ // Wait for the paint count to stabilize (i.e. doesn't change for a full
+ // second), so that all buffered-up painting is hopefully finished,
+ // before running the test
+ lastPaintCount = p.getPaintCount();
+ setTimeout(function() {
+ var newCount = p.getPaintCount();
+ if (newCount == lastPaintCount) {
+ doTest();
+ } else {
+ checkPaintCountStabilized();
+ }
+ }, 1000);
+ }
+
+ function runTests() {
+ p = document.getElementById("p");
+ checkPaintCountStabilized();
+ }
+ </script>
+
+ <p id="display"></p>
+
+ <embed id="p" type="application/x-test" wmode="window" drawmode="solid"
+ color="FFFF0000">
+ </embed>
+
+ <div id="verbose">
+ </div>
+ </body>
+ </html>