Last active
March 7, 2020 13:22
-
-
Save abdyer/053a04804d2d1cafcafd8ba7f54a8877 to your computer and use it in GitHub Desktop.
A custom AndroidBenchmarkRunner for benchmarks on CI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BenchmarkRunner : AndroidBenchmarkRunner() { | |
override fun newApplication( | |
cl: ClassLoader?, | |
className: String?, | |
context: Context? | |
): Application { | |
// Create an instance of our custom Application class for benchmark tests | |
return super.newApplication(cl, BenchmarkApp::class.java.name, context) | |
} | |
override fun onCreate(arguments: Bundle?) { | |
val newArguments = arguments ?: Bundle() | |
/* This is how we enable output on FirebaseTestLab, as the | |
environment variable name isn't valid there. */ | |
newArguments.putString("androidx.benchmark.output.enable", "true") | |
super.onCreate(newArguments) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment