OLD | NEW |
1 <body> | 1 <body> |
2 <script src="full-screen-test.js"></script> | 2 <script src="full-screen-test.js"></script> |
3 <div><span></span></div> | 3 <div><span></span></div> |
4 <script> | 4 <script> |
5 // Bail out early if the full screen API is not enabled or is missing: | 5 var callback; |
6 if (Element.prototype.webkitRequestFullScreen == undefined) { | 6 var fullscreenChanged = function(event) |
7 logResult(false, "Element.prototype.webkitRequestFullScreen == undefined
"); | 7 { |
| 8 if (callback) |
| 9 callback(event) |
| 10 }; |
| 11 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); |
| 12 |
| 13 var span = document.getElementsByTagName('span')[0]; |
| 14 var div = span.parentNode; |
| 15 |
| 16 var spanEnteredFullScreen = function(event) { |
| 17 callback = spanExitedFullScreen; |
| 18 testExpected("document.webkitCurrentFullScreenElement", span); |
| 19 document.body.removeChild(div); |
| 20 }; |
| 21 |
| 22 var spanExitedFullScreen = function(event) { |
| 23 callback = null; |
| 24 testExpected("document.webkitCurrentFullScreenElement", null); |
8 endTest(); | 25 endTest(); |
9 } else { | 26 }; |
10 var callback; | |
11 var fullscreenChanged = function(event) | |
12 { | |
13 if (callback) | |
14 callback(event) | |
15 }; | |
16 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); | |
17 | 27 |
18 var span = document.getElementsByTagName('span')[0]; | 28 callback = spanEnteredFullScreen; |
19 var div = span.parentNode; | 29 runWithKeyDown(function(){span.webkitRequestFullScreen()}); |
20 | |
21 var spanEnteredFullScreen = function(event) { | |
22 callback = spanExitedFullScreen; | |
23 testExpected("document.webkitCurrentFullScreenElement", span); | |
24 document.body.removeChild(div); | |
25 }; | |
26 | |
27 var spanExitedFullScreen = function(event) { | |
28 callback = null; | |
29 testExpected("document.webkitCurrentFullScreenElement", null); | |
30 endTest(); | |
31 }; | |
32 | |
33 callback = spanEnteredFullScreen; | |
34 runWithKeyDown(function(){span.webkitRequestFullScreen()}); | |
35 } | |
36 </script> | 30 </script> |
OLD | NEW |