dom/plugins/test/mochitest/test_idle_hang.xul

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial