Bug 469268 - More mochitests for the Wave decoder backend. Also enable the test disabled due to bug 474754. r+sr=roc

This commit is contained in:
Matthew Gregan 2009-02-19 18:23:13 +01:00
Родитель 43ed7d115e
Коммит efe62e0346
14 изменённых файлов: 653 добавлений и 5 удалений

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

@ -64,6 +64,7 @@ _TEST_FILES += \
file_access_controls.html \
test_bug448534.html \
test_bug461281.html \
test_bug468190.html \
test_can_play_type_ogg.html \
test_contentDuration1.html \
test_contentDuration2.html \
@ -89,7 +90,7 @@ _TEST_FILES += \
test_videoDocumentTitle.html \
320x240.allow-origin.ogv \
320x240.allow-origin.ogv^headers^ \
bug461281.ogg \
bug461281.ogg \
redirect.sjs \
contentDuration1.sjs \
contentDuration2.sjs \
@ -125,11 +126,17 @@ _TEST_FILES += \
test_audioDocumentTitle.html \
big.wav \
test_bug463162.xhtml \
test_bug465498.html \
test_bug468190_wav.html \
test_can_play_type_wave.html \
test_wav_8bit.html \
test_wav_ended1.html \
test_wav_ended2.html \
test_wav_list.html \
test_progress2.html \
test_progress4.html \
test_wav_onloadedmetadata.html \
test_wav_seek1.html \
test_wav_seek3.html \
test_wav_seek4.html \
test_wav_seek5.html \
@ -138,15 +145,18 @@ _TEST_FILES += \
test_wav_seek8.html \
test_wav_seek_past_end.html \
test_wav_seek_then_play.html \
test_wav_standalone.html \
test_wav_timeupdate1.html \
test_wav_timeupdate2.html \
test_wav_trailing.html \
test_wav_trunc.html \
test_wav_trunc_seek.html \
r11025_s16_c1.wav \
r11025_s16_c1_trailing.wav \
r11025_u8_c1.wav \
r11025_u8_c1_trunc.wav \
r16000_u8_c1_list.wav \
$(NULL)
#XXX: disabled for now, see bug 474754
# test_wav_trunc.html \
else
_TEST_FILES += \
test_can_play_type_no_wave.html \

Двоичные данные
content/media/video/test/r16000_u8_c1_list.wav Normal file

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

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

@ -0,0 +1,55 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Wave Media test: Bug 465498 - Seeking after playback ended</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=465498">Mozilla Bug 465498</a>
<pre id="test">
<script class="testbody" type="text/javascript">
var haveSeeked = false;
function startTest() {
var v = document.getElementById('v');
v.play();
return false;
}
function playbackEnded() {
var v = document.getElementById('v');
ok(v.currentTime >= 0.9 && v.currentTime <= 1.1,
"Checking currentTime at end: " + v.currentTime);
ok(v.ended, "Checking playback has ended");
v.currentTime = 0;
ok(!v.ended, "Checking ended is no longer true");
haveSeeked = true;
return false;
}
function endTest() {
if (!haveSeeked)
return false;
var v = document.getElementById('v');
ok(v.currentTime == 0, "Checking currentTime after seek: " + v.currentTime);
ok(!v.ended, "Checking ended is false");
SimpleTest.finish();
return false;
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<audio id='v'
onloadedmetadata='return startTest();'
onended='return playbackEnded();'
onseeked='return endTest();'>
<source type='audio/x-wav' src='r11025_s16_c1.wav'>
</audio>
</body>
</html>

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

@ -0,0 +1,67 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=468190
-->
<head>
<title>Test for bug 468190</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=468190">Mozilla Bug 468190</a>
<pre id="test">
<script class="testbody" type="text/javascript">
// Test if video can be replayed after ended.
var completed = false;
var playCount = 0;
function startTest() {
if (completed)
return false;
var v = document.getElementById('v');
v.play();
return false;
}
function playbackStarted() {
if (completed)
return false;
playCount++;
}
function playbackEnded() {
if (completed)
return false
var v = document.getElementById('v');
ok(v.currentTime >= 3.9 && v.currentTime <= 4.0,
"Checking currentTime at end: " + v.currentTime);
ok(v.ended, "Checking playback has ended");
if (playCount < 2) {
v.currentTime = 0;
ok(v.seeking, "Checking that seeking is now true");
ok(!v.ended, "Checking ended is no longer set as seeking has begun");
v.play();
}
else {
ok(playCount == 2, "Check playback after ended event");
completed = true;
SimpleTest.finish();
}
return false;
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
src='seek.ogv'
onloadedmetadata='return startTest();'
onplay='return playbackStarted();'
onended='return playbackEnded();'></video>
</body>
</html>

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

@ -0,0 +1,66 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=468190
-->
<head>
<title>Test for bug 468190</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=468190">Mozilla Bug 468190</a>
<pre id="test">
<script class="testbody" type="text/javascript">
// Test if video can be replayed after ended.
var completed = false;
var playCount = 0;
function startTest() {
if (completed)
return false;
var v = document.getElementById('v');
v.play();
return false;
}
function playbackStarted() {
if (completed)
return false;
playCount++;
}
function playbackEnded() {
if (completed)
return false
var v = document.getElementById('v');
ok(v.currentTime >= 0.9 && v.currentTime <= 1.1,
"Checking currentTime at end: " + v.currentTime);
ok(v.ended, "Checking playback has ended");
if (playCount < 2) {
v.currentTime = 0;
ok(v.seeking, "Checking that seeking is now true");
ok(!v.ended, "Checking ended is no longer set as seeking has begun");
v.play();
}
else {
ok(playCount == 2, "Check playback after ended event");
completed = true;
SimpleTest.finish();
}
return false;
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
onloadedmetadata='return startTest();'
onplay='return playbackStarted();'
onended='return playbackEnded();'><source src='r11025_s16_c1.wav' type='audio/x-wav'></video>
</body>
</html>

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

@ -47,7 +47,7 @@ function seekEnded() {
function loadedData() {
gLoadedDataCount++;
ok(gLoadedDataCount <= 1, "No more than 1 onloaddata events");
ok(gLoadedDataCount <= 1, "No more than 1 onloadeddata events");
}
function loadedMetaData() {

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

@ -32,6 +32,7 @@ function startTest() {
v.play();
v.currentTime=2;
seekFlagStart = v.seeking;
return false;
}
@ -41,7 +42,6 @@ function seekStarted() {
var v = document.getElementById('v');
v.pause();
startPassed = true;
seekFlagStart = v.seeking;
return false;
}

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

@ -0,0 +1,62 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Wave Media test: ended and replaying</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<!-- try with autoplay and no v.play in starttest, also with both -->
<pre id="test">
<script class="testbody" type="text/javascript">
// Test if audio can be replayed after ended.
var completed = false;
var playCount = 0;
function startTest() {
if (completed)
return false;
var v = document.getElementById('v');
v.play();
return false;
}
function playbackStarted() {
if (completed)
return false;
playCount++;
}
function playbackEnded() {
if (completed)
return false
var v = document.getElementById('v');
ok(v.currentTime >= 0.9 && v.currentTime <= 1.1,
"Checking currentTime at end: " + v.currentTime);
ok(v.ended, "Checking playback has ended");
if (playCount < 2) {
v.play();
}
else {
ok(playCount == 2, "Check playback after ended event");
completed = true;
SimpleTest.finish();
}
return false;
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<audio id='v'
onloadedmetadata='return startTest();'
onplay='return playbackStarted();'
onended='return playbackEnded();'>
<source type='audio/x-wav' src='r11025_s16_c1.wav'>
</audio>
</body>
</html>

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

@ -0,0 +1,47 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Wave Media test: playback of file with list chunk</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
// Test if the ended event works correctly.
var endPassed = false;
var completed = false;
function startTest() {
if (completed)
return false;
var v = document.getElementById('v');
ok(v.duration > 4.1 && v.duration < 4.3, "Duration should be around 4.2: " + v.duration);
v.play();
return false;
}
function playbackEnded() {
if (completed)
return false
var v = document.getElementById('v');
completed = true;
ok(v.currentTime >= 4.1 && v.currentTime <= 4.3,
"Checking currentTime at end: " + v.currentTime);
ok(v.ended, "Checking playback has ended");
SimpleTest.finish();
return false;
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<audio id='v'
onloadedmetadata='return startTest();'
onended='return playbackEnded();'>
<source type='audio/x-wav' src='r16000_u8_c1_list.wav'>
</audio>
</body>
</html>

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

@ -0,0 +1,88 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=467972
-->
<head>
<title>Wav Test for Bug 467972</title>
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=467972">Mozilla Bug 467972</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 467972 **/
var gEnded = false;
var gSeekStarted = false;
var gSeekEnded = false;
var gLoadedDataCount = 0;
var gLoadedMetaDataCount = 0;
function get(id) {
return document.getElementById(id);
}
function video() {
return get('v');
}
function seekStarted() {
gSeekStarted = true;
}
function seekEnded() {
gSeekEnded = true;
video().play();
}
function loadedData() {
gLoadedDataCount++;
ok(gLoadedDataCount <= 1, "No more than 1 onloadeddata events");
}
function loadedMetaData() {
gLoadedMetaDataCount++;
ok(gLoadedMetaDataCount <= 1, "No more than 1 onloadedmetadata events");
ok(video().duration > 0.9 && video().duration < 1.1, "Duration should be around 1.0");
video().play();
return false;
}
function playbackEnded() {
if (!gEnded) {
dump('seeking to start\n');
video().currentTime = 0;
gEnded = true;
} else {
ok(gSeekEnded, "Should have received seekended");
ok(gSeekStarted, "Should have received seekstarted");
is(gLoadedDataCount, 1, "Should have 1 onloadeddata event");
is(gLoadedMetaDataCount, 1, "Should have 1 onloadedmetadata event");
SimpleTest.finish();
}
return false;
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id="v"
onloadedmetadata="return loadedMetaData();"
onended="playbackEnded();"
onloadeddata="return loadedData();"
onseeking="seekStarted();"
onseeked="seekEnded();"
src="r11025_s16_c1.wav"
controls></video>
</body>
</html>

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

@ -0,0 +1,86 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Wave Media test: seek test 1</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var startPassed = false;
var endPassed = false;
var seekFlagStart = false;
var seekFlagEnd = false;
var readonly = true;
var completed = false;
function startTest() {
if (completed)
return false;
var v = document.getElementById('v');
ok(!v.seeking, "seeking should default to false");
try {
v.seeking = 1;
readonly = false;
}
catch(e) {
readonly = true;
}
ok(readonly, "seeking should be readonly");
v.play();
v.currentTime=0.5;
seekFlagStart = v.seeking;
return false;
}
function seekStarted() {
if (completed)
return false;
var v = document.getElementById('v');
v.pause();
startPassed = true;
return false;
}
function seekEnded() {
if (completed)
return false;
var v = document.getElementById('v');
var t = v.currentTime;
ok(t >= 0.4 && t <= 0.6, "Video currentTime should be around 0.5: " + t);
v.play();
endPassed = true;
seekFlagEnd = v.seeking;
return false;
}
function playbackEnded() {
if (completed)
return false;
completed = true;
ok(startPassed, "seeking event");
ok(endPassed, "seeked event");
ok(seekFlagStart, "seeking flag on start should be true");
ok(!seekFlagEnd, "seeking flag on end should be false");
SimpleTest.finish();
return false;
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<audio id='v'
onended='return playbackEnded();'
onloadedmetadata='return startTest();'
onseeking='return seekStarted();'
onseeked='return seekEnded();'>
<source type='audio/x-wav' src='r11025_s16_c1.wav'>
</audio>
</body>
</html>

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

@ -0,0 +1,47 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Media test: standalone video documents</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="doTest()">
<iframe id="i" src="r11025_u8_c1.wav"></iframe>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var gExpectEnded = 2;
function endTest()
{
var elem = document.getElementById("i").contentDocument.body.firstChild;
gExpectEnded--;
if (gExpectEnded == 1) {
elem.play();
} else {
is(gExpectEnded, 0, "not expecting more ended events");
SimpleTest.finish();
}
}
function doTest()
{
var elem = document.getElementById("i").contentDocument.body.firstChild;
is(elem.tagName.toLowerCase(), "video", "Is video element");
is(elem.currentSrc.substring(elem.currentSrc.length - 16), "r11025_u8_c1.wav", "currentSrc");
is(elem.controls, true, "Controls set");
is(elem.autoplay, true, "Autoplay set");
if (elem.ended) {
gExpectEnded = 1;
elem.play();
}
elem.addEventListener("ended", endTest, false);
}
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,64 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Wave Media test: timeupdate during playback</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
// Test if timeupdate is dispatched and the current time during the
// update is increasing.
var lastTime = 0.0;
var completed = false;
function startTest() {
if (completed)
return false;
var v = document.getElementById('v');
v.play();
return false;
}
function timeUpdated() {
if (completed)
return false;
var v = document.getElementById('v');
// Check that duration metadata is correct during the first timeupdate.
if (lastTime == 0) {
ok(v.duration > 0.9 && v.duration < 1.1, "Duration should be around 1.0: " + v.duration);
}
ok(v.currentTime > lastTime,
"Check currentTime of " +
v.currentTime +
" is greater than last time of " +
lastTime);
lastTime = v.currentTime;
return false;
}
function playbackEnded() {
if (completed)
return false
completed = true;
SimpleTest.finish();
return false;
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<audio id='v'
src='r11025_u8_c1.wav'
onloadedmetadata='return startTest();'
onended='return playbackEnded();'
ontimeupdate='return timeUpdated();'></audio>
</body>
</html>

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

@ -0,0 +1,56 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Wave Media test: timeupdate after seeking</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var completed = false;
var seeking = false;
function startTest() {
if (completed)
return false;
var v = document.getElementById('v');
v.currentTime = 0.5;
return false;
}
function startSeek() {
if (completed)
return false;
seeking = true;
return false;
}
function timeUpdated() {
if (completed || !seeking)
return false;
var v = document.getElementById('v');
// Check that currentTime is within range in first timeupdate after seeking.
ok(v.currentTime > 0.4 && v.currentTime < 0.6, "currentTime should be around 0.5: " + v.currentTime);
completed = true;
SimpleTest.finish();
return false;
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
<audio id='v'
src='r11025_u8_c1.wav'
onloadedmetadata='return startTest();'
onseeking='return startSeek();'
ontimeupdate='return timeUpdated();'></audio>
</body>
</html>