1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-20 17:48:44 +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 = """ description = """
A workload to perform standard productivity tasks with googlephotos. A workload to perform standard productivity tasks with googlephotos.
The workload carries out various tasks, such as browsing images, performing zooms, The workload carries out various tasks, such as browsing images, performing
postprocessing and saving a selected image to file. 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 NOTE: This workload requires four jpeg files to be placed in the
dependencies directory to run. dependencies directory to run.
@ -73,12 +80,9 @@ class Googlephotos(AndroidUiAutoBenchmark):
for line in wfh: for line in wfh:
match = regex.search(line) match = regex.search(line)
if match: if match:
context.result.add_metric((match.group('key') + "_start"), context.result.add_metric((match.group('key') + "_start"), match.group('value1'))
match.group('value1')) context.result.add_metric((match.group('key') + "_finish"), match.group('value2'))
context.result.add_metric((match.group('key') + "_finish"), context.result.add_metric((match.group('key') + "_duration"), match.group('value3'))
match.group('value2'))
context.result.add_metric((match.group('key') + "_duration"),
match.group('value3'))
def teardown(self, context): def teardown(self, context):
super(Googlephotos, self).teardown(context) super(Googlephotos, self).teardown(context)

View File

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