1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-04-15 07:10:56 +01:00

Formatting change

This commit is contained in:
muendelezaji 2016-05-03 17:01:46 +01:00
parent 915023dfd7
commit c65878fee4

View File

@ -38,31 +38,31 @@ public class UiAutomation extends UxPerfUiAutomation {
private Map<String, Timer> results = new HashMap<String, Timer>(); private Map<String, Timer> results = new HashMap<String, Timer>();
public void runUiAutomation() throws Exception { public void runUiAutomation() throws Exception {
// Get Params // Get Params
Bundle parameters = getParams(); Bundle parameters = getParams();
String loginName = parameters.getString("my_id"); String loginName = parameters.getString("my_id");
String loginPass = parameters.getString("my_pwd"); String loginPass = parameters.getString("my_pwd");
String contactSkypeid = parameters.getString("skypeid"); String contactSkypeid = parameters.getString("skypeid");
String contactName = parameters.getString("name").replace("_", " "); String contactName = parameters.getString("name").replace("_", " ");
int callDuration = Integer.parseInt(parameters.getString("duration")); int callDuration = Integer.parseInt(parameters.getString("duration"));
boolean isVideo = "video".equals(parameters.getString("action")); boolean isVideo = "video".equals(parameters.getString("action"));
String resultsFile = parameters.getString("results_file"); String resultsFile = parameters.getString("results_file");
// Run tests // Run tests
Timer overallTimer = new Timer(); Timer overallTimer = new Timer();
Timer callTimer = new Timer(); Timer callTimer = new Timer();
overallTimer.start(); overallTimer.start();
handleLoginScreen(loginName, loginPass); handleLoginScreen(loginName, loginPass);
selectContact(contactName, contactSkypeid); selectContact(contactName, contactSkypeid);
callTimer.start(); callTimer.start();
makeCall(callDuration, isVideo); makeCall(callDuration, isVideo);
callTimer.end(); callTimer.end();
overallTimer.end(); overallTimer.end();
// Save results // Save results
results.put("call_test", callTimer); results.put("call_test", callTimer);
results.put("overall_test", overallTimer); results.put("overall_test", overallTimer);
saveResults(results, resultsFile); saveResults(results, resultsFile);
} }
private void saveResults(Map<String, Timer> results, String file) throws Exception { private void saveResults(Map<String, Timer> results, String file) throws Exception {
@ -79,30 +79,30 @@ public class UiAutomation extends UxPerfUiAutomation {
} }
public void selectContact(String name, String id) throws Exception { public void selectContact(String name, String id) throws Exception {
// UiObject peopleTab = new UiObject(selector.text("People")); // UiObject peopleTab = new UiObject(selector.text("People"));
UiObject peopleTab = getUiObjectByDescription("People", "android.widget.TextView"); UiObject peopleTab = getUiObjectByDescription("People", "android.widget.TextView");
peopleTab.click(); peopleTab.click();
// On first startup, the app may take a while to load the display name, so try twice // On first startup, the app may take a while to load the display name, so try twice
// before declaring failure // before declaring failure
UiObject contactCard; UiObject contactCard;
try { try {
contactCard = getUiObjectByText(name, "android.widget.TextView"); contactCard = getUiObjectByText(name, "android.widget.TextView");
} catch (UiObjectNotFoundException e) { } catch (UiObjectNotFoundException e) {
contactCard = getUiObjectByText(name, "android.widget.TextView"); contactCard = getUiObjectByText(name, "android.widget.TextView");
// contactCard = getUiObjectByText(id, "android.widget.TextView"); // contactCard = getUiObjectByText(id, "android.widget.TextView");
} }
contactCard.clickAndWaitForNewWindow(); contactCard.clickAndWaitForNewWindow();
} }
public void makeCall(int duration, boolean video) throws Exception { public void makeCall(int duration, boolean video) throws Exception {
// String resource = video ? videoCallButtonResourceId : voiceCallButtonResourceId; // String resource = video ? videoCallButtonResourceId : voiceCallButtonResourceId;
// UiObject callButton = new UiObject(new UiSelector().resourceId(resource)); // UiObject callButton = new UiObject(new UiSelector().resourceId(resource));
String description = video ? "Video call" : "Call options"; String description = video ? "Video call" : "Call options";
UiObject callButton = new UiObject(new UiSelector().descriptionContains(description)); UiObject callButton = new UiObject(new UiSelector().descriptionContains(description));
callButton.click(); callButton.click();
sleep(duration); sleep(duration);
// endCall();g // endCall();
} }
/* /*