widget/tests/test_plugin_scroll_consistency.html

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

mercurial