gecko/content/media/test/test_audio_event_adopt.html

41 lines
1.2 KiB
HTML

<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=490705
-->
<head>
<title>Media test: addEventListener optimization and adoptNode</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script>
function adopt() {
var a1Node = document.getElementById("f1").contentDocument.getElementById("a1");
var adopted = document.adoptNode(a1Node);
document.body.appendChild(adopted);
return adopted;
}
function wasAudioAvailableCalled() {
var resultNode = document.getElementById("f1").contentDocument.getElementById("wasAudioAvailableCalled");
return document.adoptNode(resultNode).checked;
}
function endTest() {
is(wasAudioAvailableCalled(), true, "audioAvailable was not called");
SimpleTest.finish();
}
function startTest() {
var audio = adopt();
audio.addEventListener("ended", endTest, false);
audio.play();
}
SimpleTest.waitForExplicitFinish();
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=490705">Mozilla Bug 490705</a>
<iframe id="f1" src="file_audio_event_adopt_iframe.html" onload="startTest()"></iframe>
</body>
</html>