1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-05 18:31:12 +01:00

pcmark: update uiautomation to fix Android-Q breakage

A new popup appears when running pcmark on android Q that complains
about the app being built for an older version of android.

Since this popup will be temporary, the fix has to make sure not to
break in the future when this popup disappears or when the test is ran
on a compatible version of android.

To achieve this, we attempt to dismiss the popup and if we timeout we
silently carry on with the test assuming no popup will appear.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
This commit is contained in:
Qais Yousef 2018-10-01 14:36:05 +01:00 committed by Marc Bonnici
parent 9a4a90e0a6
commit e73b299fbe
2 changed files with 14 additions and 0 deletions

View File

@ -37,6 +37,7 @@ public class UiAutomation extends BaseUiAutomation {
private int networkTimeoutSecs = 30;
private long networkTimeout = TimeUnit.SECONDS.toMillis(networkTimeoutSecs);
public static String TAG = "UXPERF";
public static final long WAIT_TIMEOUT_5SEC = TimeUnit.SECONDS.toMillis(5);
@Before
public void initialize(){
@ -45,6 +46,7 @@ public class UiAutomation extends BaseUiAutomation {
@Test
public void setup() throws Exception{
dismissPopup();
setScreenOrientation(ScreenOrientation.NATURAL);
loadBenchmarks();
installBenchmark();
@ -60,6 +62,18 @@ public class UiAutomation extends BaseUiAutomation {
unsetScreenOrientation();
}
// If we run the app in newer Android we'll get a popup complaining about
// that, silently accept it and carry on.
// This function should act as a NOP if no popup appears.
public void dismissPopup() throws Exception {
UiObject acceptButton =
mDevice.findObject(new UiSelector().resourceId("android:id/button1")
.className("android.widget.Button"));
if (acceptButton.waitForExists(WAIT_TIMEOUT_5SEC)) {
acceptButton.click();
}
}
//Swipe to benchmarks and back to initialise the app correctly
private void loadBenchmarks() throws Exception {
UiObject title =