Commit 7f2dee6e authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

LayoutTests: Adjust webaudio test for unified heap garbage collection

Use asyncGC instead of window.gc().

Bug: 843903
Change-Id: Id65e65d4b3cd68a1510b3d7aff759232fc6c972b
Reviewed-on: https://chromium-review.googlesource.com/c/1324616
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606358}
parent cd1f909b
......@@ -4,6 +4,7 @@
<title>
cycle-connection-gc.html
</title>
<script src="../../resources/gc.js"></script>
<script src="../../resources/js-test.js"></script>
</head>
<body>
......@@ -11,21 +12,26 @@
description('Cycles of AudioNode connections should be collected.');
window.jsTestIsAsync = true;
gc();
let context = new OfflineAudioContext(2, 1024, 44100);
let initialCount = internals.audioHandlerCount();
createCycle();
debug('A cycle was created:');
shouldBeTrue('internals.audioHandlerCount() > initialCount');
let context;
let initialCount;
// Need to render to cleanup the cycle on an offline context
context.startRendering()
.then(() => {
gc();
debug('GC happened:');
shouldBe('internals.audioHandlerCount()', 'initialCount');
finishJSTest();
});
(async () => {
await asyncGC();
context = new OfflineAudioContext(2, 1024, 44100);
initialCount = internals.audioHandlerCount();
createCycle();
debug('A cycle was created:');
shouldBeTrue('internals.audioHandlerCount() > initialCount');
// Need to render to cleanup the cycle on an offline context
await context.startRendering();
await asyncGC();
debug('GC happened:');
shouldBe('internals.audioHandlerCount()', 'initialCount');
finishJSTest();
})();
function createCycle() {
let source = context.createBufferSource();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment