Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] disable leak canary during instrumentation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasPaczos committed Apr 3, 2019
1 parent dabbe4f commit a75a782
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion platform/android/MapboxGLAndroidSDKTestApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
targetSdkVersion androidVersions.targetSdkVersion
versionCode 13
versionName "6.0.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "com.mapbox.mapboxsdk.InstrumentationRunner"
}

compileOptions {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.mapbox.mapboxsdk

import com.mapbox.mapboxsdk.testapp.MapboxApplication

class InstrumentationApplication : MapboxApplication() {
override fun initializeLeakCanary(): Boolean {
// do not initialize leak canary during instrumentation tests
return true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.mapbox.mapboxsdk

import android.app.Application
import android.content.Context
import android.support.test.runner.AndroidJUnitRunner

class InstrumentationRunner : AndroidJUnitRunner() {
override fun newApplication(cl: ClassLoader?, className: String?, context: Context?): Application {
return super.newApplication(cl, InstrumentationApplication::class.java.name, context)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void onCreate() {
initializeMapbox();
}

private boolean initializeLeakCanary() {
protected boolean initializeLeakCanary() {
if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
Expand Down

0 comments on commit a75a782

Please sign in to comment.