Fonts, fullscreen, gamepad, and html5lib tests should use testRunner instead of layou...
[WebKit-https.git] / LayoutTests / fullscreen / full-screen-element-stack.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4     <script src="full-screen-test.js"></script>
5     <script>
6     var one;
7     var two;
8
9     function runTest() {
10         one = document.getElementById('one');
11         two = document.getElementById('two');
12
13         var callback;
14         var fullscreenChanged = function(event) {
15             if (callback)
16                 callback(event)
17         };
18         waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
19
20         var oneEnteredFullscreen = function() {
21             testExpected("document.webkitFullscreenElement.id", "one");
22             callback = twoEnteredFullscreen;
23             if (window.testRunner)
24                 runWithKeyDown(function() { two.webkitRequestFullscreen(); });
25         };
26
27         var twoEnteredFullscreen = function() {
28             testExpected("document.webkitFullscreenElement.id", "two");
29             callback = twoExitedFullscreen;
30             if (window.testRunner)
31                 document.webkitExitFullscreen();
32         };
33
34         var twoExitedFullscreen = function() { 
35             testExpected("document.webkitFullscreenElement.id", "one");
36             endTest();
37         };
38
39         callback = oneEnteredFullscreen;
40         if (window.testRunner)
41             runWithKeyDown(function() { one.webkitRequestFullscreen(); });
42     }
43     </script>
44 </head>
45 <body onload="runTest()">
46     <p>Test for <a href="http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#fullscreen-element-stack">W3C Fullscreen element stack</a>.</p>
47     <p>To test manually, click the "Go full screen" button - the page should enter full screen mode.</p>
48     <div>
49         <button onclick="one.webkitRequestFullscreen()">Go full screen (one)</button>
50     </div>
51     <div id=one>
52         <button onclick="two.webkitRequestFullscreen()">Go full screen (two)</button>
53         <div id=two>
54             <button onclick="document.webkitExitFullscreen()">Exit full screen (two)</button>
55         </div>
56     </div>
57 </body>