1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-18 20:11:20 +00:00

Handle the common chrome browser popup messages.

The Chrome browser presents a number of popups when run for
the first time. This update handles those popup messages.
This commit is contained in:
scojac01 2020-03-25 10:50:47 +00:00 committed by Marc Bonnici
parent 06ba8409c1
commit 9a931f42ee
4 changed files with 22 additions and 15 deletions

View File

@ -587,6 +587,27 @@ public class BaseUiAutomation {
} }
} }
// If Chrome is a fresh install then these popups may be presented
// dismiss them if visible.
public void dismissChromePopup() throws Exception {
UiObject accept =
mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/terms_accept")
.className("android.widget.Button"));
if (accept.exists()){
accept.click();
UiObject negative =
mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/negative_button")
.className("android.widget.Button"));
negative.waitForExists(100000);
negative.click();
}
UiObject lite =
mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/button_secondary")
.className("android.widget.Button"));
if (lite.exists()){
lite.click();
}
}
// Override getParams function to decode a url encoded parameter bundle before // Override getParams function to decode a url encoded parameter bundle before
// passing it to workloads. // passing it to workloads.

Binary file not shown.

View File

@ -47,7 +47,7 @@ public class UiAutomation extends BaseUiAutomation {
@Test @Test
public void setup() throws Exception{ public void setup() throws Exception{
setScreenOrientation(ScreenOrientation.NATURAL); setScreenOrientation(ScreenOrientation.NATURAL);
clearFirstRun(); dismissChromePopup();
} }
@Test @Test
@ -61,20 +61,6 @@ public class UiAutomation extends BaseUiAutomation {
unsetScreenOrientation(); unsetScreenOrientation();
} }
public void clearFirstRun() throws Exception {
UiObject accept =
mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/terms_accept")
.className("android.widget.Button"));
if (accept.exists()){
accept.click();
UiObject negative =
mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/negative_button")
.className("android.widget.Button"));
negative.waitForExists(100000);
negative.click();
}
}
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")