mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
7101cc436e
MozReview-Commit-ID: 7cPgJMvUoja --HG-- extra : rebase_source : 1d94df4e2fe75e1854207c52259c88813c24be50
65 lines
1.9 KiB
HTML
65 lines
1.9 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
|
|
<head>
|
|
<title>Autoplay policy window</title>
|
|
<style>
|
|
video {
|
|
width: 50%;
|
|
height: 50%;
|
|
}
|
|
</style>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
<script type="text/javascript" src="manifest.js"></script>
|
|
<script type="text/javascript" src="AutoplayTestUtils.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<pre id="test">
|
|
<script>
|
|
|
|
window.is = window.opener.is;
|
|
window.info = window.opener.info;
|
|
|
|
function testAutoplayUnmutePauses(testCase, parent_window) {
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
info("testAutoplayUnmutePauses: " + testCase.property);
|
|
|
|
let element = document.createElement("video");
|
|
element.preload = "auto";
|
|
|
|
// Make inaudible.
|
|
element[testCase.property] = testCase.inaudible;
|
|
|
|
// Once we've loaded, play, then make audible.
|
|
// Assert that the media is paused when we make it audible.
|
|
element.addEventListener("loadeddata", () => {
|
|
info("loadeddata");
|
|
element.play();
|
|
is(element.paused, false, testCase.property + "=" + testCase.inaudible + " - should be playing");
|
|
element[testCase.property] = testCase.audible;
|
|
is(element.paused, true, testCase.property + "=" + testCase.audible + " - should be paused.");
|
|
resolve();
|
|
});
|
|
|
|
element.src = "short.mp4";
|
|
element.id = "video";
|
|
document.body.appendChild(element);
|
|
});
|
|
}
|
|
|
|
nextWindowMessage().then(
|
|
(event) => {
|
|
testAutoplayUnmutePauses(event.data, event.source)
|
|
.then(() => {
|
|
event.source.postMessage("done", "*");
|
|
});
|
|
});
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
|
|
</html> |