From f064f16306b68e5df17ebc83673a35203caafbed Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Thu, 31 Dec 2015 10:50:32 +1100 Subject: [PATCH] Bug 1180351 - Enable pointerlock tests on Windows and Linux. r=smaug --- .../file_allowPointerLockSandboxFlag.html | 15 ++++++++++----- .../pointerlock/file_nestedFullScreen.html | 5 +++-- .../pointerlock/file_screenClientXYConst.html | 1 + dom/tests/mochitest/pointerlock/mochitest.ini | 2 +- .../pointerlock/test_pointerlock-api.html | 4 ++-- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/dom/tests/mochitest/pointerlock/file_allowPointerLockSandboxFlag.html b/dom/tests/mochitest/pointerlock/file_allowPointerLockSandboxFlag.html index 5cef661c48c..5540909ef75 100644 --- a/dom/tests/mochitest/pointerlock/file_allowPointerLockSandboxFlag.html +++ b/dom/tests/mochitest/pointerlock/file_allowPointerLockSandboxFlag.html @@ -32,7 +32,7 @@ SimpleTest.waitForExplicitFinish(1); - var iframe + var iframe = document.getElementById("iframe") , iframeDiv , contentDocument , pointerLocked = 0 @@ -55,7 +55,9 @@ } function startTest () { - iframe = document.getElementById("iframe"); + SimpleTest.waitForFocus(doStartTest, iframe.contentWindow); + } + function doStartTest() { contentDocument = iframe.contentDocument; iframeDiv = contentDocument.getElementById("div"); @@ -64,7 +66,7 @@ contentDocument.addEventListener("mozpointerlockchange", function () { if (contentDocument.mozPointerLockElement === iframeDiv) { pointerLocked++; - resetIframe(); + contentDocument.mozCancelFullScreen(); } }); @@ -73,11 +75,14 @@ }); contentDocument.addEventListener("mozfullscreenchange", function () { - if (contentDocument.mozFullScreen && - contentDocument.mozFullScreenElement === iframeDiv) { + if (contentDocument.mozFullScreen) { + ok(contentDocument.mozFullScreenElement === iframeDiv, + "Fullscreen element can only be iframe div"); // during second run iframe won't have allow-pointer-lock flag and // mozRequestPointerLock will fail, mozpointerlockerror should be fired iframeDiv.mozRequestPointerLock(); + } else if (numberOfRuns === 1) { + resetIframe(); } else if (numberOfRuns === 2) { runTests(); } diff --git a/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html b/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html index bba42edbb41..56d1fefbbe4 100644 --- a/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html +++ b/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html @@ -57,9 +57,10 @@ if (document.mozFullScreenElement === parentDiv) { if (parentDivFullScreen === true) { document.mozCancelFullScreen(); + } else { + parentDivFullScreen = true; + parentDiv.mozRequestPointerLock(); } - parentDivFullScreen = true; - parentDiv.mozRequestPointerLock(); } else if (document.mozFullScreenElement === childDiv) { pointerLocked = !!document.mozPointerLockElement; diff --git a/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html b/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html index 200feec207a..01b1d1d43e1 100644 --- a/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html +++ b/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html @@ -24,6 +24,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602 */ SimpleTest.waitForExplicitFinish(); + SimpleTest.requestFlakyTimeout("We may need to wait for window's moving"); var div , divRect diff --git a/dom/tests/mochitest/pointerlock/mochitest.ini b/dom/tests/mochitest/pointerlock/mochitest.ini index 07aeac0abd1..14a5b627e28 100644 --- a/dom/tests/mochitest/pointerlock/mochitest.ini +++ b/dom/tests/mochitest/pointerlock/mochitest.ini @@ -21,4 +21,4 @@ support-files = iframe_differentDOM.html [test_pointerlock-api.html] -skip-if = buildapp == 'b2g' || toolkit == 'android' || os == 'linux' || os == 'win' # B2G - window.open focus issues using fullscreen. (For Linux & Win) Bug1180351 +skip-if = buildapp == 'b2g' || toolkit == 'android' # B2G - window.open focus issues using fullscreen. diff --git a/dom/tests/mochitest/pointerlock/test_pointerlock-api.html b/dom/tests/mochitest/pointerlock/test_pointerlock-api.html index 002bd781733..e7a983afb47 100644 --- a/dom/tests/mochitest/pointerlock/test_pointerlock-api.html +++ b/dom/tests/mochitest/pointerlock/test_pointerlock-api.html @@ -60,8 +60,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602 var gDisableList = [ // Bug 1174323 - { file: "file_screenClientXYConst.html", - platform: "MacIntel" } + { file: "file_screenClientXYConst.html", platform: "MacIntel" }, + { file: "file_screenClientXYConst.html", platform: "Win64" }, ]; var gTestWindow = null;