Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / pointer-lock / lock-already-locked.html
blob54700fe39fc8752b100acae66e3a4c514006b221
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="../resources/js-test.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 </div>
12 <script>
13 description("Test calling lock when already in a locked state.")
14 window.jsTestIsAsync = true;
16 targetdiv1 = document.getElementById("target1");
17 targetdiv2 = document.getElementById("target2");
19 // Expect change event only for all transitions below.
20 expectedTargetToBeLockedString = "";
21 document.onpointerlockchange = function ()
23 testPassed("document.onpointerlockchange event received.");
24 shouldBe("document.pointerLockElement", expectedTargetToBeLockedString);
25 doNextStepWithUserGesture();
27 document.onpointerlockerror =
28 function () { testFailed("document.onpointerlockerror event received."); finishJSTest(); };
30 todo = [
31 function () {
32 shouldBe("document.pointerLockElement", "null");
33 debug(" Locking targetdiv1.")
34 targetdiv1.requestPointerLock();
35 expectedTargetToBeLockedString = "targetdiv1";
36 // doNextStep() called by onpointerlockchange handler.
38 function () {
39 debug(" Locking targetdiv1, again.")
40 targetdiv1.requestPointerLock();
41 expectedTargetToBeLockedString = "targetdiv1";
42 // doNextStep() called by onpointerlockchange handler.
44 function () {
45 debug(" Locking targetdiv2.")
46 targetdiv2.requestPointerLock();
47 expectedTargetToBeLockedString = "targetdiv2";
48 // doNextStep() called by onpointerlockchange handler.
51 doNextStepWithUserGesture();
52 </script>
53 </body>
54 </html>