1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-21 01:59:13 +00:00

Renames sleep() in to sleepSeconds() for clarity.

sleep() in BaseUiauto class renamed to sleepSeconds().

Function calls to sleep() replaced by sleepSeconds() in workloads that call this function.

Builds all workloads after sleep() is modified

Tested for two devices(s7 and mate8), running five workloads.
This commit is contained in:
jummp01 2016-11-15 11:53:47 +00:00
parent 40d281b336
commit 169c1ed28f
28 changed files with 102 additions and 103 deletions

View File

@ -100,7 +100,7 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
} }
} }
public void sleep(int second) { public void sleepSeconds(int second) {
super.sleep(second * 1000); super.sleep(second * 1000);
} }
@ -154,7 +154,7 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
long currentTime = System.currentTimeMillis(); long currentTime = System.currentTimeMillis();
boolean found = false; boolean found = false;
while ((currentTime - startTime) < timeout) { while ((currentTime - startTime) < timeout) {
sleep(2); // poll every two seconds sleepSeconds(2); // poll every two seconds
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
if (line.contains(searchText)) { if (line.contains(searchText)) {

View File

@ -78,7 +78,7 @@ public class UiAutomation extends BaseUiAutomation {
threadNumberField.setText(numThreads); threadNumberField.setText(numThreads);
getUiDevice().pressBack(); getUiDevice().pressBack();
sleep(shortDelaySeconds); sleepSeconds(shortDelaySeconds);
// If the device does not have a physical keyboard, a virtual one might have // If the device does not have a physical keyboard, a virtual one might have
// poped up when setting the number of threads. If that happend, then the above // poped up when setting the number of threads. If that happend, then the above
// backpress would dismiss the vkb and another one will be necessary to return // backpress would dismiss the vkb and another one will be necessary to return
@ -86,7 +86,7 @@ public class UiAutomation extends BaseUiAutomation {
if(threadNumberField.exists()) if(threadNumberField.exists())
{ {
getUiDevice().pressBack(); getUiDevice().pressBack();
sleep(shortDelaySeconds); sleepSeconds(shortDelaySeconds);
} }
} }
@ -95,7 +95,7 @@ public class UiAutomation extends BaseUiAutomation {
UiObject startButton = new UiObject(selector.className("android.widget.ImageButton") UiObject startButton = new UiObject(selector.className("android.widget.ImageButton")
.packageName("com.eembc.coremark")); .packageName("com.eembc.coremark"));
startButton.click(); startButton.click();
sleep(shortDelaySeconds); sleepSeconds(shortDelaySeconds);
} }
public void waitForAndExtractResuts() throws Exception { public void waitForAndExtractResuts() throws Exception {
@ -110,6 +110,6 @@ public class UiAutomation extends BaseUiAutomation {
.packageName("com.eembc.coremark")); .packageName("com.eembc.coremark"));
resultText.waitForExists(TimeUnit.SECONDS.toMillis(shortDelaySeconds)); resultText.waitForExists(TimeUnit.SECONDS.toMillis(shortDelaySeconds));
Log.v(TAG, resultText.getText()); Log.v(TAG, resultText.getText());
sleep(shortDelaySeconds); sleepSeconds(shortDelaySeconds);
} }
} }

View File

@ -37,7 +37,7 @@ public class UiAutomation extends BaseUiAutomation {
Bundle status = new Bundle(); Bundle status = new Bundle();
status.putString("product", getUiDevice().getProductName()); status.putString("product", getUiDevice().getProductName());
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
sleep(3); sleepSeconds(3);
UiObject btn_microbench = new UiObject(selector .textContains("Micro") UiObject btn_microbench = new UiObject(selector .textContains("Micro")
.className("android.widget.Button")); .className("android.widget.Button"));
btn_microbench.click(); btn_microbench.click();
@ -53,13 +53,13 @@ public class UiAutomation extends BaseUiAutomation {
waitObject(complete_text); waitObject(complete_text);
sleep(2); sleepSeconds(2);
complete_text.click(); complete_text.click();
} finally{ } finally{
//complete_text.click(); //complete_text.click();
} }
sleep(5); sleepSeconds(5);
takeScreenshot("Androbench"); takeScreenshot("Androbench");
getAutomationSupport().sendStatus(Activity.RESULT_OK, status); getAutomationSupport().sendStatus(Activity.RESULT_OK, status);
} }

View File

@ -109,7 +109,7 @@ public class UiAutomation extends BaseUiAutomation {
UiObject closeButton = new UiObject(selector.text("Cancel")); UiObject closeButton = new UiObject(selector.text("Cancel"));
if (closeButton.waitForExists(TimeUnit.SECONDS.toMillis(initialTimeoutSeconds))) { if (closeButton.waitForExists(TimeUnit.SECONDS.toMillis(initialTimeoutSeconds))) {
closeButton.click(); closeButton.click();
sleep(1); // diaglog dismissal sleepSeconds(1); // diaglog dismissal
return true; return true;
} else { } else {
return false; return false;
@ -121,7 +121,7 @@ public class UiAutomation extends BaseUiAutomation {
UiObject closeButton = new UiObject(selector.text("Close")); UiObject closeButton = new UiObject(selector.text("Close"));
if (closeButton.waitForExists(TimeUnit.SECONDS.toMillis(initialTimeoutSeconds))) { if (closeButton.waitForExists(TimeUnit.SECONDS.toMillis(initialTimeoutSeconds))) {
closeButton.click(); closeButton.click();
sleep(1); // diaglog dismissal sleepSeconds(1); // diaglog dismissal
return true; return true;
} else { } else {
return false; return false;
@ -137,7 +137,7 @@ public class UiAutomation extends BaseUiAutomation {
// dismiss it as long as keeps popping up. // dismiss it as long as keeps popping up.
while (closeButton.waitForExists(2)) { while (closeButton.waitForExists(2)) {
closeButton.click(); closeButton.click();
sleep(1); // diaglog dismissal sleepSeconds(1); // diaglog dismissal
dismissed = true; dismissed = true;
} }
return dismissed; return dismissed;
@ -149,7 +149,7 @@ public class UiAutomation extends BaseUiAutomation {
.className("android.widget.Button")); .className("android.widget.Button"));
test.waitForExists(initialTimeoutSeconds); test.waitForExists(initialTimeoutSeconds);
test.click(); test.click();
sleep(1); // possible tab transtion sleepSeconds(1); // possible tab transtion
} }
/* In version 5 of antutu, the test has been changed from a button widget to a textview */ /* In version 5 of antutu, the test has been changed from a button widget to a textview */
@ -160,7 +160,7 @@ public class UiAutomation extends BaseUiAutomation {
.className("android.widget.TextView")); .className("android.widget.TextView"));
test.waitForExists(initialTimeoutSeconds); test.waitForExists(initialTimeoutSeconds);
test.click(); test.click();
sleep(1); // possible tab transtion sleepSeconds(1); // possible tab transtion
} }
@ -168,14 +168,14 @@ public class UiAutomation extends BaseUiAutomation {
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
UiObject test = new UiObject(selector.text("Test")); UiObject test = new UiObject(selector.text("Test"));
test.click(); test.click();
sleep(1); // possible tab transtion sleepSeconds(1); // possible tab transtion
} }
public void disableSdCardTests() throws Exception { public void disableSdCardTests() throws Exception {
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
UiObject custom = new UiObject(selector.textContains("Custom")); UiObject custom = new UiObject(selector.textContains("Custom"));
custom.click(); custom.click();
sleep(1); // tab transition sleepSeconds(1); // tab transition
UiObject sdCardButton = new UiObject(selector.text("SD card IO")); UiObject sdCardButton = new UiObject(selector.text("SD card IO"));
sdCardButton.click(); sdCardButton.click();
@ -203,7 +203,7 @@ public class UiAutomation extends BaseUiAutomation {
if (detailsButton.exists() || barChart.exists()) { if (detailsButton.exists() || barChart.exists()) {
break; break;
} }
sleep(5); sleepSeconds(5);
} }
if (barChart.exists()) { if (barChart.exists()) {
@ -218,7 +218,7 @@ public class UiAutomation extends BaseUiAutomation {
if (qrText.exists()) { if (qrText.exists()) {
break; break;
} }
sleep(5); sleepSeconds(5);
} }
} }
@ -313,7 +313,7 @@ public class UiAutomation extends BaseUiAutomation {
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
UiObject detailsButton = new UiObject(new UiSelector().className("android.widget.Button") UiObject detailsButton = new UiObject(new UiSelector().className("android.widget.Button")
.text("Details")); .text("Details"));
sleep(1); sleepSeconds(1);
getUiDevice().pressBack(); getUiDevice().pressBack();
} }
} }
@ -343,7 +343,7 @@ public class UiAutomation extends BaseUiAutomation {
foundResults = true; foundResults = true;
break; break;
} }
sleep(5); sleepSeconds(5);
} }
if (!foundResults) { if (!foundResults) {
@ -360,20 +360,20 @@ public class UiAutomation extends BaseUiAutomation {
if (detailTextView.exists()) { if (detailTextView.exists()) {
detailTextView.click(); detailTextView.click();
sleep(1); // tab transition sleepSeconds(1); // tab transition
UiObject testTextView = new UiObject(selector.text("Test") UiObject testTextView = new UiObject(selector.text("Test")
.className("android.widget.TextView")); .className("android.widget.TextView"));
if (testTextView.exists()) { if (testTextView.exists()) {
testTextView.click(); testTextView.click();
sleep(1); // tab transition sleepSeconds(1); // tab transition
} }
UiObject scoresTextView = new UiObject(selector.text("Scores") UiObject scoresTextView = new UiObject(selector.text("Scores")
.className("android.widget.TextView")); .className("android.widget.TextView"));
if (scoresTextView.exists()) { if (scoresTextView.exists()) {
scoresTextView.click(); scoresTextView.click();
sleep(1); // tab transition sleepSeconds(1); // tab transition
} }
} }
} }

View File

@ -70,7 +70,7 @@ public class UiAutomation extends BaseUiAutomation {
UiObject detailsButton = new UiObject(selector.text("Details") UiObject detailsButton = new UiObject(selector.text("Details")
.className("android.widget.Button")); .className("android.widget.Button"));
detailsButton.click(); detailsButton.click();
sleep(2); sleepSeconds(2);
UiObject linearObject; UiObject linearObject;
UiObject detailedScore; UiObject detailedScore;

View File

@ -69,19 +69,19 @@ public class UiAutomation extends BaseUiAutomation {
// switch to camera capture mode // switch to camera capture mode
UiObject clickModes = new UiObject(new UiSelector().descriptionMatches("Camera, video or panorama selector")); UiObject clickModes = new UiObject(new UiSelector().descriptionMatches("Camera, video or panorama selector"));
clickModes.click(); clickModes.click();
sleep(sleepTime); sleepSeconds(sleepTime);
UiObject changeModeToCapture = new UiObject(new UiSelector().descriptionMatches("Switch to photo")); UiObject changeModeToCapture = new UiObject(new UiSelector().descriptionMatches("Switch to photo"));
changeModeToCapture.click(); changeModeToCapture.click();
sleep(sleepTime); sleepSeconds(sleepTime);
// click to capture photos // click to capture photos
UiObject clickCaptureButton = new UiObject(new UiSelector().descriptionMatches("Shutter button")); UiObject clickCaptureButton = new UiObject(new UiSelector().descriptionMatches("Shutter button"));
for (int i = 0; i < iterations; i++) { for (int i = 0; i < iterations; i++) {
clickCaptureButton.longClick(); clickCaptureButton.longClick();
sleep(timeDurationBetweenEachCapture); sleepSeconds(timeDurationBetweenEachCapture);
} }
getUiDevice().pressBack(); getUiDevice().pressBack();
} }
@ -92,7 +92,7 @@ public class UiAutomation extends BaseUiAutomation {
UiObject tutorialText = new UiObject(new UiSelector().resourceId("com.android.camera2:id/photoVideoSwipeTutorialText")); UiObject tutorialText = new UiObject(new UiSelector().resourceId("com.android.camera2:id/photoVideoSwipeTutorialText"));
if (tutorialText.waitForExists(TimeUnit.SECONDS.toMillis(5))) { if (tutorialText.waitForExists(TimeUnit.SECONDS.toMillis(5))) {
tutorialText.swipeLeft(5); tutorialText.swipeLeft(5);
sleep(sleepTime); sleepSeconds(sleepTime);
tutorialText.swipeRight(5); tutorialText.swipeRight(5);
} }
@ -105,7 +105,7 @@ public class UiAutomation extends BaseUiAutomation {
for (int i = 0; i < iterations; i++) { for (int i = 0; i < iterations; i++) {
clickCaptureButton.longClick(); clickCaptureButton.longClick();
sleep(timeDurationBetweenEachCapture); sleepSeconds(timeDurationBetweenEachCapture);
} }
} }
@ -118,14 +118,14 @@ public class UiAutomation extends BaseUiAutomation {
// switch to video mode // switch to video mode
UiObject changeModeToCapture = new UiObject(new UiSelector().descriptionMatches("Switch to Camera Mode")); UiObject changeModeToCapture = new UiObject(new UiSelector().descriptionMatches("Switch to Camera Mode"));
changeModeToCapture.click(); changeModeToCapture.click();
sleep(sleepTime); sleepSeconds(sleepTime);
// click to capture photos // click to capture photos
UiObject clickCaptureButton = new UiObject(new UiSelector().descriptionMatches("Shutter")); UiObject clickCaptureButton = new UiObject(new UiSelector().descriptionMatches("Shutter"));
for (int i = 0; i < iterations; i++) { for (int i = 0; i < iterations; i++) {
clickCaptureButton.longClick(); clickCaptureButton.longClick();
sleep(timeDurationBetweenEachCapture); sleepSeconds(timeDurationBetweenEachCapture);
} }
} }
} }

