Bug 792935 - Add tests for canPlayType for DASH (Media Mochitests) r=cpearce

This commit is contained in:
Steve Workman 2013-01-23 11:24:41 -08:00
Родитель 593ddfe86f
Коммит deaad7b601
8 изменённых файлов: 134 добавлений и 0 удалений

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

@ -38,6 +38,7 @@ MOCHITEST_FILES = \
can_play_type_ogg.js \ can_play_type_ogg.js \
can_play_type_wave.js \ can_play_type_wave.js \
can_play_type_webm.js \ can_play_type_webm.js \
can_play_type_dash.js \
can_play_type_mpeg.js \ can_play_type_mpeg.js \
cancellable_request.sjs \ cancellable_request.sjs \
dynamic_redirect.sjs \ dynamic_redirect.sjs \
@ -337,6 +338,20 @@ MOCHITEST_FILES += \
$(NULL) $(NULL)
endif endif
ifdef MOZ_DASH
MOCHITEST_FILES += \
test_can_play_type_dash.html \
dash/dash-manifest.mpd \
dash/dash-webm-video-320x180.webm \
dash/dash-webm-video-428x240.webm \
dash/dash-webm-audio-128k.webm \
$(NULL)
else
MOCHITEST_FILES += \
test_can_play_type_no_dash.html \
$(NULL)
endif
ifdef MOZ_WAVE ifdef MOZ_WAVE
MOCHITEST_FILES += \ MOCHITEST_FILES += \
test_can_play_type_wave.html \ test_can_play_type_wave.html \

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

@ -0,0 +1,27 @@
function check_dash(v, enabled) {
function check(type, expected) {
is(v.canPlayType(type), enabled ? expected : "", type);
}
// DASH types
check("application/dash+xml", "probably");
// Supported Webm codecs
check("application/dash+xml; codecs=vorbis", "probably");
check("application/dash+xml; codecs=vorbis", "probably");
check("application/dash+xml; codecs=vorbis,vp8", "probably");
check("application/dash+xml; codecs=vorbis,vp8.0", "probably");
check("application/dash+xml; codecs=\"vorbis,vp8\"", "probably");
check("application/dash+xml; codecs=\"vorbis,vp8.0\"", "probably");
check("application/dash+xml; codecs=\"vp8, vorbis\"", "probably");
check("application/dash+xml; codecs=\"vp8.0, vorbis\"", "probably");
check("application/dash+xml; codecs=vp8", "probably");
check("application/dash+xml; codecs=vp8.0", "probably");
// Unsupported codecs
check("application/dash+xml; codecs=xyz", "");
check("application/dash+xml; codecs=xyz,vorbis", "");
check("application/dash+xml; codecs=vorbis,xyz", "");
check("application/dash+xml; codecs=xyz,vp8.0", "");
check("application/dash+xml; codecs=vp8.0,xyz", "");
}

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

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<MPD
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:mpeg:DASH:schema:MPD:2011"
xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011"
type="static"
mediaPresentationDuration="PT3.958S"
minBufferTime="PT1S"
profiles="urn:webm:dash:profile:webm-on-demand:2012">
<BaseURL>./</BaseURL>
<Period id="0" start="PT0S" duration="PT3.958S" >
<AdaptationSet id="0" mimeType="video/webm" codecs="vp8" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1" bitstreamSwitching="true">
<Representation id="0" bandwidth="54207" width="320" height="180">
<BaseURL>dash-webm-video-320x180.webm</BaseURL>
<SegmentBase indexRange="35090-35123">
<Initialization range="0-228" />
</SegmentBase>
</Representation>
<Representation id="1" bandwidth="78006" width="428" height="240">
<BaseURL>dash-webm-video-428x240.webm</BaseURL>
<SegmentBase indexRange="50173-50206">
<Initialization range="0-228" />
</SegmentBase>
</Representation>
</AdaptationSet>
<AdaptationSet id="1" mimeType="audio/webm" codecs="vorbis" lang="eng" audioSamplingRate="48000" subsegmentStartsWithSAP="1">
<Representation id="2" bandwidth="57264">
<BaseURL>dash-webm-audio-128k.webm</BaseURL>
<SegmentBase indexRange="41927-41946">
<Initialization range="0-4521" />
</SegmentBase>
</Representation>
</AdaptationSet>
</Period>
</MPD>

Двоичные данные
content/media/test/dash/dash-webm-audio-128k.webm Normal file

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

Двоичные данные
content/media/test/dash/dash-webm-video-320x180.webm Normal file

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

Двоичные данные
content/media/test/dash/dash-webm-video-428x240.webm Normal file

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

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

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=792935
-->
<head>
<title>Test for Bug 792935: DASH: Add DASH-WebM cases to mochitests</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=792935">Mozilla Bug 792935: DASH: Add DASH-WebM cases to mochitests</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<video id="v"></video>
<pre id="test">
<script src="can_play_type_dash.js"></script>
<script>
var enabledByPref = SpecialPowers.getBoolPref("media.dash.enabled");
check_dash(document.getElementById('v'), enabledByPref);
mediaTestCleanup();
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,28 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=792935
-->
<head>
<title>Test for Bug 792935: DASH: Add DASH-WebM cases to mochitests</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=792935">Mozilla Bug 792935: DASH: Add DASH-WebM cases to mochitests</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<video id="v"></video>
<pre id="test">
<script src="can_play_type_dash.js"></script>
<script>
check_dash(document.getElementById('v'), false);
mediaTestCleanup();
</script>
</pre>
</body>
</html>