mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-22 04:49:00 +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:
parent
ae0c9fa60b
commit
1ebe56ca76
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user