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 if (window.testRunner) { |
6 if (Element.prototype.webkitRequestFullScreen == undefined) { | 6 testRunner.setCanOpenWindows(true); |
7 logResult(false, "Element.prototype.webkitRequestFullScreen == undefined
"); | 7 testRunner.setCloseRemainingWindowsWhenComplete(true); |
| 8 } |
| 9 var callback; |
| 10 var fullscreenChanged = function(event) |
| 11 { |
| 12 if (callback) |
| 13 callback(event) |
| 14 }; |
| 15 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); |
| 16 |
| 17 var spanEnteredFullScreen = function() { |
| 18 testExpected("document.webkitIsFullScreen", true); |
| 19 testExpected("document.webkitCurrentFullScreenElement", span); |
| 20 callback = cancelledFullScreen; |
| 21 testExpected("window.open('about:blank')", null, "!="); |
| 22 }; |
| 23 |
| 24 var cancelledFullScreen = function() { |
| 25 testExpected("document.webkitIsFullScreen", false); |
| 26 testExpected("document.webkitCurrentFullScreenElement", undefined); |
8 endTest(); | 27 endTest(); |
9 } else { | 28 }; |
10 if (window.testRunner) { | |
11 testRunner.setCanOpenWindows(true); | |
12 testRunner.setCloseRemainingWindowsWhenComplete(true); | |
13 } | |
14 var callback; | |
15 var fullscreenChanged = function(event) | |
16 { | |
17 if (callback) | |
18 callback(event) | |
19 }; | |
20 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); | |
21 | 29 |
22 var spanEnteredFullScreen = function() { | 30 var span = document.getElementsByTagName('span')[0]; |
23 testExpected("document.webkitIsFullScreen", true); | |
24 testExpected("document.webkitCurrentFullScreenElement", span); | |
25 callback = cancelledFullScreen; | |
26 testExpected("window.open('about:blank')", null, "!="); | |
27 }; | |
28 | 31 |
29 var cancelledFullScreen = function() { | 32 callback = spanEnteredFullScreen; |
30 testExpected("document.webkitIsFullScreen", false); | 33 runWithKeyDown(function(){span.webkitRequestFullScreen()}); |
31 testExpected("document.webkitCurrentFullScreenElement", undefined); | |
32 endTest(); | |
33 }; | |
34 | |
35 var span = document.getElementsByTagName('span')[0]; | |
36 | |
37 callback = spanEnteredFullScreen; | |
38 runWithKeyDown(function(){span.webkitRequestFullScreen()}); | |
39 } | |
40 </script> | 34 </script> |
OLD | NEW |