blob: 8119e6e98b67c09fcfe025a2ca7ade204794e760 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<button onclick="doNextStep('manual');">doNextStep for manual testing</button>
<script>
description("Basic API existence test for Pointer Lock.")
window.jsTestIsAsync = true;
currentStep = 0;
function doNextStep(manual)
{
if (!window.testRunner && !manual)
return;
if (currentStep < todo.length)
setTimeout(function () { todo[currentStep++](); }, 0);
else if (currentStep++ == todo.length)
setTimeout(function () { finishJSTest(); }, 0);
}
todo = [
function () {
shouldBeDefined("navigator.webkitPointer");
shouldEvaluateTo("navigator.webkitPointer.isLocked", false);
shouldThrow("navigator.webkitPointer.lock()", "'TypeError: Not enough arguments'");
shouldEvaluateTo("navigator.webkitPointer.lock(document.body)", "undefined");
// Exit call stack to allow lock to take effect.
doNextStep();
},
function () {
shouldEvaluateTo("navigator.webkitPointer.unlock()", "undefined");
// Exit call stack to allow unlock to take effect.
doNextStep();
},
function () {
shouldBeDefined("document.onwebkitpointerlockchange");
shouldBeDefined("document.onwebkitpointerlockerror");
shouldEvaluateTo("document.webkitPointerLockElement", null);
doNextStep();
},
];
doNextStep();
</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>