blob: c59381b26be957d31399987391ba0cafcf1be695 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>
cycle-connection-gc.html
</title>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<script id="layout-test-code">
description(
'Cycles of AudioNode connections should be collected, after rendering.');
window.jsTestIsAsync = true;
let context = new OfflineAudioContext(2, 1024, 44100);
let initialCount = internals.audioHandlerCount();
gc();
createCycle();
debug('A cycle was created:');
shouldBeTrue('internals.audioHandlerCount() > initialCount');
gc();
debug('GC happened:');
context.startRendering()
.then(() => {
shouldBe('internals.audioHandlerCount()', 'initialCount');
})
.then(finishJSTest);
function createCycle() {
let source = context.createBufferSource();
let delay1 = context.createDelay();
let delay2 = context.createDelay();
source.connect(delay1);
delay1.connect(delay2);
delay2.connect(delay1);
delay1.connect(context.destination);
}
</script>
</body>
</html>