Bug 1585671 - Add a WPT to test that cycles without DelayNodes are muted. r=karlt

Differential Revision: https://phabricator.services.mozilla.com/D47929

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Paul Adenot 2019-10-03 10:03:58 +00:00
parent 5b28c5606d
commit b1a153a7be

View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html class="a">
<head>
<title>Cycles without DelayNode in audio node graph</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
const t = async_test(
"Test that cycles that don't contain a DelayNode are muted"
);
t.step(function() {
var off = new OfflineAudioContext(1, 512, 48000);
var osc = new OscillatorNode(off);
var fb = new GainNode(off);
// zero delay feedback loop
osc.connect(fb).connect(fb).connect(off.destination);
osc.start(0);
off.startRendering().then((b) => {
var samples = b.getChannelData(0);
var silent = true;
for (var i = 0; i < samples.length; i++) {
if (samples[i] != 0.0) {
silent = false;
break;
}
}
assert_true(silent);
t.done();
});
});
</script>
</body>
</html>