b835f9a1c94462e0e6e764b247bc34d5bbeff971
[WebKit-https.git] / LayoutTests / fullscreen / full-screen-keyboard-disabled.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 an alphanumeric key, followed by space.
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                 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>