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