mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-03-21 01:59:13 +00:00
Dumpsys instrumentation
This commit is contained in:
parent
2d84b02352
commit
9415d6d2dc
Binary file not shown.
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
package com.arm.wlauto.uiauto.googleslides;
|
package com.arm.wlauto.uiauto.googleslides;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -34,6 +35,9 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
public static final String TAG = "googleslides";
|
public static final String TAG = "googleslides";
|
||||||
public static final String PACKAGE = "com.google.android.apps.docs.editors.slides";
|
public static final String PACKAGE = "com.google.android.apps.docs.editors.slides";
|
||||||
public static final String PACKAGE_ID = PACKAGE + ":id/";
|
public static final String PACKAGE_ID = PACKAGE + ":id/";
|
||||||
|
public static final String ACTIVITY_DOCLIST = "com.google.android.apps.docs.app.DocListActivity";
|
||||||
|
public static final String ACTIVITY_SLIDES = "com.qo.android.quickpoint.Quickpoint";
|
||||||
|
public static final String ACTIVITY_SETTINGS = "com.google.android.apps.docs.app.DocsPreferencesActivity";
|
||||||
|
|
||||||
public static final String CLASS_TEXT_VIEW = "android.widget.TextView";
|
public static final String CLASS_TEXT_VIEW = "android.widget.TextView";
|
||||||
public static final String CLASS_IMAGE_VIEW = "android.widget.ImageView";
|
public static final String CLASS_IMAGE_VIEW = "android.widget.ImageView";
|
||||||
@ -92,6 +96,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
parameters = getParams();
|
parameters = getParams();
|
||||||
parseParams(parameters);
|
parseParams(parameters);
|
||||||
skipWelcomeScreen();
|
skipWelcomeScreen();
|
||||||
|
openAndCloseDrawer();
|
||||||
enablePowerpointCompat();
|
enablePowerpointCompat();
|
||||||
if (useLocalFile) {
|
if (useLocalFile) {
|
||||||
testSlideshowFromStorage(localFile);
|
testSlideshowFromStorage(localFile);
|
||||||
@ -110,15 +115,29 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void enablePowerpointCompat() throws Exception {
|
protected void openAndCloseDrawer() throws Exception {
|
||||||
|
startDumpsys(ACTIVITY_DOCLIST);
|
||||||
timer = new Timer();
|
timer = new Timer();
|
||||||
timer.start();
|
timer.start();
|
||||||
uiDeviceSwipeHorizontal(0, getDisplayWidth()/2, getDisplayHeight()/2);
|
clickView(BY_DESC, "drawer");
|
||||||
|
getUiDevice().pressBack();
|
||||||
|
timer.end();
|
||||||
|
results.put("open_drawer", timer);
|
||||||
|
endDumpsys(ACTIVITY_DOCLIST, "open_drawer");
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void enablePowerpointCompat() throws Exception {
|
||||||
|
startDumpsys(ACTIVITY_SETTINGS);
|
||||||
|
timer = new Timer();
|
||||||
|
timer.start();
|
||||||
|
clickView(BY_DESC, "drawer");
|
||||||
clickView(BY_TEXT, "Settings", true);
|
clickView(BY_TEXT, "Settings", true);
|
||||||
clickView(BY_TEXT, "Create PowerPoint");
|
clickView(BY_TEXT, "Create PowerPoint");
|
||||||
getUiDevice().pressBack();
|
getUiDevice().pressBack();
|
||||||
timer.end();
|
timer.end();
|
||||||
results.put("enable_ppt_compat", timer);
|
results.put("enable_ppt_compat", timer);
|
||||||
|
endDumpsys(ACTIVITY_SETTINGS, "enable_ppt_compat");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,6 +183,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
int slidesLeft = slideCount - 1;
|
int slidesLeft = slideCount - 1;
|
||||||
|
|
||||||
// scroll forward in edit mode
|
// scroll forward in edit mode
|
||||||
|
startDumpsys(ACTIVITY_SLIDES);
|
||||||
timer = new Timer();
|
timer = new Timer();
|
||||||
timer.start();
|
timer.start();
|
||||||
while (slidesLeft-- > 0) {
|
while (slidesLeft-- > 0) {
|
||||||
@ -172,9 +192,11 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
}
|
}
|
||||||
timer.end();
|
timer.end();
|
||||||
results.put("slides_forward", timer);
|
results.put("slides_forward", timer);
|
||||||
|
endDumpsys(ACTIVITY_SLIDES, "slides_forward");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
// scroll backward in edit mode
|
// scroll backward in edit mode
|
||||||
|
startDumpsys(ACTIVITY_SLIDES);
|
||||||
timer = new Timer();
|
timer = new Timer();
|
||||||
timer.start();
|
timer.start();
|
||||||
while (++slidesLeft < slideCount - 1) {
|
while (++slidesLeft < slideCount - 1) {
|
||||||
@ -183,9 +205,11 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
}
|
}
|
||||||
timer.end();
|
timer.end();
|
||||||
results.put("slides_reverse", timer);
|
results.put("slides_reverse", timer);
|
||||||
|
endDumpsys(ACTIVITY_SLIDES, "slides_reverse");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
// scroll forward in slideshow mode
|
// scroll forward in slideshow mode
|
||||||
|
startDumpsys(ACTIVITY_SLIDES);
|
||||||
timer = new Timer();
|
timer = new Timer();
|
||||||
timer.start();
|
timer.start();
|
||||||
clickView(BY_DESC, "Start slideshow", true);
|
clickView(BY_DESC, "Start slideshow", true);
|
||||||
@ -195,6 +219,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
}
|
}
|
||||||
timer.end();
|
timer.end();
|
||||||
results.put("play_slideshow", timer);
|
results.put("play_slideshow", timer);
|
||||||
|
endDumpsys(ACTIVITY_SLIDES, "play_slideshow");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
getUiDevice().pressBack();
|
getUiDevice().pressBack();
|
||||||
@ -202,6 +227,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void testEditNewSlidesDocument(String docName) throws Exception {
|
protected void testEditNewSlidesDocument(String docName) throws Exception {
|
||||||
|
startDumpsys(ACTIVITY_DOCLIST);
|
||||||
// create new file
|
// create new file
|
||||||
timer = new Timer();
|
timer = new Timer();
|
||||||
timer.start();
|
timer.start();
|
||||||
@ -209,12 +235,13 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
clickView(BY_TEXT, "New PowerPoint", true);
|
clickView(BY_TEXT, "New PowerPoint", true);
|
||||||
timer.end();
|
timer.end();
|
||||||
results.put("create_document", timer);
|
results.put("create_document", timer);
|
||||||
|
endDumpsys(ACTIVITY_DOCLIST, "create_document");
|
||||||
|
|
||||||
// first slide
|
// first slide
|
||||||
enterTextInSlide("Title", "WORKLOAD AUTOMATION");
|
enterTextInSlide("Title", "WORKLOAD AUTOMATION");
|
||||||
enterTextInSlide("Subtitle", "Measuring perfomance of different productivity apps on Android OS");
|
enterTextInSlide("Subtitle", "Measuring perfomance of different productivity apps on Android OS");
|
||||||
saveDocument(docName);
|
saveDocument(docName);
|
||||||
|
/*
|
||||||
insertSlide("Title and Content");
|
insertSlide("Title and Content");
|
||||||
enterTextInSlide("title", "Introduction");
|
enterTextInSlide("title", "Introduction");
|
||||||
enterTextInSlide("Text placeholder", "Welcome to Documentation for Workload Automation");
|
enterTextInSlide("Text placeholder", "Welcome to Documentation for Workload Automation");
|
||||||
@ -223,7 +250,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
"Workload Automation (WA) is a framework for running workloads on real hardware devices. "
|
"Workload Automation (WA) is a framework for running workloads on real hardware devices. "
|
||||||
+ "WA supports a number of output formats as well as additional instrumentation "
|
+ "WA supports a number of output formats as well as additional instrumentation "
|
||||||
+ "(such as Streamline traces). A number of workloads are included with the framework.");
|
+ "(such as Streamline traces). A number of workloads are included with the framework.");
|
||||||
|
*/
|
||||||
insertSlide("Title and Content");
|
insertSlide("Title and Content");
|
||||||
enterTextInSlide("title", "Extensions - Workloads");
|
enterTextInSlide("title", "Extensions - Workloads");
|
||||||
enterTextInSlide("Text placeholder", DOCUMENTATION_WORKLOADS);
|
enterTextInSlide("Text placeholder", DOCUMENTATION_WORKLOADS);
|
||||||
@ -235,7 +262,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
UiObject decreaseFont = getViewByDesc("Decrease text");
|
UiObject decreaseFont = getViewByDesc("Decrease text");
|
||||||
repeatClickView(decreaseFont, 20);
|
repeatClickView(decreaseFont, 20);
|
||||||
getUiDevice().pressBack();
|
getUiDevice().pressBack();
|
||||||
|
/*
|
||||||
insertSlide("Title and Content");
|
insertSlide("Title and Content");
|
||||||
enterTextInSlide("title", "Agendas - Intro");
|
enterTextInSlide("title", "Agendas - Intro");
|
||||||
enterTextInSlide("Text placeholder", DOCUMENTATION_AGENDAS_1);
|
enterTextInSlide("Text placeholder", DOCUMENTATION_AGENDAS_1);
|
||||||
@ -243,13 +270,18 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
insertSlide("Title and Content");
|
insertSlide("Title and Content");
|
||||||
enterTextInSlide("title", "Agendas - Uses");
|
enterTextInSlide("title", "Agendas - Uses");
|
||||||
enterTextInSlide("Text placeholder", DOCUMENTATION_AGENDAS_2);
|
enterTextInSlide("Text placeholder", DOCUMENTATION_AGENDAS_2);
|
||||||
|
*/
|
||||||
// get first image in gallery and insert
|
// get image from gallery and insert
|
||||||
insertSlide("Title Only");
|
insertSlide("Title Only");
|
||||||
clickView(BY_DESC, "Insert");
|
clickView(BY_DESC, "Insert");
|
||||||
clickView(BY_TEXT, "Image", true);
|
clickView(BY_TEXT, "Image", true);
|
||||||
clickView(BY_TEXT, "Recent");
|
clickView(BY_TEXT, "Recent");
|
||||||
clickView(BY_ID, "com.android.documentsui:id/date", true);
|
try {
|
||||||
|
UiObject image = new UiObject(new UiSelector().resourceId("com.android.documentsui:id/date").instance(2));
|
||||||
|
image.clickAndWaitForNewWindow();
|
||||||
|
} catch (UiObjectNotFoundException e) {
|
||||||
|
clickView(BY_ID, "com.android.documentsui:id/date", true);
|
||||||
|
}
|
||||||
|
|
||||||
// last slide
|
// last slide
|
||||||
insertSlide("Title Slide");
|
insertSlide("Title Slide");
|
||||||
@ -271,7 +303,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void insertSlide(String slideLayout) throws Exception {
|
public void insertSlide(String slideLayout) throws Exception {
|
||||||
sleep(2); // a bit of time to see previous slide
|
sleep(1); // a bit of time to see previous slide
|
||||||
UiObject view = getViewByDesc("Insert slide");
|
UiObject view = getViewByDesc("Insert slide");
|
||||||
view.clickAndWaitForNewWindow();
|
view.clickAndWaitForNewWindow();
|
||||||
view = getViewByText(slideLayout);
|
view = getViewByText(slideLayout);
|
||||||
@ -415,4 +447,19 @@ public class UiAutomation extends UxPerfUiAutomation {
|
|||||||
public void uiDeviceSwipeHorizontal(int startX, int endX, int height, int steps) {
|
public void uiDeviceSwipeHorizontal(int startX, int endX, int height, int steps) {
|
||||||
getUiDevice().swipe(startX, height, endX, height, steps);
|
getUiDevice().swipe(startX, height, endX, height, steps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void startDumpsys(String viewName) throws Exception {
|
||||||
|
if (!dumpsysEnabled)
|
||||||
|
return;
|
||||||
|
initDumpsysSurfaceFlinger(PACKAGE, viewName);
|
||||||
|
initDumpsysGfxInfo(PACKAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void endDumpsys(String viewName, String testTag) throws Exception {
|
||||||
|
if (!dumpsysEnabled)
|
||||||
|
return;
|
||||||
|
String dumpsysTag = TAG + "_" + testTag;
|
||||||
|
exitDumpsysSurfaceFlinger(PACKAGE, viewName, new File(outputDir, dumpsysTag + "_surfFlinger.log"));
|
||||||
|
exitDumpsysGfxInfo(PACKAGE, new File(outputDir, dumpsysTag + "_gfxInfo.log"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user