mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-31 15:12:25 +00:00 
			
		
		
		
	Merge pull request #346 from jimboatarm/googlephotos-interface
Googlephotos: implement ApplaunchInterface
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.android.uiautomator.core.UiScrollable; | ||||||
|  |  | ||||||
| import com.arm.wlauto.uiauto.UxPerfUiAutomation; | 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_ID; | ||||||
| import static com.arm.wlauto.uiauto.BaseUiAutomation.FindByCriteria.BY_TEXT; | 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; | ||||||
| import java.util.Map.Entry; | import java.util.Map.Entry; | ||||||
|  |  | ||||||
| public class UiAutomation extends UxPerfUiAutomation { | public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterface { | ||||||
|  |  | ||||||
|     public Bundle parameters; |  | ||||||
|     public String packageName; |  | ||||||
|     public String packageID; |  | ||||||
|  |  | ||||||
|     private long viewTimeout =  TimeUnit.SECONDS.toMillis(10); |     private long viewTimeout =  TimeUnit.SECONDS.toMillis(10); | ||||||
|  |  | ||||||
|     public void runUiAutomation() throws Exception { |     public void runUiAutomation() throws Exception { | ||||||
|         parameters = getParams(); |         parameters = getParams(); | ||||||
|         packageName = parameters.getString("package"); |  | ||||||
|         packageID = packageName + ":id/"; |  | ||||||
|  |  | ||||||
|         sleep(5); // Pause while splash screen loads |         sleep(5); // Pause while splash screen loads | ||||||
|         setScreenOrientation(ScreenOrientation.NATURAL); |         setScreenOrientation(ScreenOrientation.NATURAL); | ||||||
|         dismissWelcomeView(); |         runApplicationInitialization(); | ||||||
|         closePromotionPopUp(); |  | ||||||
|  |  | ||||||
|         selectGalleryFolder("wa-1"); |         selectGalleryFolder("wa-1"); | ||||||
|         selectFirstImage(); |         selectFirstImage(); | ||||||
| @@ -79,6 +74,32 @@ public class UiAutomation extends UxPerfUiAutomation { | |||||||
|         unsetScreenOrientation(); |         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 { |     public void dismissWelcomeView() throws Exception { | ||||||
|         // Click through the first two pages and make sure that we don't sign |         // 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 |         // in to our google account. This ensures the same set of photographs | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user