2011-05-16 Jeremy Noble <jer.noble@apple.com>
[WebKit-https.git] / LayoutTests / fullscreen / full-screen-keyboard-enabled.html
1 <body>
2 <script src="full-screen-test.js"></script>
3 <p>This tests that full screen mode does not allow alphanumeric key events.  Press space to continue, then press the 'a' key.
4 <span></span>
5 <script>
6     // Bail out early if the full screen API is not enabled or is missing:
7     if (Element.prototype.webkitRequestFullScreen == undefined) {
8         logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
9         endTest();
10     } else {
11         var callback;
12         var fullscreenChanged = function(event)
13         {
14             if (callback)
15                 callback(event)
16         };
17         waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
18
19         var spanEnteredFullScreen = function() {
20             callback = null;
21             testExpected("document.webkitIsFullScreen", true);
22             if (window.layoutTestController && 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_KEYBOARD_INPUT)});
36     }
37 </script>