summaryrefslogtreecommitdiffstats
path: root/dom/browser-element/mochitest/priority/test_Preallocated.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/browser-element/mochitest/priority/test_Preallocated.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/browser-element/mochitest/priority/test_Preallocated.html')
-rw-r--r--dom/browser-element/mochitest/priority/test_Preallocated.html71
1 files changed, 71 insertions, 0 deletions
diff --git a/dom/browser-element/mochitest/priority/test_Preallocated.html b/dom/browser-element/mochitest/priority/test_Preallocated.html
new file mode 100644
index 000000000..b2cb0335e
--- /dev/null
+++ b/dom/browser-element/mochitest/priority/test_Preallocated.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+Test that the preallocated process starts up with priority BACKGROUND.
+-->
+<head>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="../browserElementTestHelpers.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<script type="application/javascript;version=1.7">
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+browserElementTestHelpers.setEnabledPref(true);
+browserElementTestHelpers.addPermission();
+browserElementTestHelpers.enableProcessPriorityManager();
+
+var preallocationEnabledPref = null;
+try {
+ preallocationEnabledPref = SpecialPowers.getBoolPref('dom.ipc.processPrelaunch.enabled');
+}
+catch(e) {
+ preallocationEnabledPref = null;
+}
+
+var childID = null;
+
+var cleanedUp = false;
+function cleanUp()
+{
+ if (cleanedUp) {
+ return;
+ }
+
+ cleanedUp = true;
+}
+
+// Even if this test times out, we still want to run cleanUp so as to set the
+// pref back.
+addEventListener('unload', cleanUp);
+
+function runTest()
+{
+ if (preallocationEnabledPref) {
+ ok(false, "dom.ipc.processPrelaunch.enabled must be " +
+ "false for this test to work.");
+ SimpleTest.finish();
+ return;
+ }
+
+ // Ensure that the preallocated process initially gets BACKGROUND priority.
+ // That's it.
+ expectProcessCreated('PREALLOC').then(function() {
+ // We need to set the pref asynchoronously or the preallocated process won't
+ // be shut down.
+ SimpleTest.executeSoon(function(){
+ cleanUp();
+ SimpleTest.finish();
+ });
+ });
+}
+// Setting this pref to true should cause us to prelaunch a process.
+addEventListener('testready', function() {
+ SpecialPowers.pushPrefEnv({'set':[["dom.ipc.processPrelaunch.enabled",true]]},runTest);
+});
+</script>
+</body>
+</html>