Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / pointer-lock / requestPointerLock-can-not-transfer-between-documents.html
blobd82b0716920792eaf2f1d19f3e9ea91b9364a832
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="/js-test-resources/js-test.js"></script>
5 <script src="../resources/pointer-lock/pointer-lock-test-harness.js"></script>
6 </head>
7 <body>
8 <div>
9 <div id="target1"></div>
10 <iframe src="../resources/pointer-lock/inner-iframe.html" onload="doNextStepWithUserGesture()"></iframe>
11 </div>
12 <script>
13 description("Test iframe from same origin can not transfer pointer lock across documents.")
14 window.jsTestIsAsync = true;
16 targetDiv1 = document.getElementById("target1");
17 iframe = document.getElementsByTagName("iframe")[0];
19 todo = [
20 function () {
21 expectOnlyChangeEvent("Lock targetDiv1.");
22 targetDiv1.requestPointerLock();
23 // doNextStep called by event handler.
25 function () {
26 shouldBe("document.pointerLockElement", "targetDiv1");
27 doNextStep();
29 function () {
30 iframe.contentWindow.postMessage(["eval", 'document.body.requestPointerLock()'], "*");
31 window.onmessage = function (messageEvent) {
32 message = messageEvent.data;
33 shouldBeEqualToString("message", "inner-iframe.html onpointerlockerror");
34 window.onmessage = null;
35 doNextStep();
38 function () {
39 iframe.contentWindow.postMessage(["eval", 'document.exitPointerLock()'], "*");
40 window.onmessage = function (messageEvent) {
41 testFailed("exitPointerLock from a document that doesn't have a lock caused an event " + messageEvent.data);
42 finishJSTest();
44 doNextStep();
47 // doNextStep() called by iframe onload handler.
48 </script>
49 </body>
50 </html>