Fix liblinphone_tester
This commit is contained in:
parent
a25d26ece3
commit
c1a199cb41
2 changed files with 15 additions and 26 deletions
|
@ -3,7 +3,9 @@ all: copy-files
|
|||
../gradlew uninstallDebug
|
||||
|
||||
run-all-tests: copy-files
|
||||
../gradlew :connectedAndroidTest -i
|
||||
../gradlew :installDebugAndroidTest && \
|
||||
../gradlew :grantDebugPermissions -i && \
|
||||
../gradlew :connectedAndroidTest -i \
|
||||
|
||||
copy-libs:
|
||||
mkdir -p assets && \
|
||||
|
|
|
@ -87,33 +87,20 @@ android {
|
|||
}
|
||||
|
||||
// Grant permissions
|
||||
task grantPermissionCamera(type: Exec, dependsOn: 'installDebugAndroidTest') {
|
||||
android.applicationVariants.all { variant ->
|
||||
def applicationId = "${getPackageName()}.test"
|
||||
def adb = android.getAdbExe().toString()
|
||||
outputs.dir '.'
|
||||
commandLine "${adb} shell pm grant ${applicationId} android.permission.CAMERA"
|
||||
def variantName = variant.name.capitalize()
|
||||
def grantPermissionTask = tasks.create("grant${variantName}Permissions") << {
|
||||
"${adb} devices".execute().text.eachLine {
|
||||
if(it.endsWith("device")){
|
||||
def device = it.split()[0]
|
||||
println "Granting permissions on devices ${device}"
|
||||
"${adb} shell pm grant ${applicationId} android.permission.RECORD_AUDIO".execute()
|
||||
"${adb} shell pm grant ${applicationId} android.permission.WRITE_EXTERNAL_STORAGE".execute()
|
||||
"${adb} shell pm grant ${applicationId} android.permission.CAMERA".execute()
|
||||
}
|
||||
|
||||
task grantPermissionStorage(type: Exec, dependsOn: 'installDebugAndroidTest') {
|
||||
def applicationId = "${getPackageName()}.test"
|
||||
def adb = android.getAdbExe().toString()
|
||||
outputs.dir '.'
|
||||
commandLine "${adb} shell pm grant ${applicationId} android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
}
|
||||
|
||||
task grantPermissionAudio(type: Exec, dependsOn: 'installDebugAndroidTest') {
|
||||
def applicationId = "${getPackageName()}.test"
|
||||
def adb = android.getAdbExe().toString()
|
||||
outputs.dir '.'
|
||||
commandLine "${adb} shell pm grant ${applicationId} android.permission.RECORD_AUDIO"
|
||||
}
|
||||
|
||||
// When we launch test
|
||||
tasks.whenTaskAdded { task ->
|
||||
if (task.name.startsWith('connectedDebugAndroidTest')) {
|
||||
task.dependsOn grantPermissionCamera
|
||||
task.dependsOn grantPermissionAudio
|
||||
task.dependsOn grantPermissionStorage
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue