Bug 1323983 part 3 - Add test for closing window while holding pointerlock. r=smaug

MozReview-Commit-ID: 7f1su4afmnd

--HG--
extra : rebase_source : 473b95205b23b9cf555a333048a1e5c45a9ba92c
This commit is contained in:
Xidorn Quan 2016-12-19 18:18:21 +11:00
Родитель bd41ce75cf
Коммит 5e43077df6
2 изменённых файлов: 57 добавлений и 4 удалений

Просмотреть файл

@ -1,4 +1,10 @@
[DEFAULT]
skip-if = toolkit == 'android'
[test_closewindow-with-pointerlock.html]
[test_pointerlock-api.html]
tags = fullscreen
support-files =
pointerlock_utils.js
file_pointerlock-api.html
@ -20,7 +26,3 @@ support-files =
file_allowPointerLockSandboxFlag.html
file_changeLockElement.html
iframe_differentDOM.html
[test_pointerlock-api.html]
tags = fullscreen
skip-if = toolkit == 'android'

Просмотреть файл

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Bug 1323983 - Auto-close window after holding pointerlock</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body style="width: 100vw; height: 100vh; margin: 0;">
<script>
if (!opener) {
SimpleTest.waitForExplicitFinish();
}
var newwin = null;
function finish() {
newwin.close()
setTimeout(function() {
SimpleTest.finish();
}, 0);
}
addLoadEvent(function() {
SimpleTest.waitForFocus(function() {
if (!opener) {
newwin = window.open(location);
} else {
document.addEventListener("pointerlockchange", function() {
opener.is(document.pointerLockElement, document.body,
"Check we have locked the pointer");
opener.finish();
}, {once: true});
document.addEventListener("pointerlockerror", function() {
opener.info("Fail to lock pointer");
opener.finish();
});
document.addEventListener("click", function() {
opener.info("Clicked");
document.body.requestPointerLock();
}, {once: true});
setTimeout(function() {
opener.info("Clicking");
synthesizeMouseAtCenter(document.body, {});
}, 0);
}
});
});
</script>
</body>
</html>