Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / pointer-lock / lock-lost-on-esc-in-fullscreen.html
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="../http/tests/resources/js-test-pre.js"></script>
5 <script src="../http/tests/resources/pointer-lock/pointer-lock-test-harness.js"></script>
6 </head>
7 <body>
8 <div>
9   <div id="target1"></div>
10 </div>
11 <script>
12     description("Test that pointerlockchange event is dispatched on esc in fullscreen.")
13     window.jsTestIsAsync = true;
14     shouldBeDefined("window.testRunner");
15
16     targetDiv1 = document.getElementById("target1");
17
18     todo = [
19         function () {
20             document.documentElement.webkitRequestFullScreen();
21             eventExpected("onwebkitfullscreenchange", "Entered fullscreen", 1, document);
22             // doNextStep called by event handler.
23         },
24         function () {
25             doNextStepWithUserGesture();
26         },
27         function () {
28             expectOnlyChangeEvent("Lock targetDiv1.");
29             targetDiv1.requestPointerLock();
30             // doNextStep called by event handler.
31         },
32         function () {
33             shouldBe("document.pointerLockElement", "targetDiv1");
34             doNextStepWithUserGesture();
35         },
36         function() {
37             document["onpointerlockchange"] = function () {
38                 testPassed("onpointerlockchange" + " received after: " + "Sending Escape keyDown event.");
39             };
40             //expectOnlyChangeEvent("Lock targetDiv1.");
41             eventExpected("onwebkitfullscreenchange", "Sending Escape keyDown event.", 1, document);
42             debug("Sending Escape keyDown event.");
43             if (window.eventSender)
44                 eventSender.keyDown("escape");
45         },
46         function() {
47             shouldBe("document.pointerLockElement", "null");
48             shouldBe("document.webkitIsFullScreen", "false");
49             doNextStep();
50         },
51     ];
52     doNextStepWithUserGesture();
53 </script>
54 <script src="../http/tests/resources/js-test-post.js"></script>
55 </body>
56 </html>
57