mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-21 20:38:57 +00:00
Googleplaybooks: implement ApplaunchInterface
Adapt googleplaybooks 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
79f58e74b9
Binary file not shown.
@ -25,6 +25,8 @@ import com.android.uiautomator.core.UiWatcher;
|
|||||||
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;
|
||||||
@ -38,11 +40,7 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class UiAutomation extends UxPerfUiAutomation {
|
public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterface {
|
||||||
|
|
||||||
protected Bundle parameters;
|
|
||||||
protected String packageName;
|
|
||||||
protected String packageID;
|
|
||||||
|
|
||||||
private int viewTimeoutSecs = 10;
|
private int viewTimeoutSecs = 10;
|
||||||
private long viewTimeout = TimeUnit.SECONDS.toMillis(viewTimeoutSecs);
|
private long viewTimeout = TimeUnit.SECONDS.toMillis(viewTimeoutSecs);
|
||||||
@ -52,22 +50,15 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
this.uiAutoTimeout = TimeUnit.SECONDS.toMillis(8);
|
this.uiAutoTimeout = TimeUnit.SECONDS.toMillis(8);
|
||||||
|
|
||||||
parameters = getParams();
|
parameters = getParams();
|
||||||
packageName = parameters.getString("package");
|
|
||||||
packageID = packageName + ":id/";
|
|
||||||
|
|
||||||
String searchBookTitle = parameters.getString("search_book_title").replace("0space0", " ");
|
String searchBookTitle = parameters.getString("search_book_title").replace("0space0", " ");
|
||||||
String libraryBookTitle = parameters.getString("library_book_title").replace("0space0", " ");
|
String libraryBookTitle = parameters.getString("library_book_title").replace("0space0", " ");
|
||||||
String chapterPageNumber = parameters.getString("chapter_page_number");
|
String chapterPageNumber = parameters.getString("chapter_page_number");
|
||||||
String searchWord = parameters.getString("search_word");
|
String searchWord = parameters.getString("search_word");
|
||||||
String noteText = "This is a test note";
|
String noteText = "This is a test note";
|
||||||
String account = parameters.getString("account");
|
|
||||||
|
|
||||||
setScreenOrientation(ScreenOrientation.NATURAL);
|
setScreenOrientation(ScreenOrientation.NATURAL);
|
||||||
|
runApplicationInitialization();
|
||||||
chooseAccount(account);
|
|
||||||
clearFirstRunDialogues();
|
|
||||||
dismissSendBooksAsGiftsDialog();
|
|
||||||
dismissSync();
|
|
||||||
|
|
||||||
searchForBook(searchBookTitle);
|
searchForBook(searchBookTitle);
|
||||||
addToLibrary();
|
addToLibrary();
|
||||||
@ -91,6 +82,35 @@ 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();
|
||||||
|
String account = parameters.getString("account");
|
||||||
|
chooseAccount(account);
|
||||||
|
clearFirstRunDialogues();
|
||||||
|
dismissSendBooksAsGiftsDialog();
|
||||||
|
dismissSync();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the UiObject that marks the end of the application launch.
|
||||||
|
public UiObject getLaunchEndObject() {
|
||||||
|
UiObject launchEndObject = new UiObject(new UiSelector()
|
||||||
|
.className("android.widget.ImageButton"));
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
// If the device has more than one account setup, a prompt appears
|
// If the device has more than one account setup, a prompt appears
|
||||||
// In this case, select the first account in the list, unless `account`
|
// In this case, select the first account in the list, unless `account`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user