summaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
authorJesse Wilson <jessewilson@google.com>2011-11-17 15:15:47 -0500
committerJesse Wilson <jessewilson@google.com>2011-11-17 15:15:47 -0500
commit1a9cff8f68deffd618c5cba1f22f0fb0e396e067 (patch)
tree855df013c6df60346d481e3d84430a98ad994379 /support
parent03aaa13a6c9eb7912d903ebbd792f6c303b43757 (diff)
downloadlibcore-1a9cff8f68deffd618c5cba1f22f0fb0e396e067.zip
libcore-1a9cff8f68deffd618c5cba1f22f0fb0e396e067.tar.gz
libcore-1a9cff8f68deffd618c5cba1f22f0fb0e396e067.tar.bz2
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
Diffstat (limited to 'support')
-rw-r--r--support/src/test/java/libcore/dalvik/system/CloseGuardTester.java7
1 files changed, 3 insertions, 4 deletions
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