OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <body> | |
4 <script src="../resources/testharness.js"></script> | |
5 <script src="../resources/testharnessreport.js"></script> | |
6 <script> | |
7 | |
8 var nextStep; | |
9 | |
10 function onMessageReceived(e) { | |
11 nextStep(e.data.keepScreenAwake); | |
12 } | |
13 | |
14 function setNestedWakeLock(state) { | |
15 document.getElementById('subframe').contentWindow.postMessage( | |
16 {'tag': 'setKeepScreenAwake', 'keepScreenAwake': state}, '*'); | |
17 } | |
18 | |
19 function getNestedWakeLock(callback) { | |
20 document.getElementById('subframe').contentWindow.postMessage( | |
21 {'tag': 'getKeepScreenAwake'}, '*'); | |
22 nextStep = callback; | |
23 } | |
24 | |
25 window.addEventListener('message', onMessageReceived); | |
26 | |
27 async_test(function(t) { | |
28 window.onload = function() { | |
29 document.keepScreenAwake = true; | |
mlamouri (slow - plz ping)
2015/05/05 13:45:43
Hmm, what about that:
var nestedFrameTest = async
| |
30 getNestedWakeLock(t.step_func(function(nestedKeepScreenAwake) { | |
31 assert_false(nestedKeepScreenAwake); | |
32 document.keepScreenAwake = false; | |
33 setNestedWakeLock(true); | |
34 getNestedWakeLock(t.step_func(function(nestedKeepScreenAwake) { | |
35 assert_true(nestedKeepScreenAwake); | |
36 assert_false(document.keepScreenAwake); | |
37 t.done(); | |
38 })); | |
39 })); | |
40 }; | |
41 }, 'Test that keepScreenAwake state is independent in main and nested frame'); | |
42 | |
43 </script> | |
44 <iframe src="resources/subframe.html" id="subframe"/> | |
45 </body> | |
46 </html> | |
OLD | NEW |