Package leakcanary

Types

Link copied to clipboard
class AndroidDetectLeaksAssert(detectLeaksInterceptor: DetectLeaksInterceptor = AndroidDetectLeaksInterceptor(), heapAnalysisReporter: HeapAnalysisReporter = NoLeakAssertionFailedError.throwOnApplicationLeaks()) : DetectLeaksAssert

Default DetectLeaksAssert implementation. Uses public helpers so you should be able to create our own implementation if needed.

Link copied to clipboard
class AndroidDetectLeaksInterceptor(    instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation(),     objectWatcher: ObjectWatcher = AppWatcher.objectWatcher,     retainedDelayMillis: Long = AppWatcher.retainedDelayMillis) : DetectLeaksInterceptor
Link copied to clipboard
class DetectLeaksAfterTestSuccess(tag: String = DetectLeaksAfterTestSuccess::class.java.simpleName) : TestRule

TestRule that invokes LeakAssertions.assertNoLeaks after the test successfully evaluates. Pay attention to where you set up this rule in the rule chain as you might detect different leaks (e.g. around vs wrapped by the activity rule). It's also possible to use this rule several times in a rule chain.

Link copied to clipboard
fun interface DetectLeaksAssert

The interface for the implementation that LeakAssertions.assertNoLeaks delegates to. You can call DetectLeaksAssert.update to provide your own implementation.

Link copied to clipboard
fun interface DetectLeaksInterceptor

Decides whether to dump & analyze the heap to look for leaks in instrumentation tests. The implementation might block for a while to allow temporary leaks to be flushed out, as those aren't that interesting to report and heap analysis increases test duration significantly.

Link copied to clipboard
sealed class HeapAnalysisDecision
Link copied to clipboard
fun interface HeapAnalysisReporter

Reports the results of a heap analysis created by AndroidDetectLeaksAssert.

Link copied to clipboard
object LeakAssertions
Link copied to clipboard
class NoLeakAssertionFailedError(val heapAnalysis: HeapAnalysisSuccess) : AssertionError

Thrown when using the NoLeakAssertionFailedError.throwOnApplicationLeaks HeapAnalysisReporter

Link copied to clipboard
annotation class SkipLeakDetection(val message: String, val assertionTags: String)

Annotation for skipping leak detection in a UI test that calls LeakAssertions.assertNoLeaks. This annotation is useful to skip a leak detection in a test until the leaks are fixed.

Link copied to clipboard
object TestDescriptionHolder : TestRule

A TestRule that holds onto the test Description in a thread local while evaluating, making it possible to retrieve that test Description from the test thread via testDescription.