Add permissions grant for liblinphone tester

This commit is contained in:
Erwan Croze 2017-04-12 14:09:51 +02:00
parent 04a4e2a8ed
commit 3fe7cbff90

View file

@ -86,6 +86,37 @@ android {
} }
} }
// Grant permissions
task grantPermissionCamera(type: Exec, dependsOn: 'installDebugAndroidTest') {
def applicationId = "${getPackageName()}.test"
def adb = android.getAdbExe().toString()
outputs.dir '.'
commandLine "${adb} shell pm grant ${applicationId} android.permission.CAMERA"
}
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
}
}
tasks.withType(Test) { tasks.withType(Test) {
testLogging { testLogging {
exceptionFormat 'full' exceptionFormat 'full'