Bug 1180351 - Enable pointerlock tests on Windows and Linux.
--- a/dom/tests/mochitest/pointerlock/file_allowPointerLockSandboxFlag.html
+++ b/dom/tests/mochitest/pointerlock/file_allowPointerLockSandboxFlag.html
@@ -27,17 +27,17 @@
<script type="application/javascript">
/*
* Test for Bug 784402
* Test allow-pointer-lock sandbox flag.
*/
SimpleTest.waitForExplicitFinish(1);
- var iframe
+ var iframe = document.getElementById("iframe")
, iframeDiv
, contentDocument
, pointerLocked = 0
, numberOfRuns = 0;
function runTests () {
is(pointerLocked, 1, "Pointer should only have been locked once. " +
"Without allow-pointer-lock flag, a sandboxed document should not be " +
@@ -50,39 +50,44 @@
// remove allow-pointer-lock sandbox flag
iframe.setAttribute("sandbox", "allow-scripts allow-same-origin");
// reloads the iframe, startTest function gets called again
iframe.setAttribute("src", "iframe_differentDOM.html");
}
function startTest () {
- iframe = document.getElementById("iframe");
+ SimpleTest.waitForFocus(doStartTest, iframe.contentWindow);
+ }
+ function doStartTest() {
contentDocument = iframe.contentDocument;
iframeDiv = contentDocument.getElementById("div");
numberOfRuns++;
contentDocument.addEventListener("mozpointerlockchange", function () {
if (contentDocument.mozPointerLockElement === iframeDiv) {
pointerLocked++;
- resetIframe();
+ contentDocument.mozCancelFullScreen();
}
});
contentDocument.addEventListener("mozpointerlockerror", function () {
contentDocument.mozCancelFullScreen();
});
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();
}
});
iframeDiv.mozRequestFullScreen();
}
</script>
--- a/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html
+++ b/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html
@@ -52,19 +52,20 @@
childDiv.mozRequestFullScreen();
}
}, false);
document.addEventListener("mozfullscreenchange", function() {
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;
document.mozCancelFullScreen();
}
else {
runTests();
SimpleTest.finish();
--- a/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html
+++ b/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html
@@ -19,16 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cg
<script type="application/javascript">
/*
* Test for Bug 633602
* Confirm that screenX/Y and clientX/Y are constants when the pointer
* is locked.
*/
SimpleTest.waitForExplicitFinish();
+ SimpleTest.requestFlakyTimeout("We may need to wait for window's moving");
var div
, divRect
, unLockedCoords
, lockedCoords
, isUnlocked = false
, isLocked = false;
--- a/dom/tests/mochitest/pointerlock/mochitest.ini
+++ b/dom/tests/mochitest/pointerlock/mochitest.ini
@@ -16,9 +16,9 @@ support-files =
file_targetOutOfFocus.html
file_screenClientXYConst.html
file_suppressSomeMouseEvents.html
file_locksvgelement.html
file_allowPointerLockSandboxFlag.html
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.
--- a/dom/tests/mochitest/pointerlock/test_pointerlock-api.html
+++ b/dom/tests/mochitest/pointerlock/test_pointerlock-api.html
@@ -22,16 +22,17 @@ https://bugzilla.mozilla.org/show_bug.cg
* Pointer Lock tests for bug 633602. These depend on the fullscreen api
* which doesn't work when run in the mochitests' iframe, since the
* mochitests' iframe doesn't have an allowfullscreen attribute. To get
* around this, all tests are run in a child window, which can go fullscreen.
* This method is borrowed from dom/html/test/test_fullscreen-api.html.
**/
SimpleTest.waitForExplicitFinish();
+ SimpleTest.requestCompleteLog();
SpecialPowers.pushPrefEnv({"set": [
["full-screen-api.enabled", true],
["full-screen-api.allow-trusted-requests-only", false],
["full-screen-api.transition-duration.enter", "0 0"],
["full-screen-api.transition-duration.leave", "0 0"]
]}, nextTest);
@@ -55,18 +56,18 @@ https://bugzilla.mozilla.org/show_bug.cg
"file_suppressSomeMouseEvents.html",
"file_targetOutOfFocus.html",
"file_withoutDOM.html",
"file_allowPointerLockSandboxFlag.html"
];
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;
var gTestIndex = 0;
function nextTest() {
if (gTestWindow) {
gTestWindow.close();