|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 Test that a high-priority frame that's expecting a system message initially |
|
5 gets priority FOREGROUND_HIGH. |
|
6 --> |
|
7 <head> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="application/javascript" src="../browserElementTestHelpers.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
11 </head> |
|
12 <body> |
|
13 |
|
14 <script type="application/javascript;version=1.7"> |
|
15 "use strict"; |
|
16 |
|
17 SimpleTest.waitForExplicitFinish(); |
|
18 browserElementTestHelpers.setEnabledPref(true); |
|
19 browserElementTestHelpers.addPermission(); |
|
20 browserElementTestHelpers.enableProcessPriorityManager(); |
|
21 SpecialPowers.addPermission("embed-apps", true, document); |
|
22 |
|
23 function runTest() { |
|
24 var iframe = document.createElement('iframe'); |
|
25 iframe.setAttribute('mozbrowser', true); |
|
26 iframe.setAttribute('expecting-system-message', true); |
|
27 iframe.setAttribute('mozapptype', 'critical'); |
|
28 iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp'); |
|
29 |
|
30 iframe.src = browserElementTestHelpers.emptyPage1; |
|
31 |
|
32 var childID = null; |
|
33 expectOnlyOneProcessCreated().then(function(chid) { |
|
34 childID = chid; |
|
35 return expectPriorityChange(childID, 'FOREGROUND_HIGH'); |
|
36 }).then(function() { |
|
37 // We go back to foreground when the wake lock taken on behalf of our new |
|
38 // process times out. |
|
39 return expectPriorityChange(childID, 'FOREGROUND'); |
|
40 }).then(SimpleTest.finish); |
|
41 |
|
42 document.body.appendChild(iframe); |
|
43 } |
|
44 |
|
45 addEventListener('testready', function() { |
|
46 // Cause the CPU wake lock taken on behalf of this new process to time out |
|
47 // after 1s. |
|
48 SpecialPowers.pushPrefEnv( |
|
49 {set: [["dom.ipc.systemMessageCPULockTimeoutSec", 1]]}, |
|
50 runTest); |
|
51 }); |
|
52 |
|
53 </script> |
|
54 </body> |
|
55 </html> |