View File

@ -69,15 +69,15 @@ public class UiAutomation extends BaseUiAutomation {
// switch to camera capture mode // switch to camera capture mode
UiObject clickModes = new UiObject(new UiSelector().descriptionMatches("Camera, video or panorama selector")); UiObject clickModes = new UiObject(new UiSelector().descriptionMatches("Camera, video or panorama selector"));
clickModes.click(); clickModes.click();
sleep(sleepTime); sleepSeconds(sleepTime);
UiObject changeModeToCapture = new UiObject(new UiSelector().descriptionMatches("Switch to video")); UiObject changeModeToCapture = new UiObject(new UiSelector().descriptionMatches("Switch to video"));
changeModeToCapture.click(); changeModeToCapture.click();
sleep(sleepTime); sleepSeconds(sleepTime);
UiObject clickRecordingButton = new UiObject(new UiSelector().descriptionMatches("Shutter button")); UiObject clickRecordingButton = new UiObject(new UiSelector().descriptionMatches("Shutter button"));
clickRecordingButton.longClick(); clickRecordingButton.longClick();
sleep(recordingTime); sleepSeconds(recordingTime);
// Stop video recording // Stop video recording
clickRecordingButton.longClick(); clickRecordingButton.longClick();
@ -89,7 +89,7 @@ public class UiAutomation extends BaseUiAutomation {
UiObject tutorialText = new UiObject(new UiSelector().resourceId("com.android.camera2:id/photoVideoSwipeTutorialText")); UiObject tutorialText = new UiObject(new UiSelector().resourceId("com.android.camera2:id/photoVideoSwipeTutorialText"));
if (tutorialText.waitForExists(TimeUnit.SECONDS.toMillis(5))) { if (tutorialText.waitForExists(TimeUnit.SECONDS.toMillis(5))) {
tutorialText.swipeLeft(5); tutorialText.swipeLeft(5);
sleep(sleepTime); sleepSeconds(sleepTime);
tutorialText.swipeRight(5); tutorialText.swipeRight(5);
} }
@ -110,7 +110,7 @@ public class UiAutomation extends BaseUiAutomation {
// click to capture photos // click to capture photos
UiObject clickCaptureButton = new UiObject(new UiSelector().resourceId(captureButtonId)); UiObject clickCaptureButton = new UiObject(new UiSelector().resourceId(captureButtonId));
clickCaptureButton.longClick(); clickCaptureButton.longClick();
sleep(recordingTime); sleepSeconds(recordingTime);
// stop video recording // stop video recording
clickCaptureButton.longClick(); clickCaptureButton.longClick();
@ -124,11 +124,11 @@ public class UiAutomation extends BaseUiAutomation {
// Switch to video mode // Switch to video mode
UiObject changeModeToCapture = new UiObject(new UiSelector().descriptionMatches("Switch to Video Camera")); UiObject changeModeToCapture = new UiObject(new UiSelector().descriptionMatches("Switch to Video Camera"));
changeModeToCapture.click(); changeModeToCapture.click();
sleep(sleepTime); sleepSeconds(sleepTime);
UiObject clickRecordingButton = new UiObject(new UiSelector().descriptionMatches("Shutter")); UiObject clickRecordingButton = new UiObject(new UiSelector().descriptionMatches("Shutter"));
clickRecordingButton.longClick(); clickRecordingButton.longClick();
sleep(recordingTime); sleepSeconds(recordingTime);
// Stop video recording // Stop video recording
clickRecordingButton.longClick(); clickRecordingButton.longClick();

View File

@ -41,21 +41,21 @@ public class UiAutomation extends BaseUiAutomation {
.className("android.widget.TextView")); .className("android.widget.TextView"));
text_bench.click(); text_bench.click();
sleep(2); sleepSeconds(2);
try{ try{
UiObject stop_text = new UiObject(selector.textContains("Benchmarking ...") UiObject stop_text = new UiObject(selector.textContains("Benchmarking ...")
.className("android.widget.TextView")); .className("android.widget.TextView"));
waitUntilNoObject(stop_text, 600); waitUntilNoObject(stop_text, 600);
sleep(2); sleepSeconds(2);
}finally{ }finally{
takeScreenshot("cf-bench"); takeScreenshot("cf-bench");
} }
UiScrollable res = new UiScrollable(new UiSelector());//.scrollable(true)); UiScrollable res = new UiScrollable(new UiSelector());//.scrollable(true));
res.flingToEnd(10); res.flingToEnd(10);
sleep(2); sleepSeconds(2);
getAutomationSupport().sendStatus(Activity.RESULT_OK, status); getAutomationSupport().sendStatus(Activity.RESULT_OK, status);
} }

View File

@ -58,7 +58,7 @@ public class UiAutomation extends BaseUiAutomation {
logInButton.clickAndWaitForNewWindow(timeout); logInButton.clickAndWaitForNewWindow(timeout);
sleep(timeout); sleepSeconds(timeout);
//Click on message logo //Click on message logo
UiObject messageLogo = new UiObject(new UiSelector() UiObject messageLogo = new UiObject(new UiSelector()
@ -78,7 +78,7 @@ public class UiAutomation extends BaseUiAutomation {
.className("android.widget.RelativeLayout").index(1))); .className("android.widget.RelativeLayout").index(1)));
clickMessage.clickAndWaitForNewWindow(timeout); clickMessage.clickAndWaitForNewWindow(timeout);
sleep(timeout); sleepSeconds(timeout);
UiObject sendMessage = new UiObject(new UiSelector() UiObject sendMessage = new UiObject(new UiSelector()
.className("android.widget.FrameLayout").index(4) .className("android.widget.FrameLayout").index(4)
@ -89,7 +89,7 @@ public class UiAutomation extends BaseUiAutomation {
.text("Write a message"))); .text("Write a message")));
sendMessage.click(); sendMessage.click();
sleep(timeout); sleepSeconds(timeout);
UiObject editMessage = new UiObject(new UiSelector() UiObject editMessage = new UiObject(new UiSelector()
.className("android.widget.EditText").text("Write a message")); .className("android.widget.EditText").text("Write a message"));
@ -101,9 +101,9 @@ public class UiAutomation extends BaseUiAutomation {
sendButton.click(); sendButton.click();
getUiDevice().pressDPadDown(); getUiDevice().pressDPadDown();
sleep(timeout); sleepSeconds(timeout);
getUiDevice().pressBack(); getUiDevice().pressBack();
sleep(timeout); sleepSeconds(timeout);
getUiDevice().pressBack(); getUiDevice().pressBack();
//Check for notifications //Check for notifications
@ -124,9 +124,9 @@ public class UiAutomation extends BaseUiAutomation {
.className("android.widget.LinearLayout").index(1))); .className("android.widget.LinearLayout").index(1)));
clickNotify.clickAndWaitForNewWindow(timeout); clickNotify.clickAndWaitForNewWindow(timeout);
sleep(timeout); sleepSeconds(timeout);
getUiDevice().pressBack(); getUiDevice().pressBack();
sleep(timeout); sleepSeconds(timeout);
getUiDevice().pressBack(); getUiDevice().pressBack();
//Search for the facebook account //Search for the facebook account
@ -155,21 +155,21 @@ public class UiAutomation extends BaseUiAutomation {
editSearch.clearTextField(); editSearch.clearTextField();
editSearch.setText("amol kamble"); editSearch.setText("amol kamble");
sleep(timeout); sleepSeconds(timeout);
UiObject clickOnSearchResult = new UiObject(new UiSelector() UiObject clickOnSearchResult = new UiObject(new UiSelector()
.className("android.webkit.WebView").index(0)); .className("android.webkit.WebView").index(0));
clickOnSearchResult.clickTopLeft(); clickOnSearchResult.clickTopLeft();
sleep(2 * timeout); sleepSeconds(2 * timeout);
getUiDevice().pressBack(); getUiDevice().pressBack();
sleep(timeout); sleepSeconds(timeout);
getUiDevice().pressBack(); getUiDevice().pressBack();
clickBar.click(); clickBar.click();
sleep(timeout); sleepSeconds(timeout);
//Click on find friends //Click on find friends
UiObject clickFriends = new UiObject(new UiSelector() UiObject clickFriends = new UiObject(new UiSelector()
@ -188,7 +188,7 @@ public class UiAutomation extends BaseUiAutomation {
UiObject friends = clickFriends.getChild(new UiSelector() UiObject friends = clickFriends.getChild(new UiSelector()
.className("android.widget.RelativeLayout").index(3)); .className("android.widget.RelativeLayout").index(3));
friends.click(); friends.click();
sleep(timeout); sleepSeconds(timeout);
getUiDevice().pressBack(); getUiDevice().pressBack();
//Update the status //Update the status

View File

@ -146,16 +146,16 @@ public class UiAutomation extends UxPerfUiAutomation {
public void scrollThroughResults() throws Exception { public void scrollThroughResults() throws Exception {
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
getUiDevice().pressKeyCode(KeyEvent.KEYCODE_PAGE_DOWN); getUiDevice().pressKeyCode(KeyEvent.KEYCODE_PAGE_DOWN);
sleep(1); sleepSeconds(1);
getUiDevice().pressKeyCode(KeyEvent.KEYCODE_PAGE_DOWN); getUiDevice().pressKeyCode(KeyEvent.KEYCODE_PAGE_DOWN);
sleep(1); sleepSeconds(1);
getUiDevice().pressKeyCode(KeyEvent.KEYCODE_PAGE_DOWN); getUiDevice().pressKeyCode(KeyEvent.KEYCODE_PAGE_DOWN);
sleep(1); sleepSeconds(1);
getUiDevice().pressKeyCode(KeyEvent.KEYCODE_PAGE_DOWN); getUiDevice().pressKeyCode(KeyEvent.KEYCODE_PAGE_DOWN);
} }
public void shareResults() throws Exception { public void shareResults() throws Exception {
sleep(2); // transition sleepSeconds(2); // transition
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
getUiDevice().pressMenu(); getUiDevice().pressMenu();
UiObject shareButton = new UiObject(selector.text("Share") UiObject shareButton = new UiObject(selector.text("Share")

View File

@ -151,7 +151,7 @@ public class UiAutomation extends BaseUiAutomation {
public void extractResults() throws Exception { public void extractResults() throws Exception {
Log.v(TAG, "Extracting results."); Log.v(TAG, "Extracting results.");
sleep(2); // wait for the results screen to fully load. sleepSeconds(2); // wait for the results screen to fully load.
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
UiObject fpsText = new UiObject(selector.className("android.widget.TextView") UiObject fpsText = new UiObject(selector.className("android.widget.TextView")
.textContains("fps") .textContains("fps")

View File

@ -49,7 +49,7 @@ public class UiAutomation extends UxPerfUiAutomation {
packageName = parameters.getString("package"); packageName = parameters.getString("package");
packageID = packageName + ":id/"; packageID = packageName + ":id/";
sleep(5); // Pause while splash screen loads sleepSeconds(5); // Pause while splash screen loads
setScreenOrientation(ScreenOrientation.NATURAL); setScreenOrientation(ScreenOrientation.NATURAL);
dismissWelcomeView(); dismissWelcomeView();
closePromotionPopUp(); closePromotionPopUp();
@ -104,13 +104,13 @@ public class UiAutomation extends UxPerfUiAutomation {
UiObject workingFolder = UiObject workingFolder =
new UiObject(new UiSelector().text("wa-working")); new UiObject(new UiSelector().text("wa-working"));
if (!workingFolder.exists()) { if (!workingFolder.exists()) {
sleep(1); sleepSeconds(1);
uiDeviceSwipeLeft(10); uiDeviceSwipeLeft(10);
sleep(1); sleepSeconds(1);
uiDeviceSwipeLeft(10); uiDeviceSwipeLeft(10);
sleep(1); sleepSeconds(1);
uiDeviceSwipeLeft(10); uiDeviceSwipeLeft(10);
sleep(1); sleepSeconds(1);
} }
} }

View File

@ -141,9 +141,9 @@ public class UiAutomation extends UxPerfUiAutomation {
endButton.click(); endButton.click();
// Select a random sample book to add to My library // Select a random sample book to add to My library
sleep(1); sleepSeconds(1);
tapDisplayCentre(); tapDisplayCentre();
sleep(1); sleepSeconds(1);
// Click done button (uses same resource-id) // Click done button (uses same resource-id)
endButton.click(); endButton.click();
@ -204,7 +204,7 @@ public class UiAutomation extends UxPerfUiAutomation {
while (!label.exists()) { while (!label.exists()) {
if (searchTime > 0) { if (searchTime > 0) {
uiDeviceSwipeDown(100); uiDeviceSwipeDown(100);
sleep(1); sleepSeconds(1);
searchTime--; searchTime--;
} else { } else {
throw new UiObjectNotFoundException( throw new UiObjectNotFoundException(
@ -503,7 +503,7 @@ public class UiAutomation extends UxPerfUiAutomation {
} }
} }
sleep(2); sleepSeconds(2);
tapDisplayCentre(); // exit reader settings dialog tapDisplayCentre(); // exit reader settings dialog
waitForPage(); waitForPage();
} }
@ -539,7 +539,7 @@ public class UiAutomation extends UxPerfUiAutomation {
.focusable(true))); .focusable(true)));
// On some devices the object in the view hierarchy is found before it // On some devices the object in the view hierarchy is found before it
// becomes visible on the screen. Therefore add pause instead. // becomes visible on the screen. Therefore add pause instead.
sleep(3); sleepSeconds(3);
if (!activityReader.waitForExists(viewTimeout)) { if (!activityReader.waitForExists(viewTimeout)) {
throw new UiObjectNotFoundException("Could not find \"activity reader view\"."); throw new UiObjectNotFoundException("Could not find \"activity reader view\".");
@ -554,7 +554,7 @@ public class UiAutomation extends UxPerfUiAutomation {
new UiObject(new UiSelector().resourceId(packageID + "action_bar")); new UiObject(new UiSelector().resourceId(packageID + "action_bar"));
if (!actionBar.exists()) { if (!actionBar.exists()) {
tapDisplayCentre(); tapDisplayCentre();
sleep(1); // Allow previous views to settle sleepSeconds(1); // Allow previous views to settle
} }
UiObject card = UiObject card =
@ -570,11 +570,11 @@ public class UiAutomation extends UxPerfUiAutomation {
int y = (int)(getDisplayCentreHeight() * 0.8); int y = (int)(getDisplayCentreHeight() * 0.8);
while (card.exists()) { while (card.exists()) {
tapDisplay(x, y); tapDisplay(x, y);
sleep(1); sleepSeconds(1);
} }
tapDisplay(x, y); tapDisplay(x, y);
sleep(1); // Allow previous views to settle sleepSeconds(1); // Allow previous views to settle
} }
if (!actionBar.exists()) { if (!actionBar.exists()) {
@ -587,7 +587,7 @@ public class UiAutomation extends UxPerfUiAutomation {
new UiObject(new UiSelector().resourceId(packageID + "action_bar")); new UiObject(new UiSelector().resourceId(packageID + "action_bar"));
if (actionBar.exists()) { if (actionBar.exists()) {
tapDisplayCentre(); tapDisplayCentre();
sleep(1); // Allow previous views to settle sleepSeconds(1); // Allow previous views to settle
} }
if (actionBar.exists()) { if (actionBar.exists()) {

View File

@ -61,13 +61,13 @@ public class UiAutomation extends UxPerfUiAutomation {
changeAckTimeout(100); changeAckTimeout(100);
// UI automation begins here // UI automation begins here
skipWelcomeScreen(); skipWelcomeScreen();
sleep(1); sleepSeconds(1);
dismissWorkOfflineBanner(); dismissWorkOfflineBanner();
sleep(1); sleepSeconds(1);
enablePowerpointCompat(); enablePowerpointCompat();
sleep(1); sleepSeconds(1);
testEditNewSlidesDocument(newDocumentName, workingDirectoryName, doTextEntry); testEditNewSlidesDocument(newDocumentName, workingDirectoryName, doTextEntry);
sleep(1); sleepSeconds(1);
// Open document // Open document
openDocument(pushedDocumentName, workingDirectoryName); openDocument(pushedDocumentName, workingDirectoryName);
waitForProgress(WAIT_TIMEOUT_1SEC*30); waitForProgress(WAIT_TIMEOUT_1SEC*30);
@ -312,19 +312,19 @@ public class UiAutomation extends UxPerfUiAutomation {
enterTextInSlide(".*[Tt]itle.*", docName); enterTextInSlide(".*[Tt]itle.*", docName);
// Save // Save
saveDocument(docName); saveDocument(docName);
sleep(1); sleepSeconds(1);
} }
// Slide 2 - Image // Slide 2 - Image
insertSlide("Title only"); insertSlide("Title only");
insertImage(workingDirectoryName); insertImage(workingDirectoryName);
sleep(1); sleepSeconds(1);
// If text wasn't entered in first slide, save prompt will appear here // If text wasn't entered in first slide, save prompt will appear here
if (!doTextEntry) { if (!doTextEntry) {
// Save // Save
saveDocument(docName); saveDocument(docName);
sleep(1); sleepSeconds(1);
} }
// Slide 3 - Shape // Slide 3 - Shape
@ -333,7 +333,7 @@ public class UiAutomation extends UxPerfUiAutomation {
insertShape(shapeName); insertShape(shapeName);
modifyShape(shapeName); modifyShape(shapeName);
getUiDevice().pressBack(); getUiDevice().pressBack();
sleep(1); sleepSeconds(1);
// Tidy up // Tidy up
getUiDevice().pressBack(); getUiDevice().pressBack();
@ -366,7 +366,7 @@ public class UiAutomation extends UxPerfUiAutomation {
waitForProgress(WAIT_TIMEOUT_1SEC*5); waitForProgress(WAIT_TIMEOUT_1SEC*5);
} }
logger.stop(); logger.stop();
sleep(1); sleepSeconds(1);
// scroll backward in edit mode // scroll backward in edit mode
logger = new ActionLogger(testTag + "_editbackward", parameters); logger = new ActionLogger(testTag + "_editbackward", parameters);
@ -376,7 +376,7 @@ public class UiAutomation extends UxPerfUiAutomation {
waitForProgress(WAIT_TIMEOUT_1SEC*5); waitForProgress(WAIT_TIMEOUT_1SEC*5);
} }
logger.stop(); logger.stop();
sleep(1); sleepSeconds(1);
// run slideshow // run slideshow
logger = new ActionLogger(testTag + "_run", parameters); logger = new ActionLogger(testTag + "_run", parameters);
@ -392,7 +392,7 @@ public class UiAutomation extends UxPerfUiAutomation {
presentation.waitForExists(WAIT_TIMEOUT_1SEC*30); presentation.waitForExists(WAIT_TIMEOUT_1SEC*30);
} }
logger.stop(); logger.stop();
sleep(1); sleepSeconds(1);
slideIndex = 0; slideIndex = 0;
@ -404,7 +404,7 @@ public class UiAutomation extends UxPerfUiAutomation {
waitForProgress(WAIT_TIMEOUT_1SEC*5); waitForProgress(WAIT_TIMEOUT_1SEC*5);
} }
logger.stop(); logger.stop();
sleep(1); sleepSeconds(1);
// scroll backward in slideshow mode // scroll backward in slideshow mode
logger = new ActionLogger(testTag + "_playbackward", parameters); logger = new ActionLogger(testTag + "_playbackward", parameters);
@ -414,7 +414,7 @@ public class UiAutomation extends UxPerfUiAutomation {
waitForProgress(WAIT_TIMEOUT_1SEC*5); waitForProgress(WAIT_TIMEOUT_1SEC*5);
} }
logger.stop(); logger.stop();
sleep(1); sleepSeconds(1);
getUiDevice().pressBack(); getUiDevice().pressBack();
getUiDevice().pressBack(); getUiDevice().pressBack();

View File

@ -85,7 +85,7 @@ public class UiAutomation extends BaseUiAutomation {
writer.println(urlAddress); writer.println(urlAddress);
break; break;
} }
sleep(10); sleepSeconds(10);
} }
} else if (browser.equals("chrome")) { // Code for Chrome browser } else if (browser.equals("chrome")) { // Code for Chrome browser
UiObject adressBar = new UiObject(new UiSelector() UiObject adressBar = new UiObject(new UiSelector()
@ -106,7 +106,7 @@ public class UiAutomation extends BaseUiAutomation {
writer.println(urlAddress); writer.println(urlAddress);
break; break;
} }
sleep(10); sleepSeconds(10);
} }
} }
writer.close(); writer.close();

View File

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.arm.wlauto.uiauto.skype; package com.arm.wlauto.uiauto.skype;
import android.os.Bundle; import android.os.Bundle;
@ -194,6 +193,6 @@ public class UiAutomation extends UxPerfUiAutomation {
new UiObject(new UiSelector().descriptionContains("Mute")); new UiObject(new UiSelector().descriptionContains("Mute"));
muteButton.click(); muteButton.click();
sleep(duration); sleepSeconds(duration);
} }
} }

View File

@ -37,7 +37,7 @@ public class UiAutomation extends BaseUiAutomation {
Bundle status = new Bundle(); Bundle status = new Bundle();
status.putString("product", getUiDevice().getProductName()); status.putString("product", getUiDevice().getProductName());
UiSelector selector = new UiSelector(); UiSelector selector = new UiSelector();
sleep(3); sleepSeconds(3);
UiObject text_bench = new UiObject(selector.text("Run SmartBench") UiObject text_bench = new UiObject(selector.text("Run SmartBench")
.className("android.widget.TextView")); .className("android.widget.TextView"));
text_bench.click(); text_bench.click();
@ -48,13 +48,13 @@ public class UiAutomation extends BaseUiAutomation {
waitObject(complete_text); waitObject(complete_text);
sleep(2); sleepSeconds(2);
complete_text.click(); complete_text.click();
} finally{ } finally{
//complete_text.click(); //complete_text.click();
} }
sleep(5); sleepSeconds(5);
takeScreenshot("SmartBench"); takeScreenshot("SmartBench");
getAutomationSupport().sendStatus(Activity.RESULT_OK, status); getAutomationSupport().sendStatus(Activity.RESULT_OK, status);
} }

View File

@ -48,7 +48,7 @@ public class UiAutomation extends BaseUiAutomation {
.className("android.widget.Button")); .className("android.widget.Button"));
waitUntilNoObject(stop_text, 600); waitUntilNoObject(stop_text, 600);
sleep(2); sleepSeconds(2);
this.extractResults(); this.extractResults();
} finally { } finally {
} }
@ -94,7 +94,7 @@ public class UiAutomation extends BaseUiAutomation {
if (!label.exists()){ if (!label.exists()){
resultList.scrollForward(); resultList.scrollForward();
index--; index--;
sleep(1); sleepSeconds(1);
continue; continue;
} }
Log.v("sqlite", label.getText() + " = " + value.getText().replace("\n", " ")); Log.v("sqlite", label.getText() + " = " + value.getText().replace("\n", " "));

View File

@ -178,9 +178,9 @@ public class UiAutomation extends BaseUiAutomation {
throw new UiObjectNotFoundException("Could not find \"Swipe screen\"."); throw new UiObjectNotFoundException("Could not find \"Swipe screen\".");
} }
} }
sleep(1); sleepSeconds(1);
swipeScreen.swipeLeft(2); swipeScreen.swipeLeft(2);
sleep(1); sleepSeconds(1);
swipeScreen.swipeLeft(2); swipeScreen.swipeLeft(2);
} }

View File

@ -121,7 +121,7 @@ public class UiAutomation extends BaseUiAutomation {
UiObject videoCurrentTime = new UiObject(new UiSelector() UiObject videoCurrentTime = new UiObject(new UiSelector()
.className("android.widget.TextView").index(0)); .className("android.widget.TextView").index(0));
sleep(samplingInterval); sleepSeconds(samplingInterval);
// Handle the time taken by the getText function // Handle the time taken by the getText function
timeBeforeGetText = new Date().getTime() / 1000; timeBeforeGetText = new Date().getTime() / 1000;
@ -146,7 +146,7 @@ public class UiAutomation extends BaseUiAutomation {
} }
} else { } else {
sleep(videoTime); sleepSeconds(videoTime);
} }
getUiDevice().pressBack(); getUiDevice().pressBack();
getUiDevice().pressHome(); getUiDevice().pressHome();

View File

@ -182,7 +182,7 @@ public class UiAutomation extends UxPerfUiAutomation {
new UiObject(new UiSelector().textContains("Skip ad")); new UiObject(new UiSelector().textContains("Skip ad"));
if (skip.waitForExists(WAIT_TIMEOUT_1SEC*5)) { if (skip.waitForExists(WAIT_TIMEOUT_1SEC*5)) {
skip.click(); skip.click();
sleep(VIDEO_SLEEP_SECONDS); sleepSeconds(VIDEO_SLEEP_SECONDS);
} }
} }
} }
@ -199,11 +199,11 @@ public class UiAutomation extends UxPerfUiAutomation {
public void pausePlayVideo() throws Exception { public void pausePlayVideo() throws Exception {
UiObject player = getUiObjectByResourceId(packageID + "player_fragment_container"); UiObject player = getUiObjectByResourceId(packageID + "player_fragment_container");
sleep(VIDEO_SLEEP_SECONDS); sleepSeconds(VIDEO_SLEEP_SECONDS);
repeatClickUiObject(player, 2, 100); repeatClickUiObject(player, 2, 100);
sleep(1); // pause the video momentarily sleepSeconds(1); // pause the video momentarily
player.click(); player.click();
sleep(VIDEO_SLEEP_SECONDS); sleepSeconds(VIDEO_SLEEP_SECONDS);
} }
public void checkVideoInfo() throws Exception { public void checkVideoInfo() throws Exception {
@ -237,6 +237,6 @@ public class UiAutomation extends UxPerfUiAutomation {
} }
// After flinging, give the window enough time to settle down before // After flinging, give the window enough time to settle down before
// the next step, or else UiAutomator fails to find views in time // the next step, or else UiAutomator fails to find views in time
sleep(VIDEO_SLEEP_SECONDS); sleepSeconds(VIDEO_SLEEP_SECONDS);
} }
} }