Last active
December 29, 2015 04:17
-
-
Save dagezi/48ddf0677dd62b3a8495 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.android.build.gradle.internal.tasks.DeviceProviderInstrumentTestTask | |
import com.android.builder.testing.api.DeviceConnector | |
def isDeviceReady(DeviceConnector device) { | |
def res = device.getSystemProperty('init.svc.bootanim').get() | |
return res == 'stopped' | |
} | |
def waitForAllDevicesReady(DeviceProviderInstrumentTestTask testTaks) { | |
// Add time out? | |
def devices = testTaks.deviceProvider.devices.clone() | |
while (!devices.isEmpty()) { | |
devices.removeAll isDeviceReady | |
sleep(1000) | |
} | |
} | |
android.testVariants.all { variant -> | |
variant.connectedInstrumentTest.doFirst { | |
waitForAllDevicesReady(variant.connectedInstrumentTest) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment