mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
0d460e3432
This is split from the previous changeset since if we include dom/ the file size is too large for phabricator to handle. This is an autogenerated commit to handle scripts loading mochitest harness files, in the simple case where the script src is on the same line as the tag. This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170 using the `--part 2` argument. Differential Revision: https://phabricator.services.mozilla.com/D27457 --HG-- extra : moz-landing-system : lando
65 lines
1.8 KiB
HTML
65 lines
1.8 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
|
|
<head>
|
|
<title>Autoplay policy test</title>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
<script type="text/javascript" src="manifest.js"></script>
|
|
<script type="text/javascript" src="AutoplayTestUtils.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<pre id="test">
|
|
<script>
|
|
|
|
window.is = SimpleTest.is;
|
|
window.info = SimpleTest.info;
|
|
|
|
// Tests that videos can only play audibly in windows/frames
|
|
// which have been activated by same-origin user gesture.
|
|
|
|
gTestPrefs.push(["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
|
|
["media.autoplay.enabled.user-gestures-needed", true]);
|
|
|
|
SpecialPowers.pushPrefEnv({ 'set': gTestPrefs }, () => {
|
|
runTest();
|
|
});
|
|
|
|
let testCases = [
|
|
{
|
|
property: "muted",
|
|
inaudible: true,
|
|
audible: false,
|
|
},
|
|
|
|
{
|
|
property: "volume",
|
|
inaudible: 0.0,
|
|
audible: 1.0,
|
|
},
|
|
];
|
|
|
|
let child_url = "file_autoplay_policy_unmute_pauses.html";
|
|
|
|
async function runTest() {
|
|
for (testCase of testCases) {
|
|
// Run each test in a new window, to ensure its user gesture
|
|
// activation state isn't tainted by preceeding tests.
|
|
let child = window.open(child_url, "", "width=500,height=500");
|
|
await once(child, "load");
|
|
child.postMessage(testCase, window.origin);
|
|
let result = await nextWindowMessage();
|
|
child.close();
|
|
}
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
|
|
</html>
|