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 the 'a' key. | 3 <p>This tests that full screen mode does not allow alphanumeric key events. Pre
ss space to continue, then press the 'a' key. |
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 } |
| 21 }; |
| 22 |
| 23 var keyPressed = function(event) { |
| 24 testExpected('event.keyCode', 97); // 'A' |
9 endTest(); | 25 endTest(); |
10 } else { | 26 } |
11 var callback; | |
12 var fullscreenChanged = function(event) | |
13 { | |
14 if (callback) | |
15 callback(event) | |
16 }; | |
17 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); | |
18 | 27 |
19 var spanEnteredFullScreen = function() { | 28 var span = document.getElementsByTagName('span')[0]; |
20 callback = null; | 29 callback = spanEnteredFullScreen; |
21 testExpected("document.webkitIsFullScreen", true); | 30 runWithKeyDown(function(){span.webkitRequestFullScreen(Element.ALLOW_KEYBOAR
D_INPUT)}); |
22 if (window.testRunner && eventSender.keyDown) { | |
23 waitForEvent(document, 'keypress', keyPressed); | |
24 eventSender.keyDown('a', []); | |
25 } | |
26 }; | |
27 | |
28 var keyPressed = function(event) { | |
29 testExpected('event.keyCode', 97); // 'A' | |
30 endTest(); | |
31 } | |
32 | |
33 var span = document.getElementsByTagName('span')[0]; | |
34 callback = spanEnteredFullScreen; | |
35 runWithKeyDown(function(){span.webkitRequestFullScreen(Element.ALLOW_KEY
BOARD_INPUT)}); | |
36 } | |
37 </script> | 31 </script> |
OLD | NEW |