gecko-dev/dom/media/test/file_autoplay_policy_activa...

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 строки
896 B
HTML
Исходник Обычный вид История

<!DOCTYPE HTML>
<html>
<head>
<title>Autoplay policy frame</title>
Bug 1443942 - Rewrite test_mediarecorder_principals. r=bryce I changed this test earlier in this set of commits to use midflight-redirect.sjs so that we get more reliable and predictable cross origin redirects during the download. Unfortunately this test now times out on Windows. This test times out on Windows because midflight-redirect.sjs redirects at 1/4 through the resource, whereas this test expects to be able to play through to 1/5 through the resource, and on Windows that seems to be not reached during playback. This is likely due to decode latency being higher on Windows. On top of that, the test's first case can sometimes call MediaRecorder.start() before the redirect has happened, and before the principal has changed, and so start() doesn't throw a SecurityError as expected, and the test intermittently fails. Additionally, the test's code could be clearer if we used async/await. So rewrite the test to use async/await, and take advantage of midflight-redirect.sjs's redirect being more predictable than the old dynamic_redirect.sjs. Basically, we can be careful to wait for either "loadedmetadata" or "error" on the media element in order to be more confident the redirect has or hasn't happened yet. We still can't be 100% sure that the redirect won't have already happened by the time our "loadedmetadata" handlers run. It's quite possible that the download has reached 1/4 through the resource by the time the loadedmetadata handler has run, so we need to handle the "error" and "loadedmetadata" events racing. MozReview-Commit-ID: 8plMjkXgjYt --HG-- extra : rebase_source : 7305598f40c09219494f3e7150799d8875b7c30e
2018-04-05 04:35:14 +03:00
<script type="text/javascript" src="manifest.js"></script>
<script type="text/javascript" src="AutoplayTestUtils.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<style>
video {
width: 50%;
height: 50%;
}
</style>
</head>
<body>
<script>
window.addEventListener("message",
(event) => {
if (event.data == "click") {
synthesizeMouseAtCenter(document.body, {});
} else if (event.data == "play-audible") {
playAndPostResult(false, event.source);
} else if (event.data == "play-muted") {
playAndPostResult(true, event.source);
}
}, false);
let w = window.opener || window.parent;
w.postMessage("ready", "*");
</script>
</body>
</html>