|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!--https://bugzilla.mozilla.org/show_bug.cgi?id=633602--> |
|
4 <head> |
|
5 <title>Bug 633602</title> |
|
6 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"> |
|
7 </script> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"> |
|
9 </script> |
|
10 <script type="application/javascript" src="pointerlock_utils.js"></script> |
|
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
12 </head> |
|
13 <body> |
|
14 <a target="_blank" |
|
15 href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602"> |
|
16 Mozilla Bug 633602 |
|
17 </a> |
|
18 <div id="div"></div> |
|
19 <pre id="test"> |
|
20 <script type="text/javascript"> |
|
21 /* |
|
22 * Test for Bug 633602 |
|
23 * Escape key should unlock the pointer |
|
24 */ |
|
25 |
|
26 SimpleTest.waitForExplicitFinish(); |
|
27 |
|
28 var div = document.getElementById("div") |
|
29 , pointerUnLocked = false; |
|
30 |
|
31 function runTests () { |
|
32 ok(pointerUnLocked, "Pressing Escape key should unlock the pointer"); |
|
33 } |
|
34 |
|
35 document.addEventListener("mozpointerlockchange", function (e) { |
|
36 if (document.mozPointerLockElement === div) { |
|
37 synthesizeKey("VK_ESCAPE", {}); |
|
38 } |
|
39 else { |
|
40 pointerUnLocked = true; |
|
41 document.mozCancelFullScreen(); |
|
42 } |
|
43 }, false); |
|
44 |
|
45 document.addEventListener("mozfullscreenchange", function(e) { |
|
46 if (document.mozFullScreenElement === div) { |
|
47 div.mozRequestPointerLock(); |
|
48 } |
|
49 else { |
|
50 runTests(); |
|
51 SimpleTest.finish(); |
|
52 } |
|
53 }, false); |
|
54 |
|
55 function start() { |
|
56 div.mozRequestFullScreen(); |
|
57 } |
|
58 </script> |
|
59 </pre> |
|
60 </body> |
|
61 </html> |