blob: 54382865bb4baba60dbe27e868be7424f95f9f05 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<script src="../http/tests/resources/js-test-pre.js"></script>
<script src="../http/tests/resources/pointer-lock/pointer-lock-test-harness.js"></script>
</head>
<body>
<div>
<div id="target1"></div>
</div>
<script>
description("Test that pointerlockchange event is dispatched on esc in fullscreen.")
window.jsTestIsAsync = true;
shouldBeDefined("window.testRunner");
targetDiv1 = document.getElementById("target1");
todo = [
function () {
document.documentElement.webkitRequestFullScreen();
eventExpected("onwebkitfullscreenchange", "Entered fullscreen", 1, document);
// doNextStep called by event handler.
},
function () {
doNextStepWithUserGesture();
},
function () {
expectOnlyChangeEvent("Lock targetDiv1.");
targetDiv1.requestPointerLock();
// doNextStep called by event handler.
},
function () {
shouldBe("document.pointerLockElement", "targetDiv1");
doNextStepWithUserGesture();
},
function() {
document["onpointerlockchange"] = function () {
testPassed("onpointerlockchange" + " received after: " + "Sending Escape keyDown event.");
};
//expectOnlyChangeEvent("Lock targetDiv1.");
eventExpected("onwebkitfullscreenchange", "Sending Escape keyDown event.", 1, document);
debug("Sending Escape keyDown event.");
if (window.eventSender)
eventSender.keyDown("escape");
},
function() {
shouldBe("document.pointerLockElement", "null");
shouldBe("document.webkitIsFullScreen", "false");
doNextStep();
},
];
doNextStepWithUserGesture();
</script>
<script src="../http/tests/resources/js-test-post.js"></script>
</body>
</html>