Bug 1229987: P3. Update mochitests and add new one verifying behavior. r=cpearce

This commit is contained in:
Jean-Yves Avenard 2015-12-08 15:05:50 -05:00
parent f105307b93
commit 488f87a63c
7 changed files with 82 additions and 27 deletions

View File

@ -40,7 +40,9 @@ skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac"))
[test_BufferingWait.html]
skip-if = toolkit == 'android' #timeout android bug 1199531
[test_BufferingWait_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac") || (os == "win" && os_version == "6.1")) # Only supported on osx and vista+, disabling on win7 bug 1191138
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_DrainOnMissingData_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_EndOfStream.html]
skip-if = (true || toolkit == 'android' || buildapp == 'mulet') #timeout android/mulet only bug 1101187 and bug 1182946
[test_EndOfStream_mp4.html]
@ -51,7 +53,7 @@ skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac"))
[test_FrameSelection.html]
[test_HaveMetadataUnbufferedSeek.html]
[test_HaveMetadataUnbufferedSeek_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac") || (os == "win" && os_version == "6.1")) # Only supported on osx and vista+, disabling on win7 bug 1191138
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_LoadedDataFired_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_LoadedMetadataFired.html]
@ -98,11 +100,11 @@ skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac"))
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_TruncatedDuration.html]
[test_TruncatedDuration_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac") || (os == "win" && os_version == "6.1")) # Only supported on osx and vista+, disabling on win7 bug 1191138
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_WaitingOnMissingData.html]
skip-if = true # Disabled due to bug 1124493 and friends. WebM MSE is deprioritized.
[test_WaitingOnMissingData_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac") || (os == "win" && os_version == "6.1")) # Only supported on osx and vista+, disabling on win7 bug 1191138
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_WaitingToEndedTransition_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac") || (os == "win" && os_version == "6.1")) # Only supported on osx and vista+, disabling on win7 bug 1191138
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+

View File

@ -41,14 +41,15 @@ runWithMSE(function(ms, v) {
/* Note - Missing |46712, 67833 - 46712| segment here corresponding to (0.8, 1.2] */
/* Note - Missing |67833, 88966 - 67833| segment here corresponding to (1.2, 1.6] */
loadSegment.bind(null, sb, new Uint8Array(arrayBuffer, 88966))).then(function() {
var promise = waitUntilTime(0.27);
// 0.767 is the time of the last video sample +- 40ms.
var promise = waitUntilTime(.767-0.04);
info("Playing video. It should play for a bit, then fire 'waiting'");
v.play();
return promise;
}).then(function() {
window.firstStop = Date.now();
loadSegment(sb, new Uint8Array(arrayBuffer, 46712, 67833 - 46712));
return waitUntilTime(0.66);
return waitUntilTime(1.167-0.04);
}).then(function() {
var waitDuration = (Date.now() - window.firstStop) / 1000;
ok(waitDuration < 15, "Should not spend an inordinate amount of time buffering: " + waitDuration);

View File

@ -41,18 +41,16 @@ runWithMSE(function(ms, v) {
/* Note - Missing |bipbop4| segment here corresponding to (2.41, 3.20] */
.then(fetchAndLoad.bind(null, sb, 'bipbop/bipbop', ['5'], '.m4s'))
.then(function() {
// Some decoders (Windows in particular) may keep up to 25 frames queued
// before returning a sample. 0.7 is 1.62s - 25 * 0.03333
var promise = waitUntilTime(0.7);
// last audio sample has a start time of 1.578956s
var promise = waitUntilTime(1.57895);
info("Playing video. It should play for a bit, then fire 'waiting'");
v.play();
return promise;
}).then(function() {
window.firstStop = Date.now();
fetchAndLoad(sb, 'bipbop/bipbop', ['3'], '.m4s');
// Some decoders (Windows in particular) may keep up to 25 frames queued
// before returning a sample. 1.5 is 2.41s - 25 * 0.03333
return waitUntilTime(1.5);
// last audio sample has a start time of 2.368435
return waitUntilTime(2.36843);
}).then(function() {
var waitDuration = (Date.now() - window.firstStop) / 1000;
ok(waitDuration < 15, "Should not spend an inordinate amount of time buffering: " + waitDuration);

View File

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>MSE: |waiting| event when source data is missing</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, el) {
el.controls = true;
once(ms, 'sourceopen').then(function() {
ok(true, "Receive a sourceopen event");
var videosb = ms.addSourceBuffer("video/mp4");
fetchAndLoad(videosb, 'bipbop/bipbop_video', ['init'], '.mp4')
.then(function() {
// Set appendWindowEnd to ensure we only have about 6 frames worth.
// We must feed at least 6 frames to pass the MDSM pre-roll.
videosb.appendWindowEnd = .4;
return fetchAndLoad(videosb, 'bipbop/bipbop_video', ['1'], '.m4s');
})
.then(function() {
info("Invoking play()");
var promises = [];
promises.push(once(el, 'playing'));
el.play();
return Promise.all(promises);
})
.then(function() {
info("got playing");
return once(el, 'waiting');
}).then(function() {
info("got waiting");
info("Loading more data");
// Waiting will be fired on the last frame +- 40ms.
isfuzzy(el.currentTime, videosb.buffered.end(0) - 1/30,
0.04, "Got a waiting event at " + el.currentTime);
videosb.appendWindowEnd = 1;
var p = once(el, 'ended');
var loads = fetchAndLoad(videosb, 'bipbop/bipbop_video', [1], '.m4s');
loads.then(() => ms.endOfStream());
return p;
}).then(function() {
// These fuzz factors are bigger than they should be. We should investigate
// and fix them in bug 1137574.
is(el.duration, 0.801666, "Video has correct duration: " + el.duration);
is(el.currentTime, el.duration, "Video has correct currentTime.");
SimpleTest.finish();
});
});
});
</script>
</pre>
</body>
</html>

View File

@ -37,9 +37,6 @@ runWithMSE(function(ms, el) {
var promises = [];
promises.push(once(el, 'loadeddata'));
promises.push(once(el, 'canplay'));
// Load [0, 1.601666). We must ensure that we load over 25 frames as the
// windows H264 decoder will not produce a sample until then
// (bug 1191138).
promises.push(fetchAndLoad(videosb, 'bipbop/bipbop_video', range(1, 3), '.m4s'));
return Promise.all(promises);
})

View File

@ -40,9 +40,9 @@ runWithMSE(function(ms, el) {
// currentTime is based on the current video frame, so if the audio ends just before
// the next video frame, currentTime can be up to 1 frame's worth earlier than
// min(audioEnd, videoEnd).
// Some decoders (Windows in particular) may keep up to 25 frames queued.
isfuzzy(el.currentTime, Math.min(audiosb.buffered.end(0), videosb.buffered.end(0)) - 1/60,
25 * 1/30, "Got a waiting event at " + el.currentTime);
// 0.0465 is the length of the last audio frame.
ok(el.currentTime >= (Math.min(audiosb.buffered.end(0), videosb.buffered.end(0)) - 0.0465),
"Got a waiting event at " + el.currentTime);
info("Loading more data");
var p = once(el, 'ended');
var loads = Promise.all([fetchAndLoad(audiosb, 'bipbop/bipbop_audio', [5], '.m4s'),

View File

@ -17,6 +17,10 @@ runWithMSE(function(ms, el) {
ok(true, "Receive a sourceopen event");
var audiosb = ms.addSourceBuffer("audio/mp4");
var videosb = ms.addSourceBuffer("video/mp4");
// ensure tracks end at approximately the same time to ensure ended event is
// always fired (bug 1233639).
audiosb.appendWindowEnd = 3.9;
videosb.appendWindowEnd = 3.9;
fetchAndLoad(audiosb, 'bipbop/bipbop_audio', ['init'], '.mp4')
.then(fetchAndLoad.bind(null, videosb, 'bipbop/bipbop_video', ['init'], '.mp4'))
.then(fetchAndLoad.bind(null, audiosb, 'bipbop/bipbop_audio', range(1, 5), '.m4s'))
@ -34,19 +38,12 @@ runWithMSE(function(ms, el) {
var p = once(el, 'waiting');
el.play();
return p;
}).then(function() {
// currentTime is based on the current video frame, so if the audio ends just before
// the next video frame, currentTime can be up to 1 frame's worth earlier than
// min(audioEnd, videoEnd).
// Some decoders (Windows in particular) may keep up to 25 frames queued.
isfuzzy(el.currentTime, Math.min(audiosb.buffered.end(0), videosb.buffered.end(0)) - 1/60,
25 * 1/30, "Got a waiting event at " + el.currentTime);
}).then(function() {
var p = once(el, 'ended');
ms.endOfStream();
return p;
}).then(function() {
is(el.duration, 4.005, "Video has correct duration: " + el.duration);
is(el.duration, 3.854512, "Video has correct duration: " + el.duration);
is(el.currentTime, el.duration, "Video has correct currentTime.");
SimpleTest.finish();
});