mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-19 04:21:17 +00:00
Merge pull request #310 from marcbonnici/peacekeeper
PeacekeeperWorkload: Updated to work with new APK versions
This commit is contained in:
commit
1befe63e45
@ -81,6 +81,10 @@ class Peacekeeper(AndroidUiAutoBenchmark):
|
||||
if not url:
|
||||
raise WorkloadError('The url is empty, error while running peacekeeper benchmark')
|
||||
|
||||
# urlopen expects url beginning with protocol.
|
||||
if not url.startswith('http'):
|
||||
url = 'http://' + url
|
||||
|
||||
req = urllib2.Request(url)
|
||||
response = urllib2.urlopen(req)
|
||||
result_page = response.read()
|
||||
|
Binary file not shown.
@ -65,6 +65,10 @@ public class UiAutomation extends BaseUiAutomation {
|
||||
UiObject addressBar = new UiObject(new UiSelector()
|
||||
.className("android.widget.TextView")
|
||||
.text("Enter Search or Address"));
|
||||
if (!addressBar.exists()) {
|
||||
addressBar = new UiObject(new UiSelector()
|
||||
.resourceIdMatches(".*/url_bar_title"));
|
||||
}
|
||||
addressBar.click();
|
||||
UiObject setUrl = new UiObject(new UiSelector()
|
||||
.className("android.widget.EditText"));
|
||||
@ -72,6 +76,13 @@ public class UiAutomation extends BaseUiAutomation {
|
||||
setUrl.setText(peacekeeperUrl);
|
||||
getUiDevice().pressEnter();
|
||||
|
||||
// Allow time for UI to update
|
||||
sleep(1);
|
||||
|
||||
if (!setUrl.exists()){
|
||||
setUrl = addressBar;
|
||||
}
|
||||
|
||||
UiObject currentUrl = new UiObject(new UiSelector()
|
||||
.className("android.widget.TextView").index(1));
|
||||
for (int i = 0; i < TIMEOUT; i++) {
|
||||
@ -88,19 +99,43 @@ public class UiAutomation extends BaseUiAutomation {
|
||||
sleep(10);
|
||||
}
|
||||
} else if (browser.equals("chrome")) { // Code for Chrome browser
|
||||
UiObject adressBar = new UiObject(new UiSelector()
|
||||
.className("android.widget.EditText")
|
||||
.description("Search or type url"));
|
||||
|
||||
adressBar.clearTextField();
|
||||
adressBar.setText(peacekeeperUrl);
|
||||
//Check for welcome screen and dismiss if present.
|
||||
UiObject acceptTerms = new UiObject(new UiSelector()
|
||||
.className("android.widget.Button")
|
||||
.textContains("Accept & continue"));
|
||||
if (acceptTerms.exists()){
|
||||
acceptTerms.click();
|
||||
UiObject dismiss = new UiObject(new UiSelector()
|
||||
.className("android.widget.Button")
|
||||
.resourceIdMatches(".*/negative_button"));
|
||||
if (dismiss.exists()){
|
||||
dismiss.clickAndWaitForNewWindow();
|
||||
}
|
||||
}
|
||||
|
||||
UiObject addressBar = new UiObject(new UiSelector()
|
||||
.className("android.widget.EditText")
|
||||
.descriptionContains("Search or type url"));
|
||||
|
||||
addressBar.clickAndWaitForNewWindow();
|
||||
addressBar.clearTextField();
|
||||
addressBar.setText(peacekeeperUrl);
|
||||
getUiDevice().pressEnter();
|
||||
|
||||
// Allow time for UI to update
|
||||
sleep(1);
|
||||
|
||||
if (!addressBar.exists()){
|
||||
addressBar = new UiObject(new UiSelector()
|
||||
.resourceIdMatches(".*/url_bar"));
|
||||
}
|
||||
for (int i = 0; i < TIMEOUT; i++) {
|
||||
|
||||
if (!adressBar.getText().contains("run.action")) {
|
||||
if (!addressBar.getText().contains("run.action")) {
|
||||
|
||||
// write url address to peacekeeper.txt file
|
||||
urlAddress = adressBar.getText();
|
||||
urlAddress = addressBar.getText();
|
||||
if (!urlAddress.contains("http"))
|
||||
urlAddress = "http://" + urlAddress;
|
||||
writer.println(urlAddress);
|
||||
|
Loading…
x
Reference in New Issue
Block a user