1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-14 14:48:53 +00:00

Modify googlephotos after reliability testing

Improve workload  description in __init__.py.
Add saveAndReturn convenience method.
Remove confirmLocalFileAccess method.
This commit is contained in:
John Richardson 2016-05-08 13:43:46 +01:00
parent 3b898125b0
commit 2bee9f4f66
3 changed files with 37 additions and 51 deletions

View File

@ -13,8 +13,15 @@ class Googlephotos(AndroidUiAutoBenchmark):
description = """
A workload to perform standard productivity tasks with googlephotos.
The workload carries out various tasks, such as browsing images, performing zooms,
postprocessing and saving a selected image to file.
The workload carries out various tasks, such as browsing images, performing
zooms, post-processing and saving a selected image to file.
gesture test - browsing through the wa-working gallery using swipe
gestures and performing pinch gestures for zooming
color test - selects a photograph, increments, resets and decrements color balance
crop test - uses image straightener facility to simultaneously rotate and
crop a selected photograph
rotate tests - selects a photograph and performs 90 degree rotations
NOTE: This workload requires four jpeg files to be placed in the
dependencies directory to run.
@ -73,12 +80,9 @@ class Googlephotos(AndroidUiAutoBenchmark):
for line in wfh:
match = regex.search(line)
if match:
context.result.add_metric((match.group('key') + "_start"),
match.group('value1'))
context.result.add_metric((match.group('key') + "_finish"),
match.group('value2'))
context.result.add_metric((match.group('key') + "_duration"),
match.group('value3'))
context.result.add_metric((match.group('key') + "_start"), match.group('value1'))
context.result.add_metric((match.group('key') + "_finish"), match.group('value2'))
context.result.add_metric((match.group('key') + "_duration"), match.group('value3'))
def teardown(self, context):
super(Googlephotos, self).teardown(context)

View File

@ -28,7 +28,6 @@ public class UiAutomation extends UxPerfUiAutomation {
public void runUiAutomation() throws Exception {
parameters = getParams();
confirmLocalFileAccess();
dismissWelcomeView();
gesturesTest();
editPhotoColorTest();
@ -38,15 +37,6 @@ public class UiAutomation extends UxPerfUiAutomation {
writeResultsToFile(timingResults, parameters.getString("output_file"));
}
private void confirmLocalFileAccess() throws Exception {
// First time run requires confirmation to allow access to local files
UiObject allowButton = new UiObject(new UiSelector().textContains("Allow")
.className("android.widget.Button"));
if (allowButton.waitForExists(timeout)) {
allowButton.clickAndWaitForNewWindow(timeout);
}
}
private void dismissWelcomeView() throws Exception {
// Click through the first two pages and make sure that we don't sign
@ -59,7 +49,6 @@ public class UiAutomation extends UxPerfUiAutomation {
new UiObject(new UiSelector().textContains("Get started")
.className("android.widget.Button"));
tapDisplayCentre();
waitObject(getStartedButton, viewTimeoutSecs);
getStartedButton.clickAndWaitForNewWindow();
@ -228,20 +217,15 @@ public class UiAutomation extends UxPerfUiAutomation {
timingResults.put(runName, result);
}
UiObject accept = getUiObjectByDescription("Accept", "android.widget.ImageView");
accept.click();
UiObject save = getUiObjectByText("SAVE", "android.widget.TextView");
save.waitForExists(viewTimeout);
save.click();
// Return to application home screen
getUiDevice().pressBack();
saveAndReturn();
}
private void cropPhotoTest() throws Exception {
String testTag = "crop_photo";
// To improve travel accuracy perform the slide bar operation slowly
final int steps = 500;
// Perform a range of swipe tests while browsing photo gallery
LinkedHashMap<String, Position> testParams = new LinkedHashMap<String, Position>();
testParams.put("tilt_positive", Position.LEFT);
@ -270,14 +254,14 @@ public class UiAutomation extends UxPerfUiAutomation {
Position pos = pair.getValue();
String runName = String.format(TAG + "_" + testTag + "_" + pair.getKey());
String gfxInfologName = String.format(runName + "_" + runName + "_gfxInfo.log");
String gfxInfologName = String.format(runName + "_gfxInfo.log");
String surfFlingerlogName = String.format(runName + "_surfFlinger.log");
startDumpsysGfxInfo(parameters);
startDumpsysSurfaceFlinger(parameters, viewName);
Timer result = new Timer();
result = slideBarTest(straightenSlider , pos, 100);
result = slideBarTest(straightenSlider , pos, steps);
stopDumpsysSurfaceFlinger(parameters, viewName, surfFlingerlogName);
stopDumpsysGfxInfo(parameters, gfxInfologName);
@ -285,15 +269,7 @@ public class UiAutomation extends UxPerfUiAutomation {
timingResults.put(runName, result);
}
UiObject accept = getUiObjectByDescription("Accept", "android.widget.ImageView");
accept.click();
UiObject save = getUiObjectByText("SAVE", "android.widget.TextView");
save.waitForExists(viewTimeout);
save.click();
// Return to application home screen
getUiDevice().pressBack();
saveAndReturn();
}
private void rotatePhotoTest() throws Exception {
@ -335,15 +311,7 @@ public class UiAutomation extends UxPerfUiAutomation {
timingResults.put(runName, result);
}
UiObject accept = getUiObjectByDescription("Accept", "android.widget.ImageView");
accept.click();
UiObject save = getUiObjectByText("SAVE", "android.widget.TextView");
save.waitForExists(viewTimeout);
save.click();
// Return to application home screen
getUiDevice().pressBack();
saveAndReturn();
}
// Helper to slide the seekbar during photo edit.
@ -354,7 +322,6 @@ public class UiAutomation extends UxPerfUiAutomation {
Timer result = new Timer();
result.start();
switch (pos) {
case LEFT:
getUiDevice().click(rect.left + SWIPE_MARGIN_LIMIT, rect.centerY());
@ -383,12 +350,12 @@ public class UiAutomation extends UxPerfUiAutomation {
switch (pos) {
case LEFT:
getUiDevice().drag(rect.left + SWIPE_MARGIN_LIMIT , rect.centerY(),
getUiDevice().drag(rect.left + SWIPE_MARGIN_LIMIT, rect.centerY(),
rect.left + rect.width() / 4, rect.centerY(),
steps);
break;
case RIGHT:
getUiDevice().drag(rect.right - SWIPE_MARGIN_LIMIT , rect.centerY(),
getUiDevice().drag(rect.right - SWIPE_MARGIN_LIMIT, rect.centerY(),
rect.right - rect.width() / 4, rect.centerY(),
steps);
break;
@ -411,4 +378,19 @@ public class UiAutomation extends UxPerfUiAutomation {
.index(index)));
photo.click();
}
// Helper that accepts, saves and navigates back to application home screen after an edit operation
private void saveAndReturn() throws Exception {
UiObject accept = getUiObjectByDescription("Accept", "android.widget.ImageView");
accept.click();
UiObject save = getUiObjectByText("SAVE", "android.widget.TextView");
save.waitForExists(viewTimeout);
save.click();
UiObject navigateUpButton =
getUiObjectByDescription("Navigate Up", "android.widget.ImageButton");
navigateUpButton.click();
}
}