aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Bonnici <marc.bonnici@arm.com>2019-02-08 14:28:25 +0000
committersetrofim <setrofim@gmail.com>2019-02-08 14:32:58 +0000
commit1415f61e3687dfd550fd3268cb07947627097d48 (patch)
tree09af920e929d9a48d13ce309aae7d87feb08f785
parent6ab1ae74a69e3f18ba48232d0d2905e265e21d88 (diff)
workloads/chrome: Fix for tablet devices
Some tablet devices use an alternate tab switching method due to the larger screen space. Add support for adding new tabs via the menu instead of via the tab switcher.
-rw-r--r--wa/workloads/chrome/com.arm.wa.uiauto.chrome.apkbin265222 -> 264518 bytes
-rw-r--r--wa/workloads/chrome/uiauto/app/src/main/java/com/arm/wa/uiauto/UiAutomation.java22
2 files changed, 16 insertions, 6 deletions
diff --git a/wa/workloads/chrome/com.arm.wa.uiauto.chrome.apk b/wa/workloads/chrome/com.arm.wa.uiauto.chrome.apk
index cb391833..692e2a93 100644
--- a/wa/workloads/chrome/com.arm.wa.uiauto.chrome.apk
+++ b/wa/workloads/chrome/com.arm.wa.uiauto.chrome.apk
Binary files differ
diff --git a/wa/workloads/chrome/uiauto/app/src/main/java/com/arm/wa/uiauto/UiAutomation.java b/wa/workloads/chrome/uiauto/app/src/main/java/com/arm/wa/uiauto/UiAutomation.java
index 3d7c5e2a..c643ff26 100644
--- a/wa/workloads/chrome/uiauto/app/src/main/java/com/arm/wa/uiauto/UiAutomation.java
+++ b/wa/workloads/chrome/uiauto/app/src/main/java/com/arm/wa/uiauto/UiAutomation.java
@@ -81,12 +81,22 @@ public class UiAutomation extends BaseUiAutomation implements ApplaunchInterface
// Activate the tab switcher
tabSwitcher = mDevice.findObject(new UiSelector().resourceId(packageID + "tab_switcher_button")
.className("android.widget.ImageButton"));
- tabSwitcher.clickAndWaitForNewWindow(uiAutoTimeout);
-
- // Click the New Tab button
- newTab = mDevice.findObject(new UiSelector().resourceId(packageID + "new_tab_button")
- .className("android.widget.Button"));
- newTab.clickAndWaitForNewWindow(uiAutoTimeout);
+ if (tabSwitcher.exists()){
+ tabSwitcher.clickAndWaitForNewWindow(uiAutoTimeout);
+ // Click the New Tab button
+ newTab = mDevice.findObject(new UiSelector().resourceId(packageID + "new_tab_button")
+ .className("android.widget.Button"));
+ newTab.clickAndWaitForNewWindow(uiAutoTimeout);
+ }
+ // Support Tablet devices which do not have tab switcher
+ else {
+ UiObject menu_button = mDevice.findObject(new UiSelector().resourceId(packageID + "menu_button")
+ .className("android.widget.ImageButton"));
+ menu_button.click();
+ newTab = mDevice.findObject(new UiSelector().resourceId(packageID + "menu_item_text")
+ .textContains("New tab"));
+ newTab.click();
+ }
}
public void followTextLink(String text) throws Exception {