зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1476649 - part3 : add test. r=jya
Differential Revision: https://phabricator.services.mozilla.com/D6324 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
70e0646d75
Коммит
666e27f65b
Двоичный файл не отображается.
|
@ -407,6 +407,7 @@ support-files =
|
|||
bug1301226-odd.wav^headers^
|
||||
bug1377278.webm
|
||||
bug1377278.webm^headers^
|
||||
bunny.webm
|
||||
can_play_type_dash.js
|
||||
can_play_type_ogg.js
|
||||
can_play_type_wave.js
|
||||
|
@ -1136,6 +1137,7 @@ skip-if = android_version == '15' || android_version == '17' # android(bug 12323
|
|||
[test_seekToNextFrame.html]
|
||||
skip-if = toolkit == 'android' # bug 1329391, android(bug 1232305)
|
||||
tags=seektonextframe
|
||||
[test_seek_duration.html]
|
||||
[test_source.html]
|
||||
skip-if = android_version == '17' # android(bug 1232305)
|
||||
[test_source_null.html]
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Media test: seek tests</title>
|
||||
<script type="text/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>
|
||||
<script type="text/javascript" src="seek_support.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/**
|
||||
* This test is used to make sure video's duration won't be changed when it
|
||||
* reachs to the end after seeking to position where the time is very close to
|
||||
* video's end time.
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
(async function startTest()
|
||||
{
|
||||
const video = document.createElement('video');
|
||||
video.src = "bunny.webm";
|
||||
document.body.appendChild(video);
|
||||
|
||||
const loadedMetadata = once(video, "loadedmetadata");
|
||||
const canplay = once(video, "canplay");
|
||||
const end = once(video, "ended");
|
||||
|
||||
info(`- wait for video loading metadata -`);
|
||||
await loadedMetadata;
|
||||
const originalDuration = video.duration;
|
||||
|
||||
info(`- seek video to the position which is close to end time -`);
|
||||
// video's duration is 2.1 and the last key frame is in 2.0, we want to seek
|
||||
// to that keyframe.
|
||||
video.currentTime = originalDuration - 0.1;
|
||||
|
||||
info(`- play video until it ends -`);
|
||||
await canplay;
|
||||
await video.play();
|
||||
await end;
|
||||
|
||||
ok(video.duration === originalDuration, `Duration shouldn't change`);
|
||||
removeNodeAndSource(video);
|
||||
|
||||
SimpleTest.finish();
|
||||
})();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче