mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-02 19:32:34 +01:00
Minor code maintenance for base class BaseUiAutomation
- Rename inconsistently named variables - Avoid long wrapped lines where possible - Fix whitespace around operators
This commit is contained in:
@@ -86,10 +86,10 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
|
|
||||||
public boolean takeScreenshot(String name) {
|
public boolean takeScreenshot(String name) {
|
||||||
Bundle params = getParams();
|
Bundle params = getParams();
|
||||||
String png_dir = params.getString("workdir");
|
String pngDir = params.getString("workdir");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return getUiDevice().takeScreenshot(new File(png_dir, name + ".png"));
|
return getUiDevice().takeScreenshot(new File(pngDir, name + ".png"));
|
||||||
} catch (NoSuchMethodError e) {
|
} catch (NoSuchMethodError e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -101,9 +101,9 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
|
|
||||||
public void waitText(String text, int second) throws UiObjectNotFoundException {
|
public void waitText(String text, int second) throws UiObjectNotFoundException {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject text_obj = new UiObject(selector.text(text)
|
UiObject textObj = new UiObject(selector.text(text)
|
||||||
.className("android.widget.TextView"));
|
.className("android.widget.TextView"));
|
||||||
waitObject(text_obj, second);
|
waitObject(textObj, second);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void waitObject(UiObject obj) throws UiObjectNotFoundException {
|
public void waitObject(UiObject obj) throws UiObjectNotFoundException {
|
||||||
@@ -152,7 +152,8 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
process.destroy();
|
process.destroy();
|
||||||
|
|
||||||
if ((currentTime - startTime) >= timeout) {
|
if ((currentTime - startTime) >= timeout) {
|
||||||
throw new TimeoutException("Timed out waiting for Logcat text \"%s\"".format(searchText));
|
throw new TimeoutException(String.format("Timed out waiting for Logcat text \"%s\"",
|
||||||
|
searchText));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user