1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-31 02:01:16 +00:00

workloads/speedometer: Misc Fixes

- Fix formatting
- Skip teardown automation if elements are not present on some devices
instead of failing the workload.
- Give extra time for start button to appear as some devices can be slow
to load.
This commit is contained in:
Marc Bonnici 2018-12-20 14:39:43 +00:00
parent ba4004db5f
commit 755417f139
2 changed files with 12 additions and 10 deletions

View File

@ -62,12 +62,12 @@ public class UiAutomation extends BaseUiAutomation {
} }
public void clearFirstRun() throws Exception { public void clearFirstRun() throws Exception {
UiObject accept = UiObject accept =
mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/terms_accept") mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/terms_accept")
.className("android.widget.Button")); .className("android.widget.Button"));
if (accept.exists()){ if (accept.exists()){
accept.click(); accept.click();
UiObject negative = UiObject negative =
mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/negative_button") mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/negative_button")
.className("android.widget.Button")); .className("android.widget.Button"));
negative.waitForExists(100000); negative.waitForExists(100000);
@ -76,18 +76,18 @@ public class UiAutomation extends BaseUiAutomation {
} }
public void runBenchmark() throws Exception { public void runBenchmark() throws Exception {
UiObject start = UiObject start =
mDevice.findObject(new UiSelector().description("Start Test") mDevice.findObject(new UiSelector().description("Start Test")
.className("android.widget.Button")); .className("android.widget.Button"));
if (start.exists()){ if (start.waitForExists(2000)){
start.click(); start.click();
} else { } else {
UiObject starttext = UiObject starttext =
mDevice.findObject(new UiSelector().text("Start Test") mDevice.findObject(new UiSelector().text("Start Test")
.className("android.widget.Button")); .className("android.widget.Button"));
starttext.click(); starttext.click();
} }
UiObject scores = UiObject scores =
mDevice.findObject(new UiSelector().resourceId("result-number") mDevice.findObject(new UiSelector().resourceId("result-number")
.className("android.view.View")); .className("android.view.View"));
scores.waitForExists(2100000); scores.waitForExists(2100000);
@ -97,17 +97,19 @@ public class UiAutomation extends BaseUiAutomation {
} }
public void clearTabs() throws Exception { public void clearTabs() throws Exception {
UiObject tabselector = UiObject tabselector =
mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/tab_switcher_button") mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/tab_switcher_button")
.className("android.widget.ImageButton")); .className("android.widget.ImageButton"));
if (!tabselector.exists()){
return;
}
tabselector.click(); tabselector.click();
UiObject menu = UiObject menu =
mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/menu_button") mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/menu_button")
.className("android.widget.ImageButton")); .className("android.widget.ImageButton"));
menu.click(); menu.click();
UiObject closetabs = UiObject closetabs =
mDevice.findObject(new UiSelector().textContains("Close all tabs")); mDevice.findObject(new UiSelector().textContains("Close all tabs"));
closetabs.click(); closetabs.click();
} }
} }