Bug 1362440 - part3 : add tests. r=jya

MozReview-Commit-ID: C4mXuPsMaF4

--HG--
extra : rebase_source : 11b69bde40b1ca336e2b9272aa2ec26c0e78507d
This commit is contained in:
Alastor Wu 2017-10-30 17:48:35 +08:00
Родитель 7440c83cae
Коммит 65c50bf89e
5 изменённых файлов: 99 добавлений и 1 удалений

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

@ -45,7 +45,10 @@ support-files =
flac/IS.mp4 flac/IS.mp4^headers^ flac/00001.m4s flac/00001.m4s^headers^
flac/00002.m4s flac/00002.m4s^headers^ flac/00003.m4s flac/00003.m4s^headers^
avc3/init.mp4 avc3/init.mp4^headers^ avc3/segment1.m4s avc3/segment1.m4s^headers^
tags_before_cluster.webm
tags_before_cluster.webm^header^
[test_AppendPartialInitSegment.html]
[test_AVC3_mp4.html]
skip-if = toolkit == 'android' # Not supported on android
[test_AudioChange_mp4.html]
@ -155,4 +158,4 @@ skip-if = toolkit == 'android' # Not supported on android
skip-if = toolkit == 'android' # Not supported on android
[test_WaitingToEndedTransition_mp4.html]
skip-if = toolkit == 'android' # Not supported on android
[test_WebMTagsBeforeCluster.html]

Двоичные данные
dom/media/mediasource/test/tags_before_cluster.webm Normal file

Двоичный файл не отображается.

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

@ -0,0 +1 @@
Cache-Control: no-store

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

@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<html>
<head>
<title>MSE: split init segment and append them separately </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, v) {
ms.addEventListener("sourceopen", function () {
var sb = ms.addSourceBuffer("video/webm");
fetchWithXHR("seek.webm", async function (arrayBuffer) {
// init segment is total 236 bytes.
info("- append partial init segment -");
sb.appendBuffer(new Uint8Array(arrayBuffer, 0, 100));
info("- wait for updateend -");
await once(sb, "updateend");
info("- append remaining init segment -");
sb.appendBuffer(new Uint8Array(arrayBuffer, 100, 136));
info("- wait for metadata -");
await once(v, "loadedmetadata");
is(v.videoWidth, 320, "videoWidth has correct initial value");
is(v.videoHeight, 240, "videoHeight has correct initial value");
info("- wait for updateend -");
await once(sb, "updateend");
SimpleTest.finish();
});
});
});
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,49 @@
<!DOCTYPE HTML>
<html>
<head>
<title>MSE: WebM tags element before cluster element</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();
addMSEPrefs(["media.mediasource.webm.enabled", true]);
runWithMSE(function (ms, v) {
ms.addEventListener("sourceopen", function () {
var sb = ms.addSourceBuffer("video/webm");
fetchWithXHR("tags_before_cluster.webm", async function (arrayBuffer) {
info("- append buffer -");
sb.appendBuffer(new Uint8Array(arrayBuffer));
info("- wait for metadata -");
await once(v, "loadedmetadata");
info("- wait for updateend -");
await once(sb, "updateend");
info("- call end of stream -");
ms.endOfStream();
await once(ms, "sourceended");
info("- check buffered range -");
is(sb.buffered.length, 1, "buffered range is not empty.");
info("- video is playing -");
v.play();
await once(v, "timeupdate");
SimpleTest.finish();
});
});
});
</script>
</pre>
</body>
</html>