File tree Expand file tree Collapse file tree 6 files changed +28
-73
lines changed
src/main/kotlin/com/example/macrobenchmark/baselineprofile Expand file tree Collapse file tree 6 files changed +28
-73
lines changed Original file line number Diff line number Diff line change 6161 -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" \
6262 -Pandroid.experimental.testOptions.managedDevices.setupTimeoutMinutes=180 \
6363 -Pandroid.experimental.androidTest.numManagedDeviceShards=1 \
64- -Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1
64+ -Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1 \
65+ -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
66+
Original file line number Diff line number Diff line change @@ -50,13 +50,14 @@ android {
5050 )
5151 // In real app, this would use its own release keystore
5252 signingConfig = signingConfigs.getByName(" debug" )
53+ baselineProfile.automaticGenerationDuringBuild = true
5354 }
5455 }
5556 // [END macrobenchmark_setup_app_build_type]
5657
5758 compileOptions {
58- sourceCompatibility = JavaVersion .VERSION_21
59- targetCompatibility = JavaVersion .VERSION_21
59+ sourceCompatibility = JavaVersion .VERSION_17
60+ targetCompatibility = JavaVersion .VERSION_17
6061 }
6162}
6263
Original file line number Diff line number Diff line change @@ -40,15 +40,16 @@ android {
4040 targetProjectPath = " :app"
4141
4242 compileOptions {
43- sourceCompatibility = JavaVersion .VERSION_21
44- targetCompatibility = JavaVersion .VERSION_21
43+ sourceCompatibility = JavaVersion .VERSION_17
44+ targetCompatibility = JavaVersion .VERSION_17
4545 }
4646
4747 testOptions.managedDevices.allDevices {
4848 create<ManagedVirtualDevice >(" pixel6Api31" ) {
4949 device = " Pixel 6"
5050 apiLevel = 31
51- systemImageSource = " aosp"
51+ systemImageSource = " aosp-atd"
52+ testedAbi = " arm32-v8a"
5253 }
5354 }
5455 // [END_EXCLUDE]
Original file line number Diff line number Diff line change @@ -40,10 +40,9 @@ class LoginBaselineProfileGenerator {
4040 stableIterations = 3
4141 ) {
4242 uiAutomator {
43- clearAppData()
4443 startIntent(Intent (" $packageName .LOGIN_ACTIVITY" ))
45- onElement { textAsString() == " User: " }.text = " user"
46- onElement { textAsString() == " Password: " }.text = " password"
44+ onElement { isEditable and ! isPassword }.text = " user"
45+ onElement { isEditable && isPassword }.text = " password"
4746 onElement { textAsString() == " Login" }.click()
4847 }
4948 }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1616
1717package com.example.macrobenchmark.baselineprofile
1818
19- import android.content.Intent
2019import androidx.benchmark.macro.junit4.BaselineProfileRule
2120import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
22- import androidx.test.uiautomator.Direction
21+ import androidx.test.uiautomator.textAsString
2322import androidx.test.uiautomator.uiAutomator
2423import com.example.macrobenchmark.benchmark.util.TARGET_PACKAGE
25- import org.junit.Ignore
2624import org.junit.Rule
2725import org.junit.Test
2826import org.junit.runner.RunWith
2927
30- @Ignore // TODO causing stale object excpetion on CI .. why?
3128@RunWith(AndroidJUnit4ClassRunner ::class )
32- class ComposeActivityBaselineProfileGenerator {
29+ class SampleBaselineProfileGenerator {
3330
3431 @get:Rule
3532 val rule = BaselineProfileRule ()
@@ -42,11 +39,20 @@ class ComposeActivityBaselineProfileGenerator {
4239 stableIterations = 3
4340 ) {
4441 uiAutomator {
45- // Start into the Compose Activity
46- startIntent(Intent (" $TARGET_PACKAGE .COMPOSE_ACTIVITY" ))
47- // Scrolling through the Compose journey
48- onElement { viewIdResourceName == " myLazyColumn" }.fling(Direction .DOWN )
49- onElement { viewIdResourceName == " myLazyColumn" }.fling(Direction .UP )
42+ startApp(TARGET_PACKAGE )
43+ listOf (
44+ " Login" ,
45+ " ListView" ,
46+ " Compose" ,
47+ " ScrollView" ,
48+ " Fully Drawn" ,
49+ " RecyclerView" ,
50+ " Nested RecyclerView" ,
51+ " Nested RecyclerView with Pools"
52+ ).forEach {
53+ onElement { textAsString() == it }.click()
54+ pressBack()
55+ }
5056 }
5157 }
5258 }
You can’t perform that action at this time.
0 commit comments