1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-04 04:12:42 +01:00

Merge pull request #31 from jimboatarm/discover_view

Add logic to dumpsys helpers to discover present view
This commit is contained in:
jimboatarm
2016-05-26 12:58:54 +01:00
16 changed files with 122 additions and 54 deletions

View File

@@ -116,8 +116,6 @@ public class UiAutomation extends UxPerfUiAutomation {
// Select first photograph
selectPhoto(0);
String viewName = "com.google.android.apps.photos.localmedia.ui.LocalPhotosActivity";
while (it.hasNext()) {
Map.Entry<String, GestureTestParams> pair = it.next();
GestureType type = pair.getValue().gestureType;
@@ -137,7 +135,7 @@ public class UiAutomation extends UxPerfUiAutomation {
}
startDumpsysGfxInfo(parameters);
startDumpsysSurfaceFlinger(parameters, viewName);
startDumpsysSurfaceFlinger(parameters);
Timer result = new Timer();
@@ -155,7 +153,7 @@ public class UiAutomation extends UxPerfUiAutomation {
break;
}
stopDumpsysSurfaceFlinger(parameters, viewName, surfFlingerlogName);
stopDumpsysSurfaceFlinger(parameters, surfFlingerlogName);
stopDumpsysGfxInfo(parameters, gfxInfologName);
timingResults.put(runName, result);
@@ -214,8 +212,6 @@ public class UiAutomation extends UxPerfUiAutomation {
UiObject seekBar = getUiObjectByResourceId("com.google.android.apps.photos:id/cpe_strength_seek_bar",
"android.widget.SeekBar");
String viewName = "com.google.android.apps.consumerphotoeditor.fragments.ConsumerPhotoEditorActivity";
while (it.hasNext()) {
Map.Entry<String, SeekBarTestParams> pair = it.next();
Position pos = pair.getValue().seekBarPosition;
@@ -227,12 +223,12 @@ public class UiAutomation extends UxPerfUiAutomation {
String surfFlingerlogName = String.format(runName + "_surfFlinger.log");
startDumpsysGfxInfo(parameters);
startDumpsysSurfaceFlinger(parameters, viewName);
startDumpsysSurfaceFlinger(parameters);
Timer result = new Timer();
result = seekBarTest(seekBar, pos, steps);
stopDumpsysSurfaceFlinger(parameters, viewName, surfFlingerlogName);
stopDumpsysSurfaceFlinger(parameters, surfFlingerlogName);
stopDumpsysGfxInfo(parameters, gfxInfologName);
timingResults.put(runName, result);
@@ -268,8 +264,6 @@ public class UiAutomation extends UxPerfUiAutomation {
UiObject straightenSlider = getUiObjectByResourceId("com.google.android.apps.photos:id/cpe_straighten_slider",
"android.view.View");
String viewName = "com.google.android.apps.consumerphotoeditor.fragments.ConsumerPhotoEditorActivity";
while (it.hasNext()) {
Map.Entry<String, Position> pair = it.next();
Position pos = pair.getValue();
@@ -279,12 +273,12 @@ public class UiAutomation extends UxPerfUiAutomation {
String surfFlingerlogName = String.format(runName + "_surfFlinger.log");
startDumpsysGfxInfo(parameters);
startDumpsysSurfaceFlinger(parameters, viewName);
startDumpsysSurfaceFlinger(parameters);
Timer result = new Timer();
result = slideBarTest(straightenSlider, pos, steps);
stopDumpsysSurfaceFlinger(parameters, viewName, surfFlingerlogName);
stopDumpsysSurfaceFlinger(parameters, surfFlingerlogName);
stopDumpsysGfxInfo(parameters, gfxInfologName);
timingResults.put(runName, result);
@@ -311,22 +305,20 @@ public class UiAutomation extends UxPerfUiAutomation {
UiObject rotate = getUiObjectByResourceId("com.google.android.apps.photos:id/cpe_rotate_90",
"android.widget.ImageView");
String viewName = "com.google.android.apps.consumerphotoeditor.fragments.ConsumerPhotoEditorActivity";
for (String subTest : subTests) {
String runName = String.format(testTag + "_" + subTest);
String gfxInfologName = String.format(runName + "_gfxInfo.log");
String surfFlingerlogName = String.format(runName + "_surfFlinger.log");
startDumpsysGfxInfo(parameters);
startDumpsysSurfaceFlinger(parameters, viewName);
startDumpsysSurfaceFlinger(parameters);
Timer result = new Timer();
result.start();
rotate.click();
result.end();
stopDumpsysSurfaceFlinger(parameters, viewName, surfFlingerlogName);
stopDumpsysSurfaceFlinger(parameters, surfFlingerlogName);
stopDumpsysGfxInfo(parameters, gfxInfologName);
timingResults.put(runName, result);

View File

@@ -51,9 +51,10 @@ public class UiAutomation extends UxPerfUiAutomation {
confirmAccess();
gesturesTest("Getting Started.pdf");
String[] searchStrings = {"Glossary", "cortex"};
searchPdfTest("cortex_m4", searchStrings);
String filename = "Getting Started.pdf";
gesturesTest(filename);
String[] searchStrings = {"read", "the"};
searchPdfTest(filename, searchStrings);
unsetScreenOrientation();
@@ -61,8 +62,14 @@ public class UiAutomation extends UxPerfUiAutomation {
}
private void dismissWelcomeView() throws Exception {
UiObject welcomeView = getUiObjectByDescription("Acrobat - First Time Experience",
"android.webkit.WebView");
UiObject welcomeView;
try {
welcomeView = getUiObjectByDescription("Acrobat - First Time Experience",
"android.webkit.WebView");
} catch (UiObjectNotFoundException e) {
welcomeView = new UiObject(new UiSelector().className("android.webkit.WebView"));
}
// Click through the first two pages and wait for pages to transition.
// These pages are webkit views so clickAndWaitForNewWindow or waitForExists cannot be used
tapDisplayCentre();
@@ -73,13 +80,13 @@ public class UiAutomation extends UxPerfUiAutomation {
// Get the box coords for the webView window
Rect webViewCoords = welcomeView.getBounds();
// Iterate up from the bottom middle of the webView until we hit these
// Continue button and change view
// Iterate up from the bottom of the webView until we hit the continue
// button and change view
int i = 0;
do {
i += 10;
tapDisplay(webViewCoords.centerX(), webViewCoords.centerY() + i);
} while (welcomeView.exists() || i < webViewCoords.top);
tapDisplay(webViewCoords.centerX(), webViewCoords.bottom - i);
} while (welcomeView.exists() && i < webViewCoords.top);
}
private void signInOnline(Bundle parameters) throws Exception {
@@ -147,6 +154,7 @@ public class UiAutomation extends UxPerfUiAutomation {
String file = filename.replaceAll("\\.", "_").replaceAll("\\s+", "_");
timingResults.put(String.format(TestTag + "_" + "selectLocalFilesList" + "_" + file), selectLocalFilesList());
// On some devices permissions to access local files occurs here rather than the earlier step
confirmAccess();
timingResults.put(String.format(TestTag + "_" + "selectSearchDuration" + "_" + file), selectSearchFileButton());
@@ -165,7 +173,7 @@ public class UiAutomation extends UxPerfUiAutomation {
UiObject localButton = getUiObjectByText("LOCAL", "android.widget.TextView");
Timer result = new Timer();
result.start();
localButton.clickAndWaitForNewWindow(timeout);
localButton.click();
long finish = SystemClock.elapsedRealtime();
result.end();
return result;
@@ -239,12 +247,11 @@ public class UiAutomation extends UxPerfUiAutomation {
String runName = String.format(TestTag + "_" + pair.getKey());
String gfxInfologName = String.format(runName + "_gfxInfo.log");
String surfFlingerlogName = String.format(runName + "_surfFlinger.log");
String viewName = new String("com.adobe.reader.viewer.ARViewerActivity");
UiObject view = new UiObject(new UiSelector().resourceId("com.adobe.reader:id/viewPager"));
startDumpsysGfxInfo(parameters);
startDumpsysSurfaceFlinger(parameters, viewName);
startDumpsysSurfaceFlinger(parameters);
Timer results = new Timer();
@@ -262,7 +269,7 @@ public class UiAutomation extends UxPerfUiAutomation {
break;
}
stopDumpsysSurfaceFlinger(parameters, viewName, surfFlingerlogName);
stopDumpsysSurfaceFlinger(parameters, surfFlingerlogName);
stopDumpsysGfxInfo(parameters, gfxInfologName);
timingResults.put(runName, results);

View File

@@ -157,10 +157,9 @@ public class UiAutomation extends UxPerfUiAutomation {
}
private void makeCall(int duration, boolean video, String testTag) throws Exception {
String viewName = "com.skype.android.app.calling.CallActivity";
String dumpsysTag = TAG + "_" + testTag;
if (video && dumpsysEnabled) {
initDumpsysSurfaceFlinger(PACKAGE, viewName);
initDumpsysSurfaceFlinger(PACKAGE);
initDumpsysGfxInfo(PACKAGE);
}
@@ -170,7 +169,7 @@ public class UiAutomation extends UxPerfUiAutomation {
sleep(duration);
if (video && dumpsysEnabled) {
exitDumpsysSurfaceFlinger(PACKAGE, viewName, new File(outputDir, dumpsysTag + "_surfFlinger.log"));
exitDumpsysSurfaceFlinger(PACKAGE, new File(outputDir, dumpsysTag + "_surfFlinger.log"));
exitDumpsysGfxInfo(PACKAGE, new File(outputDir, dumpsysTag + "_gfxInfo.log"));
}
}