Bug 1185972: P5. Add mochitest testing new seek behaviour. r=jwwang

Test ensures that seeking starts right after metadata is processed if we have a known start time.
This commit is contained in:
Jean-Yves Avenard 2015-07-23 11:40:58 +10:00
Родитель c7de70dda7
Коммит ce730a7b65
2 изменённых файлов: 57 добавлений и 0 удалений

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

@ -81,6 +81,8 @@ skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac"))
skip-if = true # bug 1182946 skip-if = true # bug 1182946
[test_SeekableBeforeEndOfStreamSplit_mp4.html] [test_SeekableBeforeEndOfStreamSplit_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+ skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_SeekNoData_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_SeekTwice_mp4.html] [test_SeekTwice_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+ skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_SetModeThrows.html] [test_SetModeThrows.html]

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

@ -0,0 +1,55 @@
<!DOCTYPE HTML>
<html>
<head>
<title>MSE: basic functionality</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();
// Avoid making trouble for people who fix rounding bugs.
function fuzzyEquals(a, b) {
return Math.abs(a - b) < 0.01;
}
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, videosb, 'bipbop/bipbop_video', ['init'], '.mp4'))
.then(once.bind(null, el, 'loadedmetadata'))
.then(function() {
var p = once(el, 'seeking');
el.play();
el.currentTime = 5;
return p;
})
.then(function() {
ok(true, "Got seeking event");
var promises = [];
promises.push(once(el, 'seeked'));
promises.push(fetchAndLoad(audiosb, 'bipbop/bipbop_audio', range(5, 9), '.m4s'));
promises.push(fetchAndLoad(videosb, 'bipbop/bipbop_video', range(6, 10), '.m4s'));
return Promise.all(promises);
})
.then(function() {
ok(true, "Got seeked event");
ok(el.currentTime >= 5, "Time >= 5");
once(el, 'ended').then(SimpleTest.finish.bind(SimpleTest));
ms.endOfStream();
});
});
});
</script>
</pre>
</body>
</html>