| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <script src="../resources/js-test-pre.js"></script> | |
| <script src="../resources/pointer-lock/pointer-lock-test-harness.js"></script> | |
| </head> | |
| <body> | |
| <div> | |
| <div id="target1"></div> | |
| <iframe src="../resources/pointer-lock/inner-iframe.html" onload="doNextStepWithUserGesture()"></iframe> | |
| </div> | |
| <script> | |
| description("Test iframe from same origin can not transfer pointer lock across documents.") | |
| window.jsTestIsAsync = true; | |
| targetDiv1 = document.getElementById("target1"); | |
| iframe = document.getElementsByTagName("iframe")[0]; | |
| todo = [ | |
| function () { | |
| expectOnlyChangeEvent("Lock targetDiv1."); | |
| targetDiv1.webkitRequestPointerLock(); | |
| // doNextStep called by event handler. | |
| }, | |
| function () { | |
| shouldBe("document.webkitPointerLockElement", "targetDiv1"); | |
| doNextStep(); | |
| }, | |
| function () { | |
| iframe.contentWindow.postMessage(["eval", 'document.body.webkitRequestPointerLock()'], "*"); | |
| window.onmessage = function (messageEvent) { | |
| message = messageEvent.data; | |
| shouldBeEqualToString("message", "inner-iframe.html onwebkitpointerlockerror"); | |
| window.onmessage = null; | |
| doNextStep(); | |
| } | |
| }, | |
| function () { | |
| iframe.contentWindow.postMessage(["eval", 'document.webkitExitPointerLock()'], "*"); | |
| window.onmessage = function (messageEvent) { | |
| testFailed("webkitExitPointerLock from a document that doesn't have a lock caused an event " + messageEvent.data); | |
| finishJSTest(); | |
| } | |
| doNextStep(); | |
| }, | |
| ]; | |
| // doNextStep() called by iframe onload handler. | |
| </script> | |
| <script src="../resources/js-test-post.js"></script> | |
| </body> | |
| </html> |