提交 d3b78c59 编写于 作者: J John Rodriguez

Test that issue #482 is resolved

上级 33973bf7
......@@ -2,18 +2,19 @@ package com.squareup.leakcanary;
import com.squareup.haha.perflib.RootObj;
import com.squareup.haha.perflib.Snapshot;
import org.junit.Before;
import org.junit.Test;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import static com.squareup.haha.perflib.RootType.NATIVE_STATIC;
import static com.squareup.haha.perflib.RootType.SYSTEM_CLASS;
import static com.squareup.leakcanary.TestUtil.HeapDumpFile.BINDER_LEAK;
import static java.util.Arrays.asList;
import static junit.framework.Assert.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;
public class HeapAnalyzerTest {
......@@ -58,4 +59,16 @@ public class HeapAnalyzerTest {
}
return snapshot;
}
@Test public void binderLeak() {
ExcludedRefs.BuilderWithParams excludedRefs =
new ExcludedRefs.BuilderWithParams().clazz(WeakReference.class.getName())
.alwaysExclude()
.clazz("java.lang.ref.FinalizerReference")
.alwaysExclude();
AnalysisResult result = TestUtil.analyze(BINDER_LEAK, excludedRefs);
assertTrue(result.leakFound);
}
}
......@@ -24,7 +24,8 @@ final class TestUtil {
ASYNC_TASK("leak_asynctask.hprof", "dc983a12-d029-4003-8890-7dd644c664c5"),
ASYNC_TASK_MPREVIEW2("leak_asynctask_mpreview2.hprof", "1114018e-e154-435f-9a3d-da63ae9b47fa"),
ASYNC_TASK_M_POSTPREVIEW2("leak_asynctask_m_postpreview2.hprof",
"25ae1778-7c1d-4ec7-ac50-5cce55424069");
"25ae1778-7c1d-4ec7-ac50-5cce55424069"),
BINDER_LEAK("LC_issue_482.hprof", "8aeae2dd-98ec-4a91-a91c-c730a3332f76");
private final String filename;
private final String referenceKey;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册