dom/plugins/test/mochitest/test_busy_hang.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/plugins/test/mochitest/test_busy_hang.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
     1.7 +                 type="text/css"?>
     1.8 +<window title="Basic Plugin Tests"
     1.9 +  xmlns:html="http://www.w3.org/1999/xhtml"
    1.10 +  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.11 +  <title>Plugin Busy Hang Test</title>
    1.12 +  <script type="application/javascript"
    1.13 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    1.14 +  <script type="application/javascript"
    1.15 +          src="http://mochi.test:8888/chrome/dom/plugins/test/mochitest/hang_test.js" />
    1.16 +  <script type="application/javascript" src="utils.js"></script>
    1.17 +  <script type="application/javascript">
    1.18 +    setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    1.19 +  </script>
    1.20 +  <body xmlns="http://www.w3.org/1999/xhtml" onload="runTests()">
    1.21 +    <embed id="plugin1" type="application/x-test" width="200" height="200"></embed>
    1.22 +  </body>
    1.23 +  <script class="testbody" type="application/javascript">
    1.24 +    <![CDATA[
    1.25 +SimpleTest.waitForExplicitFinish();
    1.26 +
    1.27 +function runTests() {
    1.28 +  if (!SimpleTest.testPluginIsOOP()) {
    1.29 +    ok(true, "Skipping this test when test plugin is not OOP.");
    1.30 +    SimpleTest.finish();
    1.31 +    return;
    1.32 +  }
    1.33 +  
    1.34 +  // Default plugin hang timeout is too high for mochitests
    1.35 +  var prefs = Cc["@mozilla.org/preferences-service;1"]
    1.36 +                    .getService(Ci.nsIPrefBranch);
    1.37 +  var timeoutPref = "dom.ipc.plugins.timeoutSecs";
    1.38 +  prefs.setIntPref(timeoutPref, 5);
    1.39 +
    1.40 +  var os = Cc["@mozilla.org/observer-service;1"].
    1.41 +           getService(Ci.nsIObserverService);
    1.42 +  os.addObserver(testObserver, "plugin-crashed", true);
    1.43 +
    1.44 +  testObserver.idleHang = false;
    1.45 +  document.addEventListener("PluginCrashed", onPluginCrashed, false);
    1.46 +
    1.47 +  var pluginElement = document.getElementById("plugin1");
    1.48 +  try {
    1.49 +    pluginElement.hang(true);
    1.50 +  } catch (e) {
    1.51 +  }
    1.52 +}
    1.53 +]]>
    1.54 +  </script>
    1.55 +</window>
    1.56 +

mercurial