mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1093020 - Tests. r=karlt
This commit is contained in:
parent
99250f7b44
commit
86a6d12070
@ -8,6 +8,7 @@ support-files =
|
||||
[test_MediaSource.html]
|
||||
[test_MediaSource_disabled.html]
|
||||
[test_BufferedSeek.html]
|
||||
[test_BufferingWait.html]
|
||||
[test_FrameSelection.html]
|
||||
[test_HaveMetadataUnbufferedSeek.html]
|
||||
[test_SeekableAfterEndOfStream.html]
|
||||
|
82
dom/media/mediasource/test/test_BufferingWait.html
Normal file
82
dom/media/mediasource/test/test_BufferingWait.html
Normal file
@ -0,0 +1,82 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
|
||||
<title>MSE: Don't get stuck buffering for too long when we have frames to show</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();
|
||||
|
||||
var receivedSourceOpen = false;
|
||||
runWithMSE(function(ms, v) {
|
||||
ms.addEventListener("sourceopen", function() {
|
||||
ok(true, "Receive a sourceopen event");
|
||||
ok(!receivedSourceOpen, "Should only receive one sourceopen for this test");
|
||||
receivedSourceOpen = true;
|
||||
var sb = ms.addSourceBuffer("video/webm");
|
||||
ok(sb, "Create a SourceBuffer");
|
||||
|
||||
function once(target, name, cb) {
|
||||
target.addEventListener(name, function() {
|
||||
target.removeEventListener(name, cb);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
function loadSegment(typedArray) {
|
||||
info(`Loading buffer: [${typedArray.byteOffset}, ${typedArray.byteOffset + typedArray.byteLength})`);
|
||||
return new Promise(function(resolve, reject) {
|
||||
once(sb, 'update', resolve);
|
||||
sb.appendBuffer(typedArray);
|
||||
});
|
||||
}
|
||||
|
||||
function waitUntilTime(targetTime) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
v.addEventListener("waiting", function onwaiting() {
|
||||
info("Got a waiting event at " + v.currentTime);
|
||||
if (v.currentTime >= targetTime) {
|
||||
ok(true, "Reached target time of: " + targetTime);
|
||||
v.removeEventListener("waiting", onwaiting);
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fetchWithXHR("seek.webm", function(arrayBuffer) {
|
||||
sb.addEventListener('error', (e) => { ok(false, "Got Error: " + e); SimpleTest.finish(); });
|
||||
loadSegment.bind(null, new Uint8Array(arrayBuffer, 0, 318))().then(
|
||||
loadSegment.bind(null, new Uint8Array(arrayBuffer, 318, 25223-318))).then(
|
||||
loadSegment.bind(null, new Uint8Array(arrayBuffer, 25223, 46712-25223))).then(
|
||||
/* 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, new Uint8Array(arrayBuffer, 88966))).then(function() {
|
||||
var promise = waitUntilTime(0.7);
|
||||
info("Playing video. It should play for a bit, then fire 'waiting'");
|
||||
v.play();
|
||||
return promise;
|
||||
}).then(function() {
|
||||
window.firstStop = Date.now();
|
||||
loadSegment(new Uint8Array(arrayBuffer, 46712, 67833 - 46712));
|
||||
return waitUntilTime(1.0);
|
||||
}).then(function() {
|
||||
var waitDuration = (Date.now() - window.firstStop) / 1000;
|
||||
ok(waitDuration < 15, "Should not spend an inordinate amount of time buffering: " + waitDuration);
|
||||
SimpleTest.finish();
|
||||
/* If we allow the rest of the stream to be played, we get stuck at
|
||||
around 2s. See bug 1093133.
|
||||
once(v, 'ended', SimpleTest.finish.bind(SimpleTest));
|
||||
return loadSegment(new Uint8Array(arrayBuffer, 67833, 88966 - 67833));
|
||||
*/
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user