зеркало из https://github.com/mozilla/gecko-dev.git
56 строки
1.6 KiB
HTML
56 строки
1.6 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
|
|
<head>
|
|
<title>Autoplay policy test</title>
|
|
<script type="text/javascript" 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>
|
|
|
|
// Tests that we gesture activate on mousedown and keydown.
|
|
|
|
gTestPrefs.push(["media.autoplay.default", SpecialPowers.Ci.nsIAutoplay.BLOCKED],
|
|
["media.autoplay.enabled.user-gestures-needed", true]);
|
|
|
|
SpecialPowers.pushPrefEnv({ 'set': gTestPrefs }, () => {
|
|
runTest();
|
|
});
|
|
|
|
let child_url = "file_autoplay_policy_eventdown_activation.html";
|
|
|
|
async function runTest() {
|
|
// Run 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("run keydown test", window.origin);
|
|
let result = await nextWindowMessage();
|
|
child.close();
|
|
}
|
|
|
|
{
|
|
let child = window.open(child_url, "", "width=500,height=500");
|
|
await once(child, "load");
|
|
child.postMessage("run mousedown test", window.origin);
|
|
let result = await nextWindowMessage();
|
|
child.close();
|
|
}
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
|
|
</html>
|