gecko-dev/dom/base/test/test_pluginMutedBeforePlay....

48 строки
1.2 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Mute window before the plugin starts playing</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="plugin.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<pre id="test">
</pre>
<iframe></iframe>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
function runTest() {
var iframe = document.querySelector("iframe");
iframe.src = "file_pluginAudioNonAutoStart.html";
async function muteBeforePlay() {
ok(!iframe.contentWindow.pluginMuted(), "Plugin should not be muted");
await iframe.contentWindow.toggleMuteState(true);
iframe.contentWindow.startAudio();
ok(iframe.contentWindow.pluginMuted(), "Plugin should still be muted after playing");
iframe.contentWindow.stopAudio();
// Reset the window's mute state, avoid to interrupt other tests.
await iframe.contentWindow.toggleMuteState(false);
SimpleTest.finish();
}
iframe.onload = async function() {
ok(true, "Already load iframe.");
await muteBeforePlay();
}
}
onload = runTest;
</script>
</body>
</html>