Bug 745047 - Wait until actually in fullscreen before starting mozMovement pointer lock test. r=smaug
authorChris Pearce <cpearce@mozilla.com>
Tue, 22 May 2012 08:43:35 +1200
changeset 96784 e0ad3136549b9f9bd86ebebc9c2f10a504244b19
parent 96783 9463528f5c09cfef9397791075347d93d7fca65a
child 96785 451145d2c3ff802105733587535458c3622f0e99
push id1439
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 20:19:22 +0000
treeherdermozilla-aurora@ea74834dccd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs745047
milestone15.0a1
Bug 745047 - Wait until actually in fullscreen before starting mozMovement pointer lock test. r=smaug
dom/tests/mochitest/pointerlock/file_movementXY.html
--- a/dom/tests/mochitest/pointerlock/file_movementXY.html
+++ b/dom/tests/mochitest/pointerlock/file_movementXY.html
@@ -78,26 +78,34 @@ https://bugzilla.mozilla.org/show_bug.cg
           secondMove.screenY = e.screenY;
           secondMove.mozMovementX = e.mozMovementX;
           secondMove.mozMovementY = e.mozMovementY;
 
           div.removeEventListener("mousemove", moveMouseAgain, false);
           document.mozCancelFullScreen();
         };
 
-        document.addEventListener("mozfullscreenchange", function() {
+        function fullscreenchange() {
           if (document.mozFullScreenElement === div) {
+            if (window.screenX != 0 || window.screenY != 0) {
+              todo(window.screenX == 0 && window.screenY == 0,
+                "We should only receive fullscreenchange once we've finished fullscreen transition");
+              setTimeout(fullscreenchange, 250);
+              return;
+            } 
             div.addEventListener("mousemove", moveMouse, false);
             synthesizeMouseAtCenter(div, {type: "mousemove"}, window);
           }
           else {
             runTests();
             SimpleTest.finish();
           }
-        }, false);
+        }
+        
+        document.addEventListener("mozfullscreenchange", fullscreenchange, false);
 
         function start() {
           div.mozRequestFullScreen();
         }
       </script>
     </pre>
   </body>
 </html>