1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/pointerlock/file_doubleLock.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=633602 1.8 +--> 1.9 +<head> 1.10 + <title>Bug 633602 - file_doubleLockCallBack.html</title> 1.11 + <script type="text/javascript" 1.12 + src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <script type="text/javascript" 1.14 + src="/tests/SimpleTest/EventUtils.js"></script> 1.15 + <script type="application/javascript" src="pointerlock_utils.js"></script> 1.16 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.17 + <style type="text/css"> 1.18 + #test-element { background-color: #94E01B; width:100px; height:100px; } 1.19 + </style> 1.20 +</head> 1.21 +<body> 1.22 + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602"> 1.23 + Mozilla Bug 633602</a> 1.24 + <div id="div"></div> 1.25 + <pre id="test"> 1.26 + <script type="text/javascript"> 1.27 + /* 1.28 + * Test for Bug 633602 1.29 + * If element requests pointerlock on itself while in pointerlock state 1.30 + * mozpointerlockchange event should be dispatched 1.31 + */ 1.32 + 1.33 + SimpleTest.waitForExplicitFinish(); 1.34 + 1.35 + var div = document.getElementById("div") 1.36 + , numberOfLocks = 0; 1.37 + 1.38 + function runTests () { 1.39 + is(numberOfLocks, 2, "Requesting pointer lock on a locked element " + 1.40 + "should dispatch mozpointerlockchange event"); 1.41 + } 1.42 + 1.43 + document.addEventListener("mozpointerlockchange", function (e) { 1.44 + if (document.mozPointerLockElement === div) { 1.45 + if (numberOfLocks === 2) { 1.46 + document.mozCancelFullScreen(); 1.47 + } 1.48 + else { 1.49 + numberOfLocks++; 1.50 + div.mozRequestPointerLock(); 1.51 + } 1.52 + } 1.53 + }, false); 1.54 + 1.55 + document.addEventListener("mozfullscreenchange", function (e) { 1.56 + if (document.mozFullScreenElement === div) { 1.57 + div.mozRequestPointerLock(); 1.58 + } 1.59 + else { 1.60 + runTests(); 1.61 + SimpleTest.finish(); 1.62 + } 1.63 + }, false); 1.64 + 1.65 + function start() { 1.66 + console.log('started'); 1.67 + div.mozRequestFullScreen(); 1.68 + } 1.69 + </script> 1.70 + </pre> 1.71 +</body> 1.72 +</html>