Bug 1136399 - Add test_WaitingOnMissingData_mp4.html and disable the webm version for now. r=jya

This commit is contained in:
Bobby Holley 2015-02-24 14:13:23 -08:00
Родитель 467633fff8
Коммит ff83eecae4
4 изменённых файлов: 75 добавлений и 9 удалений

Просмотреть файл

@ -44,6 +44,14 @@ function fetchWithXHR(uri, onLoadFunction) {
return p;
};
function range(start, end) {
var rv = [];
for (var i = start; i < end; ++i) {
rv.push(i);
}
return rv;
}
function once(target, name, cb) {
var p = new Promise(function(resolve, reject) {
target.addEventListener(name, function() {

Просмотреть файл

@ -43,4 +43,6 @@ skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac"))
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_TruncatedDuration.html]
[test_WaitingOnMissingData.html]
skip-if = android_version == '10' # bug 1115148 - frequent failures on Android 2.3
skip-if = true # Disabled due to bug 1124493 and friends. WebM MSE is deprioritized.
[test_WaitingOnMissingData_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+

Просмотреть файл

@ -17,14 +17,6 @@ function fuzzyEquals(a, b) {
return Math.abs(a - b) < 0.01;
}
function range(start, end) {
var rv = [];
for (var i = start; i < end; ++i) {
rv.push(i);
}
return rv;
}
runWithMSE(function(ms, el) {
el.controls = true;
once(ms, 'sourceopen').then(function() {

Просмотреть файл

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>MSE: |waiting| event when source data is missing</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="mediasource.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test"><script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
runWithMSE(function(ms, el) {
el.controls = true;
once(ms, 'sourceopen').then(function() {
ok(true, "Receive a sourceopen event");
var audiosb = ms.addSourceBuffer("audio/mp4");
var videosb = ms.addSourceBuffer("video/mp4");
fetchAndLoad(audiosb, 'bipbop/bipbop_audio', ['init'], '.mp4')
.then(fetchAndLoad.bind(null, audiosb, 'bipbop/bipbop_audio', range(1, 5), '.m4s'))
.then(fetchAndLoad.bind(null, audiosb, 'bipbop/bipbop_audio', range(6, 12), '.m4s'))
.then(fetchAndLoad.bind(null, videosb, 'bipbop/bipbop_video', ['init'], '.mp4'))
.then(fetchAndLoad.bind(null, videosb, 'bipbop/bipbop_video', range(1, 6), '.m4s'))
.then(fetchAndLoad.bind(null, videosb, 'bipbop/bipbop_video', range(7, 14), '.m4s'))
.then(function() {
// HTMLMediaElement fires 'waiting' if somebody invokes |play()| before the MDSM
// has notified it of available data. Make sure that we get 'playing' before
// we starting waiting for 'waiting'.
info("Invoking play()");
var p = once(el, 'playing');
el.play();
return p;
}).then(function() {
ok(true, "Video playing. It should play for a bit, then fire 'waiting'");
var p = once(el, 'waiting');
el.play();
return p;
}).then(function() {
// currentTime is based on the current video frame, so if the audio ends just before
// the next video frame, currentTime can be up to 1 frame's worth earlier than
// min(audioEnd, videoEnd).
isfuzzy(el.currentTime, Math.min(audiosb.buffered.end(0), videosb.buffered.end(0)) - 1/60,
1/30, "Got a waiting event at " + el.currentTime);
info("Loading more data");
var p = once(el, 'ended');
var loads = Promise.all([fetchAndLoad(audiosb, 'bipbop/bipbop_audio', [5], '.m4s'),
fetchAndLoad(videosb, 'bipbop/bipbop_video', [6], '.m4s')]);
loads.then(() => ms.endOfStream());
return p;
}).then(function() {
// These fuzz factors are bigger than they should be. We should investigate
// and fix them in bug 1137574.
isfuzzy(el.duration, 10.1, 0.1, "Video has correct duration: " + el.duration);
isfuzzy(el.currentTime, el.duration, 0.1, "Video has correct currentTime.");
SimpleTest.finish();
});
});
});
</script>
</pre>
</body>
</html>