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 Idle 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="plugin-utils.js"></script>
14  <script type="application/javascript">
15    getTestPlugin().enabledState = 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[
22SimpleTest.waitForExplicitFinish();
23
24function runTests() {
25  // Default plugin hang timeout is too high for mochitests
26  var prefs = Cc["@mozilla.org/preferences-service;1"]
27                    .getService(Ci.nsIPrefBranch);
28  var timeoutPref = "dom.ipc.plugins.timeoutSecs";
29  prefs.setIntPref(timeoutPref, 5);
30
31  var os = Cc["@mozilla.org/observer-service;1"].
32           getService(Ci.nsIObserverService);
33  os.addObserver(testObserver, "plugin-crashed", true);
34
35  testObserver.idleHang = true;
36  document.addEventListener("PluginCrashed", onPluginCrashed, false);
37
38  var pluginElement = document.getElementById("plugin1");
39  try {
40    pluginElement.hang(false);
41  } catch (e) {
42  }
43}
44]]>
45</script>
46</window>
47
48