widget/tests/test_plugin_scroll_consistency.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <html>
michael@0 2 <head>
michael@0 3 <title>Test for plugin child widgets not being messed up by scrolling</title>
michael@0 4 <script type="text/javascript"
michael@0 5 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <link rel="stylesheet" type="text/css"
michael@0 7 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
michael@0 8 </head>
michael@0 9 <body onload="setTimeout(runTests, 0)">
michael@0 10 <script type="application/javascript">
michael@0 11 var pluginHost = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
michael@0 12 .getService(SpecialPowers.Ci.nsIPluginHost);
michael@0 13 var pluginTags = pluginHost.getPluginTags();
michael@0 14 for (var tag of pluginTags) {
michael@0 15 if (tag.name == "Test Plug-in") {
michael@0 16 tag.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED;;
michael@0 17 }
michael@0 18 }
michael@0 19 </script>
michael@0 20
michael@0 21 <p id="display">
michael@0 22 <div style="overflow:hidden; height:100px;" id="scroll">
michael@0 23 <embed type="application/x-test" wmode="window" width="100" height="800" id="plugin"></object>
michael@0 24 <div style="height:1000px;"></div>
michael@0 25 </div>
michael@0 26 </p>
michael@0 27 <div id="content" style="display: none">
michael@0 28
michael@0 29 </div>
michael@0 30 <pre id="test">
michael@0 31 </pre>
michael@0 32
michael@0 33 <script class="testbody" type="application/javascript">
michael@0 34 SimpleTest.waitForExplicitFinish();
michael@0 35
michael@0 36 var plugin = document.getElementById("plugin");
michael@0 37
michael@0 38 function consistencyCheck(state) {
michael@0 39 var s = plugin.doInternalConsistencyCheck();
michael@0 40 ok(s == "", "Consistency check: " + state + ": " + s);
michael@0 41 }
michael@0 42
michael@0 43 function runTests()
michael@0 44 {
michael@0 45 consistencyCheck("Initial state");
michael@0 46
michael@0 47 var scroll = document.getElementById("scroll");
michael@0 48 scroll.scrollTop = 10;
michael@0 49 consistencyCheck("Scrolled down a bit");
michael@0 50
michael@0 51 setTimeout(function() {
michael@0 52 consistencyCheck("Before scrolling back to top");
michael@0 53 scroll.scrollTop = 0;
michael@0 54 consistencyCheck("Scrolled to top");
michael@0 55
michael@0 56 setTimeout(function() {
michael@0 57 consistencyCheck("After scrolling to top");
michael@0 58
michael@0 59 SimpleTest.finish();
michael@0 60 }, 0);
michael@0 61 }, 0);
michael@0 62 }
michael@0 63
michael@0 64 </script>
michael@0 65 </body>
michael@0 66
michael@0 67 </html>

mercurial