Backout Bug 449159 - Tests for Ogg seeking - s+sr=roc

This commit is contained in:
Chris Double 2008-09-25 19:31:51 +12:00
Родитель 4887197347 01d7021568
Коммит e64d5b39de
9 изменённых файлов: 1 добавлений и 387 удалений

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

@ -53,16 +53,8 @@ _TEST_FILES = test_autoplay.html \
test_playbackRate.html \
test_readyState.html \
test_start.html \
test_seek1.html \
test_seek2.html \
test_seek3.html \
test_seek4.html \
test_seek5.html \
test_seek6.html \
test_seek7.html \
test_bug448534.html \
# test_bug448534.html \
320x240.ogg \
seek.ogg \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -1,77 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>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>
<video id='v'
src='seek.ogg'
onended='return playbackEnded();'
onloadedmetadata='return startTest();'
onseeking='return seekStarted();'
onseeked='return seekEnded();'></video>
<pre id="test">
<script class="testbody" type="text/javascript">
var startPassed = false;
var endPassed = false;
var seekFlagStart = false;
var seekFlagEnd = false;
var timeStart;
var readonly = true;
ok(!document.getElementById('v').seeking, "seeking should default to false");
try {
v1.seeking = 1;
readonly = false;
}
catch(e) {
readonly = true;
}
ok(readonly, "seeking should be readonly");
function startTest() {
var v = document.getElementById('v');
v.play();
v.currentTime=2;
}
function seekStarted() {
var v = document.getElementById('v');
startPassed = true;
seekFlagStart = v.seeking;
return false;
}
function seekEnded() {
var v = document.getElementById('v');
var t = v.currentTime;
ok(t >= 2 && t <= 3, "Video currentTime is incorrect: " + t);
endPassed = true;
seekFlagEnd = v.seeking;
timeStart = new Date();
return false;
}
function playbackEnded() {
var t = (new Date()) - timeStart;
ok(startPassed, "Video did not send seeking event");
ok(endPassed, "Video did not send seeked event");
ok(t > 0 && t <= 2500, "Video did not seek to correct time: " + t);
ok(seekFlagStart, "Seek flag not set on seek start");
ok(!seekFlagEnd, "Seek flag set on seek end");
SimpleTest.finish();
return false;
}
setTimeout(function () {
ok(false, "Test timed out");
SimpleTest.finish();
}, 30000);
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

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

@ -1,33 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Media test: seek test 2</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>
<video id='v'></video>
<pre id="test">
<script class="testbody" type="text/javascript">
// http://www.whatwg.org/specs/web-apps/current-work/#seek
// If the media element's networkState is less than LOADED_METADATA,
// then the user agent must raise an INVALID_STATE_ERR exception
var v = document.getElementById('v');
var passed = false;
ok(v.networkState < HTMLMediaElement.LOADED_METADATA,
"Invalid network state in media element");
try {
v.seek(1);
}
catch(e) {
passed = true;
}
ok(passed, "Video did not raise error during invalid seek");
</script>
</pre>
</body>
</html>

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

@ -1,59 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Media test: seek test 3</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>
<video id='v'
src='seek.ogg'
onloadedmetadata='return startTest();'
onended='return playbackEnded();'
onseeking='return seekStarted();'
onseeked='return seekEnded();'></video>
<pre id="test">
<script class="testbody" type="text/javascript">
// Test seeking works if current time is set before video is
// playing.
var startPassed = false;
var endPassed = false;
var timeStart;
function startTest() {
var v = document.getElementById('v');
v.currentTime=2;
v.play();
}
function seekStarted() {
startPassed = true;
return false;
}
function seekEnded() {
var t = document.getElementById('v').currentTime;
ok(t >= 2 && t <= 3, "Video currentTime is incorrect: " + t);
endPassed = true;
timeStart = new Date();
return false;
}
function playbackEnded() {
var t = (new Date()) - timeStart;
ok(startPassed, "Video did not send seeking event");
ok(endPassed, "Video did not send seeked event");
ok(t > 0 && t <= 2500, "Video did not seek to correct time");
SimpleTest.finish();
return false;
}
setTimeout(function () {
ok(false, "Test timed out");
SimpleTest.finish();
}, 30000);
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

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

@ -1,45 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Media test: seek test 4</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>
<video id='v'
src='seek.ogg'
onloadedmetadata='return startTest();'
onseeking='return seekStarted();'
onseeked='return seekEnded();'></video>
<pre id="test">
<script class="testbody" type="text/javascript">
// Test seeking works if current time is set but video is not played.
var startPassed = false;
function startTest() {
var v = document.getElementById('v');
v.currentTime=2;
}
function seekStarted() {
startPassed = true;
return false;
}
function seekEnded() {
var t = document.getElementById('v').currentTime;
ok(t >= 2 && t<= 3, "Video currentTime is incorrect: " + t);
SimpleTest.finish();
return false;
}
setTimeout(function () {
ok(false, "Test timed out");
SimpleTest.finish();
}, 30000);
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

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

@ -1,63 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Media test: seek test 5</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>
<video id='v'
src='seek.ogg'
onloadedmetadata='return startTest();'
onseeking='return seekStarted();'
onseeked='return seekEnded();'></video>
<pre id="test">
<script class="testbody" type="text/javascript">
// Test for a seek, followed by another seek before the first is complete.
var startPassed = false;
var seek1Passed = false;
var seek2Passed = false;
var seekCount = 0;
function startTest() {
var v = document.getElementById('v');
v.currentTime=2;
}
function seekStarted() {
startPassed = true;
var v = document.getElementById('v');
v.currentTime=1;
return false;
}
function seekEnded() {
var v = document.getElementById('v');
seekCount++;
if(seekCount == 1) {
if (v.currentTime >= 2 && v.currentTime <= 2.2)
seek1Passed = true;
}
if(seekCount == 2) {
if (v.currentTime >= 1 && v.currentTime <= 1.2)
seek2Passed = true;
ok(seek1Passed, "First seek");
ok(seek2Passed, "Second seek");
SimpleTest.finish();
}
return false;
}
setTimeout(function () {
ok(false, "Test timed out");
SimpleTest.finish();
}, 30000);
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

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

@ -1,54 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Media test: seek test 6</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>
<video id='v'
src='seek.ogg'
onloadedmetadata='return startTest();'
onended='return playbackEnded();'
onseeking='return seekStarted();'
onseeked='return seekEnded();'></video>
<pre id="test">
<script class="testbody" type="text/javascript">
// Test for a seek, followed by a play before the seek completes, ensure we play at the end of the seek.
var startPassed = false;
var seekCount = 0;
function startTest() {
var v = document.getElementById('v');
v.currentTime=2;
}
function seekStarted() {
startPassed = true;
var v = document.getElementById('v');
v.play();
return false;
}
function seekEnded() {
var v = document.getElementById('v');
ok(v.currentTime>=2 && v.currentTime<=2.2, "First seek");
return false;
}
function playbackEnded() {
ok(true, "Playback ended");
SimpleTest.finish();
return false;
}
setTimeout(function () {
ok(false, "Test timed out");
SimpleTest.finish();
}, 30000);
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

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

@ -1,47 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Media test: seek test 7</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>
<video id='v'
src='seek.ogg'
onloadedmetadata='return startTest();'
onseeked='return seekEnded();'></video>
<pre id="test">
<script class="testbody" type="text/javascript">
// Test for bug identified by Chris Pearce in comment 40 on
// bug 449159.
var v = document.getElementById('v');
var seekCount = 0;
var interval;
var timeout;
function startTest() {
interval = setInterval(function() { v.currentTime=Math.random*3; }, 10);
}
function seekEnded() {
seekCount++;
ok(true, "Seek " + seekCount);
if (seekCount == 3) {
clearInterval(interval);
clearTimeout(timeout);
SimpleTest.finish();
}
return false;
}
timeout = setTimeout(function () {
ok(false, "Test timed out");
SimpleTest.finish();
}, 30000);
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

Двоичные данные
mozilla/content/media/video/test/seek.ogg

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