OLD | NEW |
1 <body> | 1 <body> |
2 <script src="full-screen-test.js"></script> | 2 <script src="full-screen-test.js"></script> |
3 <p>This tests that full screen mode does not allow alphanumeric key events. Pre
ss space to continue, then press an alphanumeric key, followed by space. | 3 <p>This tests that full screen mode does not allow alphanumeric key events. Pre
ss space to continue, then press an alphanumeric key, followed by space. |
4 <span></span> | 4 <span></span> |
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 var fullscreenChanged = function(event) |
8 logResult(false, "Element.prototype.webkitRequestFullScreen == undefined
"); | 8 { |
| 9 if (callback) |
| 10 callback(event) |
| 11 }; |
| 12 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); |
| 13 |
| 14 var spanEnteredFullScreen = function() { |
| 15 callback = null; |
| 16 testExpected("document.webkitIsFullScreen", true); |
| 17 if (window.testRunner && eventSender.keyDown) { |
| 18 waitForEvent(document, 'keypress', keyPressed); |
| 19 eventSender.keyDown('a', []); |
| 20 eventSender.keyDown(' ', []); |
| 21 } |
| 22 }; |
| 23 |
| 24 var keyPressed = function(event) { |
| 25 testExpected('event.keyCode', 32); // Space |
9 endTest(); | 26 endTest(); |
10 } else { | 27 document.webkitCancelFullScreen(); |
11 var callback; | 28 } |
12 var fullscreenChanged = function(event) | 29 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); |
13 { | |
14 if (callback) | |
15 callback(event) | |
16 }; | |
17 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); | |
18 | 30 |
19 var spanEnteredFullScreen = function() { | 31 var span = document.getElementsByTagName('span')[0]; |
20 callback = null; | 32 callback = spanEnteredFullScreen; |
21 testExpected("document.webkitIsFullScreen", true); | 33 runWithKeyDown(function(){span.webkitRequestFullScreen()}); |
22 if (window.testRunner && eventSender.keyDown) { | |
23 waitForEvent(document, 'keypress', keyPressed); | |
24 eventSender.keyDown('a', []); | |
25 eventSender.keyDown(' ', []); | |
26 } | |
27 }; | |
28 | |
29 var keyPressed = function(event) { | |
30 testExpected('event.keyCode', 32); // Space | |
31 endTest(); | |
32 document.webkitCancelFullScreen(); | |
33 } | |
34 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); | |
35 | |
36 var span = document.getElementsByTagName('span')[0]; | |
37 callback = spanEnteredFullScreen; | |
38 runWithKeyDown(function(){span.webkitRequestFullScreen()}); | |
39 } | |
40 </script> | 34 </script> |
OLD | NEW |