Bug 1180351 - Enable pointerlock tests on Windows and Linux. r=smaug

--HG--
extra : source : 2960d9edf7f4e9b4de9f49b0aa390cd0bb4f09d7
This commit is contained in:
Xidorn Quan 2015-12-31 10:50:32 +11:00
parent 8885c963fd
commit 04d0440880
5 changed files with 17 additions and 10 deletions

View File

@ -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();
}

View File

@ -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;

View File

@ -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

View File

@ -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.

View File

@ -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;