From 1a9cff8f68deffd618c5cba1f22f0fb0e396e067 Mon Sep 17 00:00:00 2001 From: Jesse Wilson Date: Thu, 17 Nov 2011 15:15:47 -0500 Subject: Always trigger finalization the same way in our tests. This came up when I was recently writing a ZipFile finalization test and I needed to copy-paste the finalizer recipe. Change-Id: Ia67061b3dba1a7011c93c9a81e2a963876b238a1 --- support/src/test/java/libcore/dalvik/system/CloseGuardTester.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'support') diff --git a/support/src/test/java/libcore/dalvik/system/CloseGuardTester.java b/support/src/test/java/libcore/dalvik/system/CloseGuardTester.java index 4ed59a2..e82d33d 100644 --- a/support/src/test/java/libcore/dalvik/system/CloseGuardTester.java +++ b/support/src/test/java/libcore/dalvik/system/CloseGuardTester.java @@ -26,6 +26,7 @@ import java.util.logging.Handler; import java.util.logging.LogRecord; import java.util.logging.Logger; import junit.framework.Assert; +import libcore.java.lang.ref.FinalizationTester; public final class CloseGuardTester implements Closeable { @@ -45,14 +46,12 @@ public final class CloseGuardTester implements Closeable { * Collect immediately before we start monitoring the CloseGuard logs. * This lowers the chance that we'll report an unrelated leak. */ - System.gc(); - System.runFinalization(); + FinalizationTester.induceFinalization(); logger.addHandler(logWatcher); } public void assertEverythingWasClosed() { - System.gc(); - System.runFinalization(); + FinalizationTester.induceFinalization(); if (!logRecords.isEmpty()) { // print the log records with the output of this test -- cgit v1.1