mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1238472 - Start playing webm after the iframe loaded. r=baku
This commit is contained in:
parent
66aa150bc3
commit
42f1849a5a
@ -8,6 +8,18 @@ var fileURL = 'http://example.org/tests/dom/browser-element/mochitest/file_brows
|
||||
var generator = runTests();
|
||||
var testFrame;
|
||||
|
||||
function alertListener(e) {
|
||||
var message = e.detail.message;
|
||||
if (/^OK/.exec(message)) {
|
||||
ok(true, "Message from file : " + message);
|
||||
continueTest();
|
||||
} else if (/^KO/.exec(message)) {
|
||||
error(message);
|
||||
} else {
|
||||
error("Undefined event.");
|
||||
}
|
||||
}
|
||||
|
||||
function error(aMessage) {
|
||||
ok(false, "Error : " + aMessage);
|
||||
finish();
|
||||
@ -22,30 +34,24 @@ function continueTest() {
|
||||
}
|
||||
|
||||
function finish() {
|
||||
testFrame.removeEventListener('mozbrowsershowmodalprompt', alertListener);
|
||||
ok(true, "Remove event-listener.");
|
||||
document.body.removeChild(testFrame);
|
||||
ok(true, "Remove test-frame from document.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function setCommand(aArg) {
|
||||
info("# Command = " + aArg);
|
||||
testFrame.src = fileURL + '#' + aArg;
|
||||
|
||||
// Yield to the event loop a few times to make sure that onactivestatechanged
|
||||
// is not dispatched.
|
||||
SimpleTest.executeSoon(function() {
|
||||
SimpleTest.executeSoon(function() {
|
||||
SimpleTest.executeSoon(function() {
|
||||
continueTest();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
setCommand('play');
|
||||
yield undefined;
|
||||
|
||||
setCommand('pause');
|
||||
// wait a second to make sure that onactivestatechanged isn't dispatched.
|
||||
setCommand('idle');
|
||||
yield undefined;
|
||||
|
||||
finish();
|
||||
@ -77,7 +83,11 @@ function setupTestFrame() {
|
||||
}
|
||||
|
||||
testFrame.addEventListener('mozbrowserloadend', loadend);
|
||||
testFrame.addEventListener('mozbrowsershowmodalprompt', alertListener);
|
||||
ok(true, "Add event-listeners.");
|
||||
|
||||
document.body.appendChild(testFrame);
|
||||
ok(true, "Append test-frame to document.");
|
||||
}
|
||||
|
||||
addEventListener('testready', function() {
|
||||
|
@ -4,8 +4,29 @@
|
||||
<script type="application/javascript;version=1.7">
|
||||
var audio = new Audio();
|
||||
audio.src = "noaudio.webm";
|
||||
audio.preload = "none";
|
||||
audio.loop = true;
|
||||
audio.play();
|
||||
|
||||
function ok(aVal, aMsg) {
|
||||
alert((!!aVal ? "OK" : "KO") + ", " + aMsg);
|
||||
}
|
||||
|
||||
function runCommands()
|
||||
{
|
||||
switch(location.hash) {
|
||||
case '#play':
|
||||
audio.play();
|
||||
ok(true, "Start playing a video without audio track!");
|
||||
break;
|
||||
case '#idle':
|
||||
ok(!audio.paused, "Video is still playing!");
|
||||
break;
|
||||
default :
|
||||
ok(false, "Undefined command!");
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('hashchange', runCommands);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -212,6 +212,7 @@ skip-if = (toolkit == 'android' && processor == 'x86') #x86 only
|
||||
[test_browserElement_inproc_Metachange.html]
|
||||
[test_browserElement_inproc_NextPaint.html]
|
||||
[test_browserElement_inproc_NoAudioTrack.html]
|
||||
tags = audiochannel
|
||||
[test_browserElement_inproc_OpenNamed.html]
|
||||
skip-if = (toolkit == 'gonk' && !debug)
|
||||
[test_browserElement_inproc_OpenTab.html]
|
||||
|
Loading…
Reference in New Issue
Block a user