-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathContextTest.kt
52 lines (46 loc) · 1.79 KB
/
ContextTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package suites
import TestBase
import TestUtil
import jmp0.app.AndroidEnvironment
import jmp0.app.IAndroidInvokeFile
import jmp0.app.interceptor.intf.IInterceptor
import org.junit.jupiter.api.Test
class ContextTest:TestBase(),IAndroidInvokeFile {
override fun test(){
val androidEnvironment = AndroidEnvironment(
TestUtil.testApkFile, object : IInterceptor {
override fun nativeCalled(
uuid: String,
className: String,
funcName: String,
signature: String,
param: Array<Any?>
): IInterceptor.ImplStatus {
return IInterceptor.ImplStatus(false,null)
}
override fun methodCalled(
uuid: String,
className: String,
instance: Any?,
funcName: String,
signature: String,
param: Array<Any?>
): Any? {
TODO("Not yet implemented")
}
override fun ioResolver(path: String): String? {
return null
}
})
val contextClazz = androidEnvironment.findClass("android.content.Context")
val ret = androidEnvironment.loadClass("jmp0.test.testapp.TestContext").run {
val ins = getDeclaredConstructor(contextClazz).newInstance(androidEnvironment.context)
getDeclaredMethod("testAll").invoke(ins)
}
// androidEnvironment.runInvokeFile(this)
androidEnvironment.destroy()
}
override fun run(androidEnvironment: AndroidEnvironment) {
// jmp0.test.testapp.TestContext(androidEnvironment.context as android.content.Context).testAll()
}
}