OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="full-screen-test.js"></script> | 2 <script src="full-screen-test.js"></script> |
3 <p>Test that webkitCancelFullScreen only exits one level of fullscreen</p> | 3 <p>Test that webkitCancelFullScreen only exits one level of fullscreen</p> |
4 <div><span></span></div> | 4 <div><span></span></div> |
5 <script> | 5 <script> |
6 // Bail out early if the full screen API is not enabled or is missing: | 6 var callback; |
7 if (Element.prototype.webkitRequestFullScreen == undefined) { | 7 function fullscreenChanged(event) |
8 logResult(false, "Element.prototype.webkitRequestFullScreen == undefined
"); | 8 { |
| 9 if (callback) |
| 10 callback(event) |
| 11 }; |
| 12 waitForEvent(document, "webkitfullscreenchange", fullscreenChanged); |
| 13 |
| 14 var div = document.querySelector("div"); |
| 15 function divEnteredFullScreen() |
| 16 { |
| 17 testExpected("document.webkitCurrentFullScreenElement", div); |
| 18 callback = spanEnteredFullScreen; |
| 19 runWithKeyDown(function() { span.webkitRequestFullScreen(); }); |
| 20 }; |
| 21 |
| 22 var span = document.querySelector("span"); |
| 23 function spanEnteredFullScreen() |
| 24 { |
| 25 testExpected("document.webkitCurrentFullScreenElement", span); |
| 26 callback = cancelledFullScreen; |
| 27 document.webkitCancelFullScreen(); |
| 28 }; |
| 29 |
| 30 function cancelledFullScreen() |
| 31 { |
| 32 testExpected("document.webkitCurrentFullScreenElement", div); |
9 endTest(); | 33 endTest(); |
10 } else { | 34 }; |
11 var callback; | |
12 function fullscreenChanged(event) | |
13 { | |
14 if (callback) | |
15 callback(event) | |
16 }; | |
17 waitForEvent(document, "webkitfullscreenchange", fullscreenChanged); | |
18 | 35 |
19 var div = document.querySelector("div"); | 36 callback = divEnteredFullScreen; |
20 function divEnteredFullScreen() | 37 runWithKeyDown(function() { div.webkitRequestFullScreen(); }); |
21 { | |
22 testExpected("document.webkitCurrentFullScreenElement", div); | |
23 callback = spanEnteredFullScreen; | |
24 runWithKeyDown(function() { span.webkitRequestFullScreen(); }); | |
25 }; | |
26 | |
27 var span = document.querySelector("span"); | |
28 function spanEnteredFullScreen() | |
29 { | |
30 testExpected("document.webkitCurrentFullScreenElement", span); | |
31 callback = cancelledFullScreen; | |
32 document.webkitCancelFullScreen(); | |
33 }; | |
34 | |
35 function cancelledFullScreen() | |
36 { | |
37 testExpected("document.webkitCurrentFullScreenElement", div); | |
38 endTest(); | |
39 }; | |
40 | |
41 callback = divEnteredFullScreen; | |
42 runWithKeyDown(function() { div.webkitRequestFullScreen(); }); | |
43 } | |
44 </script> | 38 </script> |
OLD | NEW |