mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
37e5bce776
This test no longer passes, the failure masked by bug 975640. Since this feature is deprecated and disabled anyway, just make the test do nothing if the controlling pref is false. That way we can re-enable tests, but if the feature is restored the bitrot in the implementation will be flagged. Also change the channel count back to 6, since we're reporting the native value again.
113 lines
3.1 KiB
HTML
113 lines
3.1 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=490705
|
|
-->
|
|
|
|
<head>
|
|
<title>Media test: framebuffer size checks</title>
|
|
<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=490705">Mozilla Bug 490705</a>
|
|
|
|
<pre id="test">
|
|
<script class="testbody" type="text/javascript">
|
|
var testFile = "bug495794.ogg";
|
|
var testFileDuration = 0.30;
|
|
var testFileChannelCount = 6;
|
|
var testFileSampleRate = 48000;
|
|
var testFileFrameBufferLength = testFileChannelCount * 1024;
|
|
|
|
var undef;
|
|
|
|
var currentSampleOffset = 0;
|
|
var isTimePropertyValid = true;
|
|
|
|
function audioAvailable(event) {
|
|
var buffer = event.frameBuffer;
|
|
|
|
if ( (typeof event.time !== "number") ||
|
|
(Math.abs(event.time - currentSampleOffset / testFileSampleRate / testFileChannelCount) > testFileDuration) ) {
|
|
isTimePropertyValid = false;
|
|
}
|
|
|
|
currentSampleOffset += buffer.length;
|
|
}
|
|
|
|
var loadedMetadataCalled = false;
|
|
function loadedMetadata() {
|
|
loadedMetadataCalled = true;
|
|
var a1 = document.getElementById('a1');
|
|
is(a1.mozChannels, testFileChannelCount, "mozChannels should be " + testFileChannelCount + ".");
|
|
is(a1.mozSampleRate, testFileSampleRate, "mozSampleRate should be " + testFileSampleRate + ".");
|
|
is(a1.mozFrameBufferLength, testFileFrameBufferLength, "default mozFrameBufferLength should be " + testFileFrameBufferLength + ".");
|
|
|
|
var minFailed = false;
|
|
try {
|
|
a1.mozFrameBufferLength = 4;
|
|
} catch(e) {
|
|
minFailed = true;
|
|
}
|
|
ok(minFailed, "mozFrameBufferLength min fail check");
|
|
|
|
var maxFailed = false;
|
|
try {
|
|
a1.mozFrameBufferLength = 44444;
|
|
} catch(e) {
|
|
maxFailed = true;
|
|
}
|
|
ok(maxFailed, "mozFrameBufferLength max fail check");
|
|
|
|
a1.mozFrameBufferLength = testFileFrameBufferLength;
|
|
}
|
|
|
|
function checkResults() {
|
|
ok(loadedMetadataCalled, "loadedmetadata event not dispatched.");
|
|
ok(isTimePropertyValid, "The audioAvailable event's time attribute was invalid.");
|
|
|
|
var expectedOffset = Math.ceil(testFileDuration * testFileSampleRate * testFileChannelCount);
|
|
if (expectedOffset % testFileFrameBufferLength !== 0) {
|
|
expectedOffset += (testFileFrameBufferLength - (expectedOffset % testFileFrameBufferLength));
|
|
}
|
|
is(currentSampleOffset, expectedOffset, "Check amount of signal data processed");
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
function audioEnded() {
|
|
checkResults();
|
|
}
|
|
|
|
function initTest() {
|
|
var a1 = document.createElement("audio");
|
|
a1.id = "a1";
|
|
a1.preload = "metadata";
|
|
a1.controls = true;
|
|
document.body.appendChild(a1);
|
|
|
|
a1.addEventListener("ended", audioEnded, false);
|
|
a1.addEventListener("loadedmetadata", loadedMetadata, false);
|
|
a1.addEventListener("MozAudioAvailable", audioAvailable, false);
|
|
a1.src = testFile;
|
|
a1.muted = true;
|
|
a1.play();
|
|
}
|
|
|
|
window.addEventListener("load", function(e) {
|
|
if (SpecialPowers.getBoolPref("media.audio_data.enabled")) {
|
|
initTest();
|
|
} else {
|
|
ok(true, "old audio data api behind a pref");
|
|
SimpleTest.finish();
|
|
}
|
|
}, false);
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|