dom/plugins/test/mochitest/test_busy_hang.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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();
    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   }
    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);
    37   var os = Cc["@mozilla.org/observer-service;1"].
    38            getService(Ci.nsIObserverService);
    39   os.addObserver(testObserver, "plugin-crashed", true);
    41   testObserver.idleHang = false;
    42   document.addEventListener("PluginCrashed", onPluginCrashed, false);
    44   var pluginElement = document.getElementById("plugin1");
    45   try {
    46     pluginElement.hang(true);
    47   } catch (e) {
    48   }
    49 }
    50 ]]>
    51   </script>
    52 </window>

mercurial