36 lines
881 B
Kotlin
36 lines
881 B
Kotlin
package mihon.baselineprofile
|
|
|
|
import androidx.benchmark.macro.junit4.BaselineProfileRule
|
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
|
import androidx.test.filters.LargeTest
|
|
import androidx.test.uiautomator.By
|
|
import androidx.test.uiautomator.BySelector
|
|
import androidx.test.uiautomator.UiDevice
|
|
import androidx.test.uiautomator.Until
|
|
import org.junit.Rule
|
|
import org.junit.Test
|
|
import org.junit.runner.RunWith
|
|
|
|
@RunWith(AndroidJUnit4::class)
|
|
@LargeTest
|
|
class StartupProfileGenerator {
|
|
|
|
@get:Rule
|
|
val rule = BaselineProfileRule()
|
|
|
|
@Test
|
|
fun generate() {
|
|
rule.collect(
|
|
packageName = TARGET_PACKAGE_NAME,
|
|
includeInStartupProfile = true
|
|
) {
|
|
pressHome()
|
|
startActivityAndWait()
|
|
}
|
|
}
|
|
}
|
|
|
|
private fun UiDevice.waitAndClick(by: BySelector) {
|
|
wait(Until.findObject(by), 60_000).click()
|
|
}
|