Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / pointer-lock / pointerlockchange-pointerlockerror-events.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 id="target2"></div>
11   <iframe id="iframe1"></iframe>
12   <iframe id="iframe2"></iframe>
13 </div>
14 <script>
15     description("Test expected pointerlockchange and pointerlockerror events.")
16     window.jsTestIsAsync = true;
17
18     targetDiv1 = document.getElementById("target1");
19     targetDiv2 = document.getElementById("target2");
20     targetIframe1 = document.getElementById("iframe1");
21     targetIframe2 = document.getElementById("iframe2");
22
23     todo = [
24         function () {
25             expectNoEvents("Unlock.");
26             document.exitPointerLock();
27             doNextStepWithUserGesture();
28         },
29         function () {
30             expectOnlyChangeEvent("Lock targetDiv1.");
31             targetDiv1.requestPointerLock();
32         },
33         function () {
34             expectOnlyChangeEvent("Unlock again.");
35             document.exitPointerLock();
36         },
37         function () {
38             expectOnlyChangeEvent("Lock targetDiv1 again.");
39             targetDiv1.requestPointerLock();
40         },
41         function () {
42             expectOnlyChangeEvent("Lock targetDiv2.");
43             targetDiv2.requestPointerLock();
44         },
45         function () {
46             expectOnlyChangeEvent("Lock targetDiv2 again.");
47             targetDiv2.requestPointerLock();
48         },
49         function () {
50             expectOnlyChangeEvent("Unlock targetDiv2.");
51             document.exitPointerLock();
52         },
53         function () {
54             targetIframe1.src = "about:blank";
55             targetIframe1.onload = function () { doNextStep(); }
56         },
57         function () {
58             targetIframe2.src = "about:blank";
59             targetIframe2.onload = function () { doNextStep(); }
60         },
61         function () {
62             expectNoEvents("Lock targetIframe1.");
63             expectOnlyChangeEvent("Lock targetIframe1 (handler for iframe1).", targetIframe1.contentDocument);
64             targetIframe1.contentDocument.body.requestPointerLock();
65         },
66         function () {
67             expectNoEvents("Lock targetIframe2.");
68             expectNoEvents("Lock targetIframe2 (handler for iframe1).", targetIframe1.contentDocument);
69             expectOnlyErrorEvent("Lock targetIframe2 (handler for iframe2).", targetIframe2.contentDocument);
70             targetIframe2.contentDocument.body.requestPointerLock();
71         },
72         function () {
73             expectNoEvents("Unlock targetIframe2.");
74             expectOnlyChangeEvent("Unlock targetIframe2 (handler for iframe1).", targetIframe1.contentDocument);
75             expectNoEvents("Unlock targetIframe2 (handler for iframe2).", targetIframe2.contentDocument);
76             targetIframe1.contentDocument.exitPointerLock();
77         },
78         function () {
79             shouldBeDefined("testRunner.setPointerLockWillFailSynchronously");
80             testRunner.setPointerLockWillFailSynchronously();
81             expectOnlyErrorEvent("Lock with synchronous failure.");
82             targetDiv1.requestPointerLock();
83         },
84         function () {
85             shouldBeDefined("testRunner.setPointerLockWillRespondAsynchronously");
86             shouldBeDefined("testRunner.didAcquirePointerLock");
87             shouldBeDefined("testRunner.didNotAcquirePointerLock");
88             testRunner.setPointerLockWillRespondAsynchronously();
89             expectOnlyErrorEvent("Lock with asynchronous failure.");
90             targetDiv1.requestPointerLock();
91             doNextStep();
92         },
93         function () {
94             testRunner.didNotAcquirePointerLock();
95         },
96         function () {
97             testRunner.setPointerLockWillRespondAsynchronously();
98             expectOnlyChangeEvent("Lock with asynchronous success.");
99             targetDiv1.requestPointerLock();
100             doNextStep();
101         },
102         function () {
103             testRunner.didAcquirePointerLock();
104         },
105     ];
106     doNextStep();
107 </script>
108 <script src="../http/tests/resources/js-test-post.js"></script>
109 </body>
110 </html>