OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/js-test.js"></script> | 2 <script src="../resources/js-test.js"></script> |
3 <script> | 3 <script> |
4 if (window.testRunner) { | 4 if (window.testRunner) { |
5 testRunner.dumpAsText(); | 5 testRunner.dumpAsText(); |
6 testRunner.waitUntilDone(); | 6 testRunner.waitUntilDone(); |
7 } | 7 } |
8 | 8 |
9 function runWithKeyDown(fn) | 9 function runWithKeyDown(fn) |
10 { | 10 { |
11 document.addEventListener('keydown', function() { fn(); }, false); | 11 document.addEventListener('keydown', function() { fn(); }, false); |
12 if (window.testRunner) { | 12 if (window.testRunner) { |
13 eventSender.keyDown('a'); | 13 eventSender.keyDown('a'); |
14 } | 14 } |
15 } | 15 } |
16 | 16 |
17 function init() { | 17 function init() { |
18 // Bail out early if the full screen API is not enabled or is missing: | 18 runWithKeyDown(goFullScreen); |
19 if (Element.prototype.webkitRequestFullScreen == undefined) { | |
20 alert("Fullscreen API not available."); | |
21 } else { | |
22 runWithKeyDown(goFullScreen); | |
23 } | |
24 } | 19 } |
25 | 20 |
26 function goFullScreen() { | 21 function goFullScreen() { |
27 var iframe = document.getElementById('block1'); | 22 var iframe = document.getElementById('block1'); |
28 var element = iframe.contentDocument.documentElement; | 23 var element = iframe.contentDocument.documentElement; |
29 setTimeout(function () { | 24 setTimeout(function () { |
30 iframe.parentNode.removeChild(iframe); | 25 iframe.parentNode.removeChild(iframe); |
31 gc(); | 26 gc(); |
32 setTimeout(function () { | 27 setTimeout(function () { |
33 if (window.testRunner) { | 28 if (window.testRunner) { |
34 testRunner.notifyDone(); | 29 testRunner.notifyDone(); |
35 } | 30 } |
36 }, 0); | 31 }, 0); |
37 }, 0); | 32 }, 0); |
38 element.webkitRequestFullScreen(); | 33 element.webkitRequestFullScreen(); |
39 shouldNotBe("document.webkitFullscreenElement", "null"); | 34 shouldNotBe("document.webkitFullscreenElement", "null"); |
40 } | 35 } |
41 </script> | 36 </script> |
42 <body onload="init()"> | 37 <body onload="init()"> |
43 <iframe allowfullscreen src="resources/inner.html" id="block1"></iframe> | 38 <iframe allowfullscreen src="resources/inner.html" id="block1"></iframe> |
44 PASS | 39 PASS |
45 </body> | 40 </body> |
OLD | NEW |