dom/browser-element/mochitest/priority/test_ExpectingSystemMessage.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/browser-element/mochitest/priority/test_ExpectingSystemMessage.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +Test that a high-priority frame that's expecting a system message initially
     1.8 +gets priority FOREGROUND_HIGH.
     1.9 +-->
    1.10 +<head>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="application/javascript" src="../browserElementTestHelpers.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +
    1.17 +<script type="application/javascript;version=1.7">
    1.18 +"use strict";
    1.19 +
    1.20 +SimpleTest.waitForExplicitFinish();
    1.21 +browserElementTestHelpers.setEnabledPref(true);
    1.22 +browserElementTestHelpers.addPermission();
    1.23 +browserElementTestHelpers.enableProcessPriorityManager();
    1.24 +SpecialPowers.addPermission("embed-apps", true, document);
    1.25 +
    1.26 +function runTest() {
    1.27 +  var iframe = document.createElement('iframe');
    1.28 +  iframe.setAttribute('mozbrowser', true);
    1.29 +  iframe.setAttribute('expecting-system-message', true);
    1.30 +  iframe.setAttribute('mozapptype', 'critical');
    1.31 +  iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
    1.32 +
    1.33 +  iframe.src = browserElementTestHelpers.emptyPage1;
    1.34 +
    1.35 +  var childID = null;
    1.36 +  expectOnlyOneProcessCreated().then(function(chid) {
    1.37 +    childID = chid;
    1.38 +    return expectPriorityChange(childID, 'FOREGROUND_HIGH');
    1.39 +  }).then(function() {
    1.40 +    // We go back to foreground when the wake lock taken on behalf of our new
    1.41 +    // process times out.
    1.42 +    return expectPriorityChange(childID, 'FOREGROUND');
    1.43 +  }).then(SimpleTest.finish);
    1.44 +
    1.45 +  document.body.appendChild(iframe);
    1.46 +}
    1.47 +
    1.48 +addEventListener('testready', function() {
    1.49 +  // Cause the CPU wake lock taken on behalf of this new process to time out
    1.50 +  // after 1s.
    1.51 +  SpecialPowers.pushPrefEnv(
    1.52 +    {set: [["dom.ipc.systemMessageCPULockTimeoutSec", 1]]},
    1.53 +    runTest);
    1.54 +});
    1.55 +
    1.56 +</script>
    1.57 +</body>
    1.58 +</html>

mercurial