-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate startup profile from baseline profile
- Loading branch information
Showing
9 changed files
with
117 additions
and
4,335 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
52 changes: 34 additions & 18 deletions
52
app/src/release/generated/baselineProfiles/baseline-prof.txt
Large diffs are not rendered by default.
Oops, something went wrong.
4,305 changes: 6 additions & 4,299 deletions
4,305
app/src/release/generated/baselineProfiles/startup-prof.txt
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...w2sv/baselineprofile/StartupBenchmarks.kt → .../com/w2sv/wifiwidget/StartupBenchmarks.kt
This file contains 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
42 changes: 42 additions & 0 deletions
42
benchmarking/src/main/kotlin/com/w2sv/wifiwidget/UiDeviceExt.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.w2sv.wifiwidget | ||
|
||
import androidx.test.uiautomator.By | ||
import androidx.test.uiautomator.Direction | ||
import androidx.test.uiautomator.UiDevice | ||
import androidx.test.uiautomator.UiSelector | ||
import java.io.ByteArrayOutputStream | ||
|
||
internal fun UiDevice.criticalUserJourney() { | ||
closeLocationAccessPermissionRationalAndRequestDialogIfOpen() | ||
flingListDown("scrollableWifiPropertyList") | ||
|
||
goToWidgetConfigurationScreen() | ||
waitForIdle() | ||
|
||
flingListDown("scrollableWidgetConfigurationColumn") | ||
|
||
pressBack() | ||
} | ||
|
||
private fun UiDevice.closeLocationAccessPermissionRationalAndRequestDialogIfOpen() { | ||
findObject(By.text("Understood"))?.let { // 'Understood' button is part of the location access rational dialog | ||
it.click() // Closes the rational dialog | ||
waitForIdle() // Wait until location access permission request dialog appears | ||
pressBack() // Closes location access permission request dialog | ||
} | ||
} | ||
|
||
private fun UiDevice.dumpWindowHierarchy(): String { | ||
val outputStream = ByteArrayOutputStream() | ||
dumpWindowHierarchy(outputStream) | ||
return outputStream.toString("UTF-8") | ||
} | ||
|
||
private fun UiDevice.flingListDown(resourceName: String) { | ||
findObject(By.res(resourceName)).fling(Direction.DOWN) | ||
waitForIdle() | ||
} | ||
|
||
private fun UiDevice.goToWidgetConfigurationScreen() { | ||
findObject(UiSelector().description("Open the widget configuration screen.")).click() | ||
} |
25 changes: 25 additions & 0 deletions
25
...src/main/kotlin/com/w2sv/wifiwidget/baselineprofile/CriticalUserJourneyBaselineProfile.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.w2sv.wifiwidget.baselineprofile | ||
|
||
import androidx.benchmark.macro.junit4.BaselineProfileRule | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.filters.LargeTest | ||
import com.w2sv.wifiwidget.criticalUserJourney | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
@LargeTest | ||
class CriticalUserJourneyBaselineProfile { | ||
|
||
@get:Rule | ||
val rule = BaselineProfileRule() | ||
|
||
@Test | ||
fun generate() { | ||
rule.collect(packageName = "com.w2sv.wifiwidget") { | ||
startActivityAndWait() | ||
device.criticalUserJourney() | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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