mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-11-04 00:52:08 +00:00 
			
		
		
		
	Merge pull request #255 from jimboatarm/skype-codetidy
Skype: Codetidy, no functional changes
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										63
									
								
								wlauto/workloads/skype/uiauto/src/com/arm/wlauto/uiauto/UiAutomation.java
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										63
									
								
								wlauto/workloads/skype/uiauto/src/com/arm/wlauto/uiauto/UiAutomation.java
									
									
									
									
									
										
										
										Normal file → Executable 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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user