Install and test LSPosed through test app

This commit is contained in:
topjohnwu
2024-12-24 17:11:08 -08:00
committed by John Wu
parent 32faa4ced6
commit 2baedf74d1
8 changed files with 136 additions and 49 deletions

View File

@@ -26,4 +26,5 @@ dependencies {
implementation(libs.test.runner)
implementation(libs.test.rules)
implementation(libs.test.junit)
implementation(libs.test.uiautomator)
}

View File

@@ -6,6 +6,17 @@ import androidx.test.runner.AndroidJUnitRunner
class TestRunner : AndroidJUnitRunner() {
override fun onCreate(arguments: Bundle) {
// Support short-hand ".ClassName"
arguments.getString("class")?.let {
val classArg = it.split(",").joinToString(separator = ",") { clz ->
if (clz.startsWith(".")) {
"com.topjohnwu.magisk.test$clz"
} else {
clz
}
}
arguments.putString("class", classArg)
}
// Force using the target context's classloader to run tests
arguments.putString("classLoader", TestClassLoader::class.java.name)
super.onCreate(arguments)