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 var span = document.getElementsByTagName('span')[0]; |
6 if (Element.prototype.webkitRequestFullscreen == undefined) { | 6 |
7 logResult(false, "Element.prototype.webkitRequestFullscreen == undefined
"); | 7 var documentEnteredFullScreen = function() { |
| 8 testExpected("document.webkitCurrentFullScreenElement", document.documen
tElement); |
| 9 runWithKeyDown(function(){document.documentElement.webkitRequestFullscre
en()}); |
| 10 waitForEvent(document, 'webkitfullscreenerror', documentDidNotReenterFul
lScreen, false, true); |
| 11 }; |
| 12 |
| 13 var documentDidNotReenterFullScreen = function() { |
| 14 testExpected("document.webkitCurrentFullScreenElement", document.documen
tElement); |
| 15 runWithKeyDown(function(){span.webkitRequestFullscreen()}); |
| 16 waitForEvent(document, 'webkitfullscreenchange', spanEnteredFullScreen,
false, true); |
| 17 }; |
| 18 |
| 19 var spanEnteredFullScreen = function() { |
| 20 testExpected("document.webkitCurrentFullScreenElement", span); |
| 21 runWithKeyDown(function(){span.webkitRequestFullscreen()}); |
| 22 waitForEvent(document, 'webkitfullscreenerror', spanDidNotReenterFullScr
een, false, true); |
| 23 }; |
| 24 |
| 25 var spanDidNotReenterFullScreen = function() { |
| 26 testExpected("document.webkitCurrentFullScreenElement", span); |
| 27 waitForEvent(document, 'webkitfullscreenchange', spanExited, false, true
); |
| 28 document.webkitExitFullscreen(); |
| 29 }; |
| 30 |
| 31 var spanExited = function() { |
| 32 testExpected("document.webkitCurrentFullScreenElement", document.documen
tElement); |
| 33 waitForEvent(document, 'webkitfullscreenchange', documentExited, false,
true); |
| 34 document.webkitExitFullscreen(); |
| 35 }; |
| 36 |
| 37 var documentExited = function() { |
| 38 testExpected("document.webkitCurrentFullScreenElement", undefined); |
8 endTest(); | 39 endTest(); |
9 } else { | 40 }; |
10 var span = document.getElementsByTagName('span')[0]; | |
11 | 41 |
12 var documentEnteredFullScreen = function() { | 42 runWithKeyDown(function(){document.documentElement.webkitRequestFullscreen()
}); |
13 testExpected("document.webkitCurrentFullScreenElement", document.doc
umentElement); | 43 waitForEvent(document, 'webkitfullscreenchange', documentEnteredFullScreen,
false, true); |
14 runWithKeyDown(function(){document.documentElement.webkitRequestFull
screen()}); | |
15 waitForEvent(document, 'webkitfullscreenerror', documentDidNotReente
rFullScreen, false, true); | |
16 }; | |
17 | |
18 var documentDidNotReenterFullScreen = function() { | |
19 testExpected("document.webkitCurrentFullScreenElement", document.doc
umentElement); | |
20 runWithKeyDown(function(){span.webkitRequestFullscreen()}); | |
21 waitForEvent(document, 'webkitfullscreenchange', spanEnteredFullScre
en, false, true); | |
22 }; | |
23 | |
24 var spanEnteredFullScreen = function() { | |
25 testExpected("document.webkitCurrentFullScreenElement", span); | |
26 runWithKeyDown(function(){span.webkitRequestFullscreen()}); | |
27 waitForEvent(document, 'webkitfullscreenerror', spanDidNotReenterFul
lScreen, false, true); | |
28 }; | |
29 | |
30 var spanDidNotReenterFullScreen = function() { | |
31 testExpected("document.webkitCurrentFullScreenElement", span); | |
32 waitForEvent(document, 'webkitfullscreenchange', spanExited, false,
true); | |
33 document.webkitExitFullscreen(); | |
34 }; | |
35 | |
36 var spanExited = function() { | |
37 testExpected("document.webkitCurrentFullScreenElement", document.doc
umentElement); | |
38 waitForEvent(document, 'webkitfullscreenchange', documentExited, fal
se, true); | |
39 document.webkitExitFullscreen(); | |
40 }; | |
41 | |
42 var documentExited = function() { | |
43 testExpected("document.webkitCurrentFullScreenElement", undefined); | |
44 endTest(); | |
45 }; | |
46 | |
47 runWithKeyDown(function(){document.documentElement.webkitRequestFullscre
en()}); | |
48 waitForEvent(document, 'webkitfullscreenchange', documentEnteredFullScre
en, false, true); | |
49 } | |
50 </script> | 44 </script> |
OLD | NEW |