mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-12 14:23:18 +00:00
Add new tests for app hiding
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
</application>
|
||||
|
||||
<instrumentation
|
||||
android:name="androidx.test.runner.AndroidJUnitRunner"
|
||||
android:name="com.topjohnwu.magisk.test.TestRunner"
|
||||
android:targetPackage="com.topjohnwu.magisk"
|
||||
android:label="Tests for Magisk" />
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.topjohnwu.magisk.test
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.topjohnwu.magisk.core.TestImpl
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class Environment {
|
||||
|
||||
companion object {
|
||||
@BeforeClass
|
||||
@JvmStatic
|
||||
fun before() {
|
||||
TestImpl.before()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setupMagisk() {
|
||||
TestImpl.setupMagisk()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setupShellGrantTest() {
|
||||
TestImpl.setupShellGrantTest()
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.topjohnwu.magisk.test
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.topjohnwu.magisk.core.TestImpl
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class MagiskAppTest {
|
||||
|
||||
companion object {
|
||||
@BeforeClass
|
||||
@JvmStatic
|
||||
fun before() {
|
||||
TestImpl.before()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testZygisk() {
|
||||
TestImpl.testZygisk()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.topjohnwu.magisk.test
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.runner.AndroidJUnitRunner
|
||||
|
||||
class TestRunner : AndroidJUnitRunner() {
|
||||
override fun onCreate(arguments: Bundle) {
|
||||
// Force using the target context's classloader to run tests
|
||||
arguments.putString("classLoader", TestClassLoader::class.java.name)
|
||||
super.onCreate(arguments)
|
||||
}
|
||||
}
|
||||
|
||||
private val targetClassLoader inline get() =
|
||||
InstrumentationRegistry.getInstrumentation().targetContext.classLoader
|
||||
|
||||
class TestClassLoader : ClassLoader(targetClassLoader)
|
||||
Reference in New Issue
Block a user