|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
|
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
|
4 type="text/css"?> |
|
5 <window title="Basic Plugin Tests" |
|
6 xmlns:html="http://www.w3.org/1999/xhtml" |
|
7 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
8 <title>Plugin Busy Hang Test</title> |
|
9 <script type="application/javascript" |
|
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
|
11 <script type="application/javascript" |
|
12 src="http://mochi.test:8888/chrome/dom/plugins/test/mochitest/hang_test.js" /> |
|
13 <script type="application/javascript" src="utils.js"></script> |
|
14 <script type="application/javascript"> |
|
15 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); |
|
16 </script> |
|
17 <body xmlns="http://www.w3.org/1999/xhtml" onload="runTests()"> |
|
18 <embed id="plugin1" type="application/x-test" width="200" height="200"></embed> |
|
19 </body> |
|
20 <script class="testbody" type="application/javascript"> |
|
21 <![CDATA[ |
|
22 SimpleTest.waitForExplicitFinish(); |
|
23 |
|
24 function runTests() { |
|
25 if (!SimpleTest.testPluginIsOOP()) { |
|
26 ok(true, "Skipping this test when test plugin is not OOP."); |
|
27 SimpleTest.finish(); |
|
28 return; |
|
29 } |
|
30 |
|
31 // Default plugin hang timeout is too high for mochitests |
|
32 var prefs = Cc["@mozilla.org/preferences-service;1"] |
|
33 .getService(Ci.nsIPrefBranch); |
|
34 var timeoutPref = "dom.ipc.plugins.timeoutSecs"; |
|
35 prefs.setIntPref(timeoutPref, 5); |
|
36 |
|
37 var os = Cc["@mozilla.org/observer-service;1"]. |
|
38 getService(Ci.nsIObserverService); |
|
39 os.addObserver(testObserver, "plugin-crashed", true); |
|
40 |
|
41 testObserver.idleHang = false; |
|
42 document.addEventListener("PluginCrashed", onPluginCrashed, false); |
|
43 |
|
44 var pluginElement = document.getElementById("plugin1"); |
|
45 try { |
|
46 pluginElement.hang(true); |
|
47 } catch (e) { |
|
48 } |
|
49 } |
|
50 ]]> |
|
51 </script> |
|
52 </window> |
|
53 |