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 @@ ...@@ -4,6 +4,7 @@
<title> <title>
cycle-connection-gc.html cycle-connection-gc.html
</title> </title>
<script src="../../resources/gc.js"></script>
<script src="../../resources/js-test.js"></script> <script src="../../resources/js-test.js"></script>
</head> </head>
<body> <body>
...@@ -11,21 +12,26 @@ ...@@ -11,21 +12,26 @@
description('Cycles of AudioNode connections should be collected.'); description('Cycles of AudioNode connections should be collected.');
window.jsTestIsAsync = true; window.jsTestIsAsync = true;
gc(); let context;
let context = new OfflineAudioContext(2, 1024, 44100); let initialCount;
let initialCount = internals.audioHandlerCount();
createCycle();
debug('A cycle was created:');
shouldBeTrue('internals.audioHandlerCount() > initialCount');
// Need to render to cleanup the cycle on an offline context (async () => {
context.startRendering() await asyncGC();
.then(() => {
gc(); context = new OfflineAudioContext(2, 1024, 44100);
debug('GC happened:'); initialCount = internals.audioHandlerCount();
shouldBe('internals.audioHandlerCount()', 'initialCount'); createCycle();
finishJSTest(); 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() { function createCycle() {
let source = context.createBufferSource(); 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