mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-04-13 14:20:50 +01:00
Changes after review pull of #5
This commit is contained in:
parent
01568d8184
commit
4f5fdd6439
@ -63,8 +63,6 @@ class SkypeEcho(AndroidUiAutoBenchmark):
|
||||
description='This is the duration of the call in seconds'),
|
||||
Parameter('action', kind=str, allowed_values=['voice', 'video'], default='video',
|
||||
description='Action to take - either video (default) or voice call'),
|
||||
Parameter('use_gui', kind=bool, default=True,
|
||||
description='Specifies whether to use GUI or direct Skype URI'),
|
||||
Parameter('dumpsys_enabled', kind=bool, default=True,
|
||||
description='''
|
||||
If ``True``, dumpsys captures will be carried out during the test run.
|
||||
@ -82,35 +80,23 @@ class SkypeEcho(AndroidUiAutoBenchmark):
|
||||
self.uiauto_params['results_file'] = self.output_file
|
||||
self.uiauto_params['dumpsys_enabled'] = self.dumpsys_enabled
|
||||
self.uiauto_params['output_dir'] = self.device.working_directory
|
||||
if self.use_gui:
|
||||
self.uiauto_params['my_id'] = self.login_name
|
||||
self.uiauto_params['my_pwd'] = self.login_pass
|
||||
self.uiauto_params['skypeid'] = self.contact_skypeid
|
||||
self.uiauto_params['name'] = self.contact_name.replace(' ', '_')
|
||||
self.uiauto_params['duration'] = self.duration
|
||||
self.uiauto_params['action'] = self.action
|
||||
self.uiauto_params['my_id'] = self.login_name
|
||||
self.uiauto_params['my_pwd'] = self.login_pass
|
||||
self.uiauto_params['skypeid'] = self.contact_skypeid
|
||||
self.uiauto_params['name'] = self.contact_name.replace(' ', '_')
|
||||
self.uiauto_params['duration'] = self.duration
|
||||
self.uiauto_params['action'] = self.action
|
||||
|
||||
def setup(self, context):
|
||||
self.logger.info('===== setup() ======')
|
||||
if self.use_gui:
|
||||
super(SkypeEcho, self).setup(context)
|
||||
self.device.execute('am force-stop {}'.format(self.package))
|
||||
self.device.execute('am start -W -a android.intent.action.VIEW -d skype:dummy?dummy')
|
||||
time.sleep(1)
|
||||
else:
|
||||
self.device.execute('am force-stop {}'.format(self.package))
|
||||
super(SkypeEcho, self).setup(context)
|
||||
self.device.execute('am force-stop {}'.format(self.package))
|
||||
self.device.execute('am start -W -a android.intent.action.VIEW -d skype:dummy?dummy')
|
||||
time.sleep(1)
|
||||
|
||||
def run(self, context):
|
||||
self.logger.info('===== run() ======')
|
||||
if self.use_gui:
|
||||
super(SkypeEcho, self).run(context)
|
||||
else:
|
||||
data_uri = 'skype:{}?{}'.format(self.contact_skypeid, SKYPE_ACTION_URIS[self.action])
|
||||
command = 'am start -W -a android.intent.action.VIEW -d "{}"'.format(data_uri)
|
||||
self.logger.debug(self.device.execute(command))
|
||||
self.logger.debug('Call started; waiting for {} seconds...'.format(self.duration))
|
||||
time.sleep(self.duration)
|
||||
self.device.execute('am force-stop {}'.format(self.package))
|
||||
super(SkypeEcho, self).run(context)
|
||||
|
||||
def update_result(self, context):
|
||||
self.logger.info('===== update_result() ======')
|
||||
@ -140,4 +126,3 @@ class SkypeEcho(AndroidUiAutoBenchmark):
|
||||
if entry.startswith(self.name) and entry.endswith(".log"):
|
||||
self.device.pull_file(op.join(wd, entry), context.output_directory)
|
||||
self.device.delete_file(op.join(wd, entry))
|
||||
# self.device.execute('am force-stop {}'.format(self.package))
|
||||
|
Binary file not shown.
@ -10,3 +10,4 @@ workloads:
|
||||
contact_name: {{contact_name}}
|
||||
duration: {{duration}}
|
||||
action: {{action}}
|
||||
dumpsys_enabled: {{dumpsys_enabled}}
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
class_dir=bin/classes/com/arm/wlauto/uiauto
|
||||
base_class=`python -c "import os, wlauto; print os.path.join(os.path.dirname(wlauto.__file__), 'common', 'android', '*.class')"`
|
||||
base_classes=`python -c "import os, wlauto; print os.path.join(os.path.dirname(wlauto.__file__), 'common', 'android', '*.class')"`
|
||||
mkdir -p $class_dir
|
||||
cp $base_class $class_dir
|
||||
cp $base_classes $class_dir
|
||||
|
||||
ant build
|
||||
|
||||
|
@ -11,4 +11,4 @@
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-21
|
||||
target=android-18
|
||||
|
@ -30,44 +30,12 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
public static final String PACKAGE_ID = "com.skype.raider:id/";
|
||||
public static final String TEXT_VIEW = "android.widget.TextView";
|
||||
|
||||
public static String sendSmsButtonResourceId = PACKAGE_ID + "chat_menu_item_send_sms";
|
||||
public static String voiceCallButtonResourceId = PACKAGE_ID + "chat_menu_item_call_voice";
|
||||
public static String videoCallButtonResourceId = PACKAGE_ID + "chat_menu_item_call_video";
|
||||
public static String endCallButtonResourceId = PACKAGE_ID + "call_end_button";
|
||||
public static String noContactMessage = "Could not find contact \"%s\" in the contacts list.";
|
||||
|
||||
private Map<String, Timer> results = new TreeMap<String, Timer>();
|
||||
private boolean dumpsysEnabled;
|
||||
private String outputDir;
|
||||
|
||||
private static Arguments args;
|
||||
|
||||
private static final class Arguments {
|
||||
String loginName;
|
||||
String loginPass;
|
||||
String contactSkypeid;
|
||||
String contactName;
|
||||
int callDuration;
|
||||
String callType;
|
||||
String resultsFile;
|
||||
String outputDir;
|
||||
boolean dumpsysEnabled;
|
||||
}
|
||||
|
||||
private static Arguments parseBundle(Bundle bundle) {
|
||||
Arguments args = new Arguments();
|
||||
args.loginName = bundle.getString("my_id");
|
||||
args.loginPass = bundle.getString("my_pwd");
|
||||
args.contactSkypeid = bundle.getString("skypeid");
|
||||
args.contactName = bundle.getString("name").replace("_", " ");
|
||||
args.callDuration = Integer.parseInt(bundle.getString("duration"));
|
||||
args.callType = bundle.getString("action");
|
||||
args.resultsFile = bundle.getString("results_file");
|
||||
args.outputDir = bundle.getString("output_dir");
|
||||
args.dumpsysEnabled = Boolean.parseBoolean(bundle.getString("dumpsys_enabled"));
|
||||
return args;
|
||||
}
|
||||
|
||||
public void runUiAutomation() throws Exception {
|
||||
// Override superclass value
|
||||
this.waitTimeout = 10000;
|
||||
@ -76,7 +44,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
Bundle parameters = getParams();
|
||||
String loginName = parameters.getString("my_id");
|
||||
String loginPass = parameters.getString("my_pwd");
|
||||
String contactSkypeid = parameters.getString("skypeid");
|
||||
String contactSkypeId = parameters.getString("skypeid");
|
||||
String contactName = parameters.getString("name").replace("_", " ");
|
||||
int callDuration = Integer.parseInt(parameters.getString("duration"));
|
||||
String callType = parameters.getString("action");
|
||||
@ -85,19 +53,15 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
dumpsysEnabled = Boolean.parseBoolean(parameters.getString("dumpsys_enabled"));
|
||||
|
||||
// Run tests
|
||||
Timer overallTimer = new Timer();
|
||||
overallTimer.start();
|
||||
handleLoginScreen(loginName, loginPass);
|
||||
selectContact(contactName, contactSkypeid);
|
||||
selectContact(contactName, contactSkypeId);
|
||||
if ("video".equalsIgnoreCase(callType)) {
|
||||
videoCallTest(callDuration);
|
||||
} else if ("voice".equalsIgnoreCase(callType)) {
|
||||
voiceCallTest(callDuration);
|
||||
}
|
||||
overallTimer.end();
|
||||
|
||||
// Save results
|
||||
results.put("overall_test", overallTimer);
|
||||
saveResults(results, resultsFile);
|
||||
}
|
||||
|
||||
@ -124,13 +88,10 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
useridField.setText(username);
|
||||
nextButton.clickAndWaitForNewWindow();
|
||||
|
||||
String skypenameResoureId = PACKAGE_ID + "signin_skypename";
|
||||
String passwordResoureId = PACKAGE_ID + "signin_password";
|
||||
String signinButtonResourceId = PACKAGE_ID + "sign_in_btn";
|
||||
// UiObject skypenameField = new UiObject(new UiSelector().resourceId(skypenameResoureId));
|
||||
UiObject passwordField = new UiObject(new UiSelector().resourceId(passwordResoureId));
|
||||
UiObject signinButton = new UiObject(new UiSelector().resourceId(signinButtonResourceId));
|
||||
// skypenameField.setText(username);
|
||||
passwordField.setText(password);
|
||||
signinButton.clickAndWaitForNewWindow();
|
||||
}
|
||||
@ -141,7 +102,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
UiObject peopleTab;
|
||||
// Open the 'People' tab aka contacts view
|
||||
// On phones, it is represented by an image with description
|
||||
// On tablets, it the full text is shown without a description
|
||||
// On tablets, the full text is shown without a description
|
||||
try {
|
||||
peopleTab = getUiObjectByDescription("People", TEXT_VIEW);
|
||||
} catch (UiObjectNotFoundException e) {
|
||||
@ -156,7 +117,6 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
contactCard = getUiObjectByText(name, TEXT_VIEW);
|
||||
} catch (UiObjectNotFoundException e) {
|
||||
contactCard = getUiObjectByText(name, TEXT_VIEW);
|
||||
// contactCard = getUiObjectByText(id, TEXT_VIEW);
|
||||
}
|
||||
contactCard.clickAndWaitForNewWindow();
|
||||
timer.end();
|
||||
@ -189,14 +149,10 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
initDumpsysGfxInfo(PACKAGE);
|
||||
}
|
||||
|
||||
// String resource = video ? videoCallButtonResourceId : voiceCallButtonResourceId;
|
||||
// UiObject callButton = new UiObject(new UiSelector().resourceId(resource));
|
||||
String description = video ? "Video call" : "Call options";
|
||||
UiObject callButton = new UiObject(new UiSelector().descriptionContains(description));
|
||||
callButton.click();
|
||||
// callButton.clickAndWaitForNewWindow();
|
||||
sleep(duration);
|
||||
// endCall();
|
||||
|
||||
if (video && dumpsysEnabled) {
|
||||
exitDumpsysSurfaceFlinger(PACKAGE, viewName, new File(outputDir, dumpsysTag + "_surface_flinger.log"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user