mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-31 07:04:17 +00:00 
			
		
		
		
	Googlephotos: implement ApplaunchInterface
Adapt googlephotos to support applaunch workload by implementing the methods required by the interface. Tested on Huawei Mate8 and Samsung S7.
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							| @@ -25,6 +25,8 @@ import com.android.uiautomator.core.UiSelector; | ||||
| import com.android.uiautomator.core.UiScrollable; | ||||
|  | ||||
| import com.arm.wlauto.uiauto.UxPerfUiAutomation; | ||||
| import com.arm.wlauto.uiauto.ApplaunchInterface; | ||||
| import com.arm.wlauto.uiauto.UiAutoUtils; | ||||
|  | ||||
| import static com.arm.wlauto.uiauto.BaseUiAutomation.FindByCriteria.BY_ID; | ||||
| import static com.arm.wlauto.uiauto.BaseUiAutomation.FindByCriteria.BY_TEXT; | ||||
| @@ -36,23 +38,16 @@ import java.util.Iterator; | ||||
| import java.util.Map; | ||||
| import java.util.Map.Entry; | ||||
|  | ||||
| public class UiAutomation extends UxPerfUiAutomation { | ||||
|  | ||||
|     public Bundle parameters; | ||||
|     public String packageName; | ||||
|     public String packageID; | ||||
| public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterface { | ||||
|  | ||||
|     private long viewTimeout =  TimeUnit.SECONDS.toMillis(10); | ||||
|  | ||||
|     public void runUiAutomation() throws Exception { | ||||
|         parameters = getParams(); | ||||
|         packageName = parameters.getString("package"); | ||||
|         packageID = packageName + ":id/"; | ||||
|  | ||||
|         sleep(5); // Pause while splash screen loads | ||||
|         setScreenOrientation(ScreenOrientation.NATURAL); | ||||
|         dismissWelcomeView(); | ||||
|         closePromotionPopUp(); | ||||
|         runApplicationInitialization(); | ||||
|  | ||||
|         selectGalleryFolder("wa-1"); | ||||
|         selectFirstImage(); | ||||
| @@ -79,6 +74,32 @@ public class UiAutomation extends UxPerfUiAutomation { | ||||
|         unsetScreenOrientation(); | ||||
|     } | ||||
|  | ||||
|     // Get application parameters and clear the initial run dialogues of the application launch. | ||||
|     public void runApplicationInitialization() throws Exception { | ||||
|         getPackageParameters(); | ||||
|         dismissWelcomeView(); | ||||
|         closePromotionPopUp(); | ||||
|     } | ||||
|      | ||||
|     // Sets the UiObject that marks the end of the application launch. | ||||
|     public UiObject getLaunchEndObject() { | ||||
|         UiObject launchEndObject = new UiObject(new UiSelector().textContains("Photos") | ||||
|                                          .className("android.widget.TextView")); | ||||
|         return launchEndObject; | ||||
|     } | ||||
|      | ||||
|     // Returns the launch command for the application. | ||||
|     public String getLaunchCommand() { | ||||
|         String launch_command; | ||||
|         launch_command = UiAutoUtils.createLaunchCommand(parameters); | ||||
|         return launch_command; | ||||
|     } | ||||
|      | ||||
|     // Pass the workload parameters, used for applaunch | ||||
|     public void setWorkloadParameters(Bundle workload_parameters) { | ||||
|         parameters = workload_parameters; | ||||
|     } | ||||
|  | ||||
|     public void dismissWelcomeView() throws Exception { | ||||
|         // Click through the first two pages and make sure that we don't sign | ||||
|         // in to our google account. This ensures the same set of photographs | ||||
|   | ||||
		Reference in New Issue
	
	Block a user