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
|
../gradlew uninstallDebug
|
||||||
|
|
||||||
run-all-tests: copy-files
|
run-all-tests: copy-files
|
||||||
../gradlew :connectedAndroidTest -i
|
../gradlew :installDebugAndroidTest && \
|
||||||
|
../gradlew :grantDebugPermissions -i && \
|
||||||
|
../gradlew :connectedAndroidTest -i \
|
||||||
|
|
||||||
copy-libs:
|
copy-libs:
|
||||||
mkdir -p assets && \
|
mkdir -p assets && \
|
||||||
|
|
|
@ -87,33 +87,20 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grant permissions
|
// Grant permissions
|
||||||
task grantPermissionCamera(type: Exec, dependsOn: 'installDebugAndroidTest') {
|
android.applicationVariants.all { variant ->
|
||||||
def applicationId = "${getPackageName()}.test"
|
def applicationId = "${getPackageName()}.test"
|
||||||
def adb = android.getAdbExe().toString()
|
def adb = android.getAdbExe().toString()
|
||||||
outputs.dir '.'
|
def variantName = variant.name.capitalize()
|
||||||
commandLine "${adb} shell pm grant ${applicationId} android.permission.CAMERA"
|
def grantPermissionTask = tasks.create("grant${variantName}Permissions") << {
|
||||||
}
|
"${adb} devices".execute().text.eachLine {
|
||||||
|
if(it.endsWith("device")){
|
||||||
task grantPermissionStorage(type: Exec, dependsOn: 'installDebugAndroidTest') {
|
def device = it.split()[0]
|
||||||
def applicationId = "${getPackageName()}.test"
|
println "Granting permissions on devices ${device}"
|
||||||
def adb = android.getAdbExe().toString()
|
"${adb} shell pm grant ${applicationId} android.permission.RECORD_AUDIO".execute()
|
||||||
outputs.dir '.'
|
"${adb} shell pm grant ${applicationId} android.permission.WRITE_EXTERNAL_STORAGE".execute()
|
||||||
commandLine "${adb} shell pm grant ${applicationId} android.permission.WRITE_EXTERNAL_STORAGE"
|
"${adb} shell pm grant ${applicationId} android.permission.CAMERA".execute()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
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