1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/tests/test_plugin_scroll_consistency.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 1.4 +<html> 1.5 +<head> 1.6 + <title>Test for plugin child widgets not being messed up by scrolling</title> 1.7 + <script type="text/javascript" 1.8 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <link rel="stylesheet" type="text/css" 1.10 + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 1.11 +</head> 1.12 +<body onload="setTimeout(runTests, 0)"> 1.13 +<script type="application/javascript"> 1.14 +var pluginHost = SpecialPowers.Cc["@mozilla.org/plugin/host;1"] 1.15 + .getService(SpecialPowers.Ci.nsIPluginHost); 1.16 +var pluginTags = pluginHost.getPluginTags(); 1.17 +for (var tag of pluginTags) { 1.18 + if (tag.name == "Test Plug-in") { 1.19 + tag.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED;; 1.20 + } 1.21 +} 1.22 +</script> 1.23 + 1.24 +<p id="display"> 1.25 + <div style="overflow:hidden; height:100px;" id="scroll"> 1.26 + <embed type="application/x-test" wmode="window" width="100" height="800" id="plugin"></object> 1.27 + <div style="height:1000px;"></div> 1.28 + </div> 1.29 +</p> 1.30 +<div id="content" style="display: none"> 1.31 + 1.32 +</div> 1.33 +<pre id="test"> 1.34 +</pre> 1.35 + 1.36 +<script class="testbody" type="application/javascript"> 1.37 +SimpleTest.waitForExplicitFinish(); 1.38 + 1.39 +var plugin = document.getElementById("plugin"); 1.40 + 1.41 +function consistencyCheck(state) { 1.42 + var s = plugin.doInternalConsistencyCheck(); 1.43 + ok(s == "", "Consistency check: " + state + ": " + s); 1.44 +} 1.45 + 1.46 +function runTests() 1.47 +{ 1.48 + consistencyCheck("Initial state"); 1.49 + 1.50 + var scroll = document.getElementById("scroll"); 1.51 + scroll.scrollTop = 10; 1.52 + consistencyCheck("Scrolled down a bit"); 1.53 + 1.54 + setTimeout(function() { 1.55 + consistencyCheck("Before scrolling back to top"); 1.56 + scroll.scrollTop = 0; 1.57 + consistencyCheck("Scrolled to top"); 1.58 + 1.59 + setTimeout(function() { 1.60 + consistencyCheck("After scrolling to top"); 1.61 + 1.62 + SimpleTest.finish(); 1.63 + }, 0); 1.64 + }, 0); 1.65 +} 1.66 + 1.67 +</script> 1.68 +</body> 1.69 + 1.70 +</html>