1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 10:51:13 +01:00

Merge pull request #255 from jimboatarm/skype-codetidy

Skype: Codetidy, no functional changes
This commit is contained in:
setrofim 2016-09-22 17:28:25 +01:00 committed by GitHub
commit 2b6f036d9a
2 changed files with 32 additions and 31 deletions

View File

@ -28,39 +28,13 @@ import java.util.concurrent.TimeUnit;
public class UiAutomation extends UxPerfUiAutomation {
public static final String TEXT_VIEW = "android.widget.TextView";
public static final String ACTION_VOICE = "voice";
public static final String ACTION_VIDEO = "video";
public Bundle parameters;
public String packageName;
public String packageID;
// Creates a watcher for when a pop up dialog appears with a dismiss button.
private UiWatcher createInfoPopUpWatcher() throws Exception {
UiWatcher infoPopUpWatcher = new UiWatcher() {
@Override
public boolean checkForCondition() {
UiObject dismissButton =
new UiObject(new UiSelector().resourceId(packageID + "dismiss_button"));
if (dismissButton.exists()) {
try {
dismissButton.click();
} catch (UiObjectNotFoundException e) {
e.printStackTrace();
}
Long viewTimeout = TimeUnit.SECONDS.toMillis(10);
boolean dismissed = dismissButton.waitUntilGone(viewTimeout);
return dismissed;
}
return false;
}
};
return infoPopUpWatcher;
}
public void runUiAutomation() throws Exception {
// Override superclass value
this.uiAutoTimeout = TimeUnit.SECONDS.toMillis(10);
@ -86,10 +60,10 @@ public class UiAutomation extends UxPerfUiAutomation {
handleLoginScreen(loginName, loginPass);
searchForContact(contactName);
if ("video".equalsIgnoreCase(callType)) {
videoCallTest(callDuration);
} else if ("voice".equalsIgnoreCase(callType)) {
if (ACTION_VOICE.equalsIgnoreCase(callType)) {
voiceCallTest(callDuration);
} else if (ACTION_VIDEO.equalsIgnoreCase(callType)) {
videoCallTest(callDuration);
}
removeWatcher("infoPopUpWatcher");
@ -152,6 +126,33 @@ public class UiAutomation extends UxPerfUiAutomation {
}
}
// Creates a watcher for when a pop up dialog appears with a dismiss button.
private UiWatcher createInfoPopUpWatcher() throws Exception {
UiWatcher infoPopUpWatcher = new UiWatcher() {
@Override
public boolean checkForCondition() {
UiObject dismissButton =
new UiObject(new UiSelector().resourceId(packageID + "dismiss_button"));
if (dismissButton.exists()) {
try {
dismissButton.click();
} catch (UiObjectNotFoundException e) {
e.printStackTrace();
}
Long viewTimeout = TimeUnit.SECONDS.toMillis(10);
boolean dismissed = dismissButton.waitUntilGone(viewTimeout);
return dismissed;
}
return false;
}
};
return infoPopUpWatcher;
}
private void voiceCallTest(int duration) throws Exception {
String testTag = "call_voice";
ActionLogger logger = new ActionLogger(testTag, parameters);