1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-03-25 20:18:47 +00:00

Merge pull request #356 from marcbonnici/uiautomator

UIAutomator
This commit is contained in:
setrofim 2017-02-20 17:47:03 +00:00 committed by GitHub
commit 96c6f010f8
42 changed files with 402 additions and 71 deletions

View File

@ -27,7 +27,7 @@ from wlauto.common.android.resources import ApkFile, ReventFile
from wlauto.common.resources import ExtensionAsset, Executable, File
from wlauto.exceptions import WorkloadError, ResourceError, DeviceError
from wlauto.utils.android import ApkInfo, ANDROID_NORMAL_PERMISSIONS, UNSUPPORTED_PACKAGES
from wlauto.utils.types import boolean
from wlauto.utils.types import boolean, ParameterDict
from wlauto.utils.revent import ReventRecording
import wlauto.utils.statedetect as state_detector
import wlauto.common.android.resources
@ -35,6 +35,7 @@ import wlauto.common.android.resources
DELAY = 5
# Due to the way `super` works you have to call it at every level but WA executes some
# methods conditionally and so has to call them directly via the class, this breaks super
# and causes it to run things mutiple times ect. As a work around for this untill workloads
@ -81,7 +82,7 @@ class UiAutomatorWorkload(Workload):
self.uiauto_file = None
self.device_uiauto_file = None
self.command = None
self.uiauto_params = {}
self.uiauto_params = ParameterDict()
def init_resources(self, context):
self.uiauto_file = context.resolver.get(wlauto.common.android.resources.JarFile(self))
@ -98,7 +99,7 @@ class UiAutomatorWorkload(Workload):
params_dict = self.uiauto_params
params_dict['workdir'] = self.device.working_directory
params = ''
for k, v in self.uiauto_params.iteritems():
for k, v in self.uiauto_params.iter_encoded_items():
params += ' -e {} "{}"'.format(k, v)
self.command = 'uiautomator runtest {}{} -c {}'.format(self.device_uiauto_file, params, method_string)
self.device.push_file(self.uiauto_file, self.device_uiauto_file)
@ -238,13 +239,30 @@ class ApkWorkload(Workload):
if self.apk_file or self.exact_abi:
break
host_version = self.check_host_version()
self.verify_apk_version(target_version, target_abi, host_version)
if self.force_install:
self.force_install_apk(context, host_version)
elif self.check_apk:
self.prefer_host_apk(context, host_version, target_version)
else:
self.prefer_target_apk(context, host_version, target_version)
self.reset(context)
self.apk_version = self.device.get_installed_package_version(self.package)
context.add_classifiers(apk_version=self.apk_version)
def check_host_version(self):
host_version = None
if self.apk_file is not None:
host_version = ApkInfo(self.apk_file).version_name
if host_version:
host_version = LooseVersion(host_version)
self.logger.debug("Found version '{}' on host".format(host_version))
return host_version
def verify_apk_version(self, target_version, target_abi, host_version):
# Error if apk was not found anywhere
if target_version is None and host_version is None:
msg = "Could not find APK for '{}' on the host or target device"
@ -261,18 +279,6 @@ class ApkWorkload(Workload):
msg = "APK abi '{}' not found on the host and target is '{}'"
raise ResourceError(msg.format(self.device.abi, target_abi))
# Ensure the apk is setup on the device
if self.force_install:
self.force_install_apk(context, host_version)
elif self.check_apk:
self.prefer_host_apk(context, host_version, target_version)
else:
self.prefer_target_apk(context, host_version, target_version)
self.reset(context)
self.apk_version = self.device.get_installed_package_version(self.package)
context.add_classifiers(apk_version=self.apk_version)
def launch_application(self):
if self.launch_main:
self.launch_package() # launch default activity without intent data

View File

@ -84,7 +84,7 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
public ActionLogger(String testTag, Bundle parameters) {
this.testTag = testTag;
this.enabled = Boolean.parseBoolean(parameters.getString("markers_enabled"));
this.enabled = parameters.getBoolean("markers_enabled");
}
public void start() {
@ -619,4 +619,96 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
throw new UiObjectNotFoundException("Could not find folder : " + directory);
}
}
// Override getParams function to decode a url encoded parameter bundle before
// passing it to workloads.
public Bundle getParams() {
// Get the original parameter bundle
Bundle parameters = super.getParams();
// Decode each parameter in the bundle, except null values and "jars", as this
// is automatically added and therefore not encoded.
for (String key : parameters.keySet()) {
String param = parameters.getString(key);
if (param != null && !key.equals("jars")) {
param = android.net.Uri.decode(param);
parameters = decode(parameters, key, param);
}
}
return parameters;
}
// Helper function to decode a string and insert it as an appropriate type
// into a provided bundle with its key.
// Each bundle parameter will be a urlencoded string with 2 characters prefixed to the value
// used to store the original type information, e.g. 'fl' -> list of floats.
private Bundle decode(Bundle parameters, String key, String value) {
char value_type = value.charAt(0);
char value_dimension = value.charAt(1);
String param = value.substring(2);
if (value_dimension == 's') {
if (value_type == 's') {
parameters.putString(key, param);
} else if (value_type == 'f') {
parameters.putFloat(key, Float.parseFloat(param));
} else if (value_type == 'd') {
parameters.putDouble(key, Double.parseDouble(param));
} else if (value_type == 'b') {
parameters.putBoolean(key, Boolean.parseBoolean(param));
} else if (value_type == 'i') {
parameters.putInt(key, Integer.parseInt(param));
} else if (value_type == 'n') {
parameters.putString(key, "None");
} else {
throw new IllegalArgumentException("Error decoding:" + key + value
+ " - unknown format");
}
} else if (value_dimension == 'l') {
return decodeArray(parameters, key, value_type, param);
} else {
throw new IllegalArgumentException("Error decoding:" + key + value
+ " - unknown format");
}
return parameters;
}
// Helper function to deal with decoding arrays and update the bundle with
// an appropriate array type. The string "0newelement0" is used to distinguish
// each element for each other in the array when encoded.
private Bundle decodeArray(Bundle parameters, String key, char type, String value) {
String[] string_list = value.split("0newelement0");
if (type == 's') {
parameters.putStringArray(key, string_list);
}
else if (type == 'i') {
int[] int_list = new int[string_list.length];
for (int i = 0; i < string_list.length; i++){
int_list[i] = Integer.parseInt(string_list[i]);
}
parameters.putIntArray(key, int_list);
} else if (type == 'f') {
float[] float_list = new float[string_list.length];
for (int i = 0; i < string_list.length; i++){
float_list[i] = Float.parseFloat(string_list[i]);
}
parameters.putFloatArray(key, float_list);
} else if (type == 'd') {
double[] double_list = new double[string_list.length];
for (int i = 0; i < string_list.length; i++){
double_list[i] = Double.parseDouble(string_list[i]);
}
parameters.putDoubleArray(key, double_list);
} else if (type == 'b') {
boolean[] boolean_list = new boolean[string_list.length];
for (int i = 0; i < string_list.length; i++){
boolean_list[i] = Boolean.parseBoolean(string_list[i]);
}
parameters.putBooleanArray(key, boolean_list);
} else {
throw new IllegalArgumentException("Error decoding array: " +
value + " - unknown format");
}
return parameters;
}
}

View File

@ -17,11 +17,12 @@
# pylint: disable=R0201
from unittest import TestCase
from nose.tools import raises, assert_equal, assert_not_equal # pylint: disable=E0611
from nose.tools import raises, assert_equal, assert_not_equal, assert_true # pylint: disable=E0611
from wlauto.utils.android import check_output
from wlauto.utils.misc import merge_dicts, merge_lists, TimeoutError
from wlauto.utils.types import list_or_integer, list_or_bool, caseless_string, arguments
from wlauto.utils.types import (list_or_integer, list_or_bool, caseless_string, arguments,
ParameterDict)
class TestCheckOutput(TestCase):
@ -88,3 +89,126 @@ class TestTypes(TestCase):
assert_equal(arguments('--foo 7 --bar "fizz buzz"'),
['--foo', '7', '--bar', 'fizz buzz'])
assert_equal(arguments(['test', 42]), ['test', '42'])
class TestParameterDict(TestCase):
# Define test parameters
orig_params = {
'string' : 'A Test String',
'string_list' : ['A Test', 'List', 'With', '\n in.'],
'bool_list' : [False, True, True],
'int' : 42,
'float' : 1.23,
'long' : long(987),
'none' : None,
}
def setUp(self):
self.params = ParameterDict()
self.params['string'] = self.orig_params['string']
self.params['string_list'] = self.orig_params['string_list']
self.params['bool_list'] = self.orig_params['bool_list']
self.params['int'] = self.orig_params['int']
self.params['float'] = self.orig_params['float']
self.params['long'] = self.orig_params['long']
self.params['none'] = self.orig_params['none']
# Test values are encoded correctly
def test_getEncodedItems(self):
encoded = {
'string' : 'ssA%20Test%20String',
'string_list' : 'slA%20Test0newelement0List0newelement0With0newelement0%0A%20in.',
'bool_list' : 'blFalse0newelement0True0newelement0True',
'int' : 'is42',
'float' : 'fs1.23',
'long' : 'ds987',
'none' : 'nsNone',
}
# Test iter_encoded_items
for k, v in self.params.iter_encoded_items():
assert_equal(v, encoded[k])
# Test get single encoded value
assert_equal(self.params.get_encoded_value('string'), encoded['string'])
assert_equal(self.params.get_encoded_value('string_list'), encoded['string_list'])
assert_equal(self.params.get_encoded_value('bool_list'), encoded['bool_list'])
assert_equal(self.params.get_encoded_value('int'), encoded['int'])
assert_equal(self.params.get_encoded_value('float'), encoded['float'])
assert_equal(self.params.get_encoded_value('long'), encoded['long'])
assert_equal(self.params.get_encoded_value('none'), encoded['none'])
# Test it behaves like a normal dict
def test_getitem(self):
assert_equal(self.params['string'], self.orig_params['string'])
assert_equal(self.params['string_list'], self.orig_params['string_list'])
assert_equal(self.params['bool_list'], self.orig_params['bool_list'])
assert_equal(self.params['int'], self.orig_params['int'])
assert_equal(self.params['float'], self.orig_params['float'])
assert_equal(self.params['long'], self.orig_params['long'])
assert_equal(self.params['none'], self.orig_params['none'])
def test_get(self):
assert_equal(self.params.get('string'), self.orig_params['string'])
assert_equal(self.params.get('string_list'), self.orig_params['string_list'])
assert_equal(self.params.get('bool_list'), self.orig_params['bool_list'])
assert_equal(self.params.get('int'), self.orig_params['int'])
assert_equal(self.params.get('float'), self.orig_params['float'])
assert_equal(self.params.get('long'), self.orig_params['long'])
assert_equal(self.params.get('none'), self.orig_params['none'])
def test_contains(self):
assert_true(self.orig_params['string'] in self.params.values())
assert_true(self.orig_params['string_list'] in self.params.values())
assert_true(self.orig_params['bool_list'] in self.params.values())
assert_true(self.orig_params['int'] in self.params.values())
assert_true(self.orig_params['float'] in self.params.values())
assert_true(self.orig_params['long'] in self.params.values())
assert_true(self.orig_params['none'] in self.params.values())
def test_pop(self):
assert_equal(self.params.pop('string'), self.orig_params['string'])
assert_equal(self.params.pop('string_list'), self.orig_params['string_list'])
assert_equal(self.params.pop('bool_list'), self.orig_params['bool_list'])
assert_equal(self.params.pop('int'), self.orig_params['int'])
assert_equal(self.params.pop('float'), self.orig_params['float'])
assert_equal(self.params.pop('long'), self.orig_params['long'])
assert_equal(self.params.pop('none'), self.orig_params['none'])
self.params['string'] = self.orig_params['string']
assert_equal(self.params.popitem(), ('string', self.orig_params['string']))
def test_iteritems(self):
for k, v in self.params.iteritems():
assert_equal(v, self.orig_params[k])
def test_parameter_dict_update(self):
params_1 = ParameterDict()
params_2 = ParameterDict()
# Test two ParameterDicts
params_1['string'] = self.orig_params['string']
params_1['string_list'] = self.orig_params['string_list']
params_1['bool_list'] = self.orig_params['bool_list']
params_2['int'] = self.orig_params['int']
params_2['float'] = self.orig_params['float']
params_2['long'] = self.orig_params['long']
params_2['none'] = self.orig_params['none']
params_1.update(params_2)
assert_equal(params_1, self.params)
# Test update with normal dict
params_3 = ParameterDict()
std_dict = dict()
params_3['string'] = self.orig_params['string']
std_dict['string_list'] = self.orig_params['string_list']
std_dict['bool_list'] = self.orig_params['bool_list']
std_dict['int'] = self.orig_params['int']
std_dict['float'] = self.orig_params['float']
std_dict['long'] = self.orig_params['long']
std_dict['none'] = self.orig_params['none']
params_3.update(std_dict)
for key in params_3.keys():
assert_equal(params_3[key], self.params[key])

View File

@ -30,6 +30,7 @@ import re
import math
import shlex
from collections import defaultdict
from urllib import quote, unquote
from wlauto.utils.misc import isiterable, to_identifier
@ -328,3 +329,119 @@ class range_dict(dict):
def __setitem__(self, i, v):
i = int(i)
super(range_dict, self).__setitem__(i, v)
class ParameterDict(dict):
"""
A dict-like object that automatically encodes various types into a url safe string,
and enforces a single type for the contents in a list.
Each value is first prefixed with 2 letters to preserve type when encoding to a string.
The format used is "value_type, value_dimension" e.g a 'list of floats' would become 'fl'.
"""
# Function to determine the appropriate prefix based on the parameters type
@staticmethod
def _get_prefix(obj):
if isinstance(obj, basestring):
prefix = 's'
elif isinstance(obj, float):
prefix = 'f'
elif isinstance(obj, long):
prefix = 'd'
elif isinstance(obj, bool):
prefix = 'b'
elif isinstance(obj, int):
prefix = 'i'
elif obj is None:
prefix = 'n'
else:
raise ValueError('Unable to encode {} {}'.format(obj, type(obj)))
return prefix
# Function to add prefix and urlencode a provided parameter.
@staticmethod
def _encode(obj):
if isinstance(obj, list):
t = type(obj[0])
prefix = ParameterDict._get_prefix(obj[0]) + 'l'
for item in obj:
if not isinstance(item, t):
msg = 'Lists must only contain a single type, contains {} and {}'
raise ValueError(msg.format(t, type(item)))
obj = '0newelement0'.join(str(x) for x in obj)
else:
prefix = ParameterDict._get_prefix(obj) + 's'
return quote(prefix + str(obj))
# Function to decode a string and return a value of the original parameter type.
# pylint: disable=too-many-return-statements
@staticmethod
def _decode(string):
value_type = string[:1]
value_dimension = string[1:2]
value = unquote(string[2:])
if value_dimension == 's':
if value_type == 's':
return str(value)
elif value_type == 'b':
return boolean(value)
elif value_type == 'd':
return long(value)
elif value_type == 'f':
return float(value)
elif value_type == 'i':
return int(value)
elif value_type == 'n':
return None
elif value_dimension == 'l':
return [ParameterDict._decode(value_type + 's' + x)
for x in value.split('0newelement0')]
else:
raise ValueError('Unknown {} {}'.format(type(string), string))
def __init__(self, *args, **kwargs):
for k, v in kwargs.iteritems():
self.__setitem__(k, v)
dict.__init__(self, *args)
def __setitem__(self, name, value):
dict.__setitem__(self, name, self._encode(value))
def __getitem__(self, name):
return self._decode(dict.__getitem__(self, name))
def __contains__(self, item):
return dict.__contains__(self, self._encode(item))
def __iter__(self):
return iter((k, self._decode(v)) for (k, v) in self.items())
def iteritems(self):
return self.__iter__()
def get(self, name):
return self[name]
def pop(self, key):
return self._decode(dict.pop(self, key))
def popitem(self):
key, value = dict.popitem(self)
return (key, self._decode(value))
def iter_encoded_items(self):
return dict.iteritems(self)
def get_encoded_value(self, name):
return dict.__getitem__(self, name)
def values(self):
return [self[k] for k in dict.keys(self)]
def update(self, *args, **kwargs):
for d in list(args) + [kwargs]:
if isinstance(d, ParameterDict):
dict.update(self, d)
else:
for k, v in d.iteritems():
self[k] = v

View File

@ -76,8 +76,8 @@ class AdobeReader(AndroidUxPerfWorkload):
def validate(self):
super(AdobeReader, self).validate()
self.uiauto_params['filename'] = self.document_name.replace(' ', '0space0')
self.uiauto_params['search_string_list'] = '0newline0'.join([x.replace(' ', '0space0') for x in self.search_string_list])
self.uiauto_params['filename'] = self.document_name
self.uiauto_params['search_string_list'] = self.search_string_list
# Only accept certain file formats
if os.path.splitext(self.document_name.lower())[1] not in ['.pdf']:
raise ValidationError('{} must be a PDF file'.format(self.document_name))

View File

@ -45,9 +45,8 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
public void runUiAutomation() throws Exception {
parameters = getParams();
String filename = parameters.getString("filename").replace("0space0", " ");
String[] searchStrings =
parameters.getString("search_string_list").replace("0space0", " ").split("0newline0");
String filename = parameters.getString("filename");
String[] searchStrings = parameters.getStringArray("search_string_list");
setScreenOrientation(ScreenOrientation.NATURAL);
runApplicationInitialization();

View File

@ -41,7 +41,7 @@ public class UiAutomation extends BaseUiAutomation {
Bundle status = new Bundle();
Bundle params = getParams();
String numThreads = params.getString("number_of_threads");
Boolean nativeOnly = Boolean.parseBoolean(params.getString("native_only"));
Boolean nativeOnly = params.getBoolean("native_only");
status.putString("product", getUiDevice().getProductName());
waitForStartButton();

View File

@ -45,9 +45,9 @@ public class UiAutomation extends BaseUiAutomation {
Bundle parameters = getParams();
String version = parameters.getString("version");
boolean enableSdTests = Boolean.parseBoolean(parameters.getString("enable_sd_tests"));
boolean enableSdTests = parameters.getBoolean("enable_sd_tests");
int times = Integer.parseInt(parameters.getString("times"));
int times = parameters.getInt("times");
if (times < 1) {
times = 1;
}

View File

@ -51,7 +51,7 @@ public class UiAutomation extends UxPerfUiAutomation {
/** Timeout to wait for application launch to finish. */
private Integer launch_timeout = 10;
public String applaunchType;
public String applaunchIterations;
public int applaunchIterations;
public String activityName;
public ApplaunchInterface launch_workload;
@ -90,15 +90,15 @@ public class UiAutomation extends UxPerfUiAutomation {
// Get parameters for application launch
getPackageParameters();
applaunchType = parameters.getString("applaunch_type");
applaunchIterations = parameters.getString("applaunch_iterations");
applaunchIterations = parameters.getInt("applaunch_iterations");
activityName = parameters.getString("launch_activity");
// Run the workload for application launch initialization
runApplaunchSetup();
// Run the workload for application launch measurement
for (int iteration = 0; iteration < Integer.parseInt(applaunchIterations); iteration++) {
Log.d("Applaunch iteration number: ", applaunchIterations);
for (int iteration = 0; iteration < applaunchIterations; iteration++) {
Log.d("Applaunch iteration number: ", String.valueOf(applaunchIterations));
sleep(20);//sleep for a while before next iteration
killBackground();
runApplaunchIteration(iteration);

View File

@ -43,11 +43,9 @@ public class UiAutomation extends BaseUiAutomation {
public void runUiAutomation() throws Exception {
Bundle parameters = getParams();
if (parameters.size() > 0) {
iterations = Integer.parseInt(parameters
.getString("no_of_captures"));
timeDurationBetweenEachCapture = Integer.parseInt(parameters
.getString("time_between_captures"));
api = Integer.parseInt(parameters.getString("api_level"));
iterations = parameters.getInt("no_of_captures");
timeDurationBetweenEachCapture = parameters.getInt("time_between_captures");
api = parameters.getInt("api_level");
String versionString = parameters.getString("version");
version = splitVersion(versionString);
}

View File

@ -45,10 +45,9 @@ public class UiAutomation extends BaseUiAutomation {
public void runUiAutomation() throws Exception {
Bundle parameters = getParams();
if (parameters.size() > 0) {
recordingTime = Integer.parseInt(parameters
.getString("recording_time"));
recordingTime = parameters.getInt("recording_time");
recordingMode = parameters.getString("recording_mode");
api = Integer.parseInt(parameters.getString("api_level"));
api = parameters.getInt("api_level");
String versionString = parameters.getString("version");
version = splitVersion(versionString);
}

View File

@ -43,8 +43,8 @@ public class UiAutomation extends BaseUiAutomation {
String version = parameters.getString("version");
String useCase = parameters.getString("use_case").replace('_', ' ');
String variant = parameters.getString("variant").replace('_', ' ');
int iterations = Integer.parseInt(parameters.getString("iterations"));
int testTimeoutSeconds = Integer.parseInt(parameters.getString("timeout"));
int iterations = parameters.getInt("iterations");
int testTimeoutSeconds = parameters.getInt("timeout");
if (iterations < 1)
iterations = 1;

View File

@ -94,11 +94,11 @@ class Googleplaybooks(AndroidUxPerfWorkload):
def validate(self):
super(Googleplaybooks, self).validate()
self.uiauto_params['search_book_title'] = self.search_book_title.replace(' ', '0space0')
self.uiauto_params['search_book_title'] = self.search_book_title
# If library_book_title is blank, set it to the same as search_book_title
if not self.library_book_title: # pylint: disable=access-member-before-definition
self.library_book_title = self.search_book_title # pylint: disable=attribute-defined-outside-init
self.uiauto_params['library_book_title'] = self.library_book_title.replace(' ', '0space0')
self.uiauto_params['library_book_title'] = self.library_book_title
self.uiauto_params['chapter_page_number'] = self.select_chapter_page_number
self.uiauto_params['search_word'] = self.search_word
self.uiauto_params['account'] = self.account

View File

@ -51,8 +51,8 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
parameters = getParams();
String searchBookTitle = parameters.getString("search_book_title").replace("0space0", " ");
String libraryBookTitle = parameters.getString("library_book_title").replace("0space0", " ");
String searchBookTitle = parameters.getString("search_book_title");
String libraryBookTitle = parameters.getString("library_book_title");
String chapterPageNumber = parameters.getString("chapter_page_number");
String searchWord = parameters.getString("search_word");
String noteText = "This is a test note";

View File

@ -118,10 +118,10 @@ class GoogleSlides(AndroidUxPerfWorkload):
def validate(self):
super(GoogleSlides, self).validate()
self.uiauto_params['workdir_name'] = self.device.path.basename(self.device.working_directory)
self.uiauto_params['test_file'] = self.test_file.replace(' ', '0space0')
self.uiauto_params['test_file'] = self.test_file
self.uiauto_params['slide_count'] = self.slide_count
self.uiauto_params['do_text_entry'] = self.do_text_entry
self.uiauto_params['new_doc_name'] = self.new_doc_name.replace(' ', '0space0')
self.uiauto_params['new_doc_name'] = self.new_doc_name
# Only accept certain image formats
if os.path.splitext(self.test_image.lower())[1] not in ['.jpg', '.jpeg', '.png']:
raise ValidationError('{} must be a JPEG or PNG file'.format(self.test_image))

View File

@ -51,10 +51,10 @@ public class UiAutomation extends UxPerfUiAutomation {
packageName = parameters.getString("package");
packageID = packageName + ":id/";
String newDocumentName = parameters.getString("new_doc_name").replace("0space0", " ");
String pushedDocumentName = parameters.getString("test_file").replace("0space0", " ");
int slideCount = Integer.parseInt(parameters.getString("slide_count"));
boolean doTextEntry = Boolean.parseBoolean(parameters.getString("do_text_entry"));
String newDocumentName = parameters.getString("new_doc_name");
String pushedDocumentName = parameters.getString("test_file");
int slideCount = parameters.getInt("slide_count");
boolean doTextEntry = parameters.getBoolean("do_text_entry");
String workingDirectoryName = parameters.getString("workdir_name");
setScreenOrientation(ScreenOrientation.NATURAL);

View File

@ -38,7 +38,7 @@ public class UiAutomation extends BaseUiAutomation {
public void runUiAutomation() throws Exception {
Bundle status = new Bundle();
Bundle params = getParams();
boolean hasGpu = Boolean.parseBoolean(params.getString("has_gpu").toLowerCase());
boolean hasGpu = params.getBoolean("has_gpu");
clearLogcat();
handleFtuInfoDialogIfNecessary();

View File

@ -90,7 +90,7 @@ class Skype(AndroidUxPerfWorkload):
super(Skype, self).validate()
self.uiauto_params['my_id'] = self.login_name
self.uiauto_params['my_pwd'] = self.login_pass
self.uiauto_params['name'] = self.contact_name.replace(' ', '0space0')
self.uiauto_params['name'] = self.contact_name
self.uiauto_params['duration'] = self.duration
self.uiauto_params['action'] = self.action

View File

@ -45,8 +45,8 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
parameters = getParams();
String contactName = parameters.getString("name").replace("0space0", " ");
int callDuration = Integer.parseInt(parameters.getString("duration"));
String contactName = parameters.getString("name");
int callDuration = parameters.getInt("duration");
String callType = parameters.getString("action");
String resultsFile = parameters.getString("results_file");

View File

@ -43,10 +43,10 @@ public class UiAutomation extends BaseUiAutomation {
public void runUiAutomation() throws Exception {
Bundle parameters = getParams();
String version = parameters.getString("version");
Boolean browser = Boolean.parseBoolean(parameters.getString("browser"));
Boolean metal = Boolean.parseBoolean(parameters.getString("metal"));
Boolean multicore = Boolean.parseBoolean(parameters.getString("multicore"));
Integer browserToUse = Integer.parseInt(parameters.getString("browserToUse")) - 1;
Boolean browser = parameters.getBoolean("browser");
Boolean metal = parameters.getBoolean("metal");
Boolean multicore = parameters.getBoolean("multicore");
Integer browserToUse = parameters.getInt("browserToUse") - 1;
dismissEULA();

View File

@ -62,9 +62,9 @@ class Videostreaming(AndroidUiAutoBenchmark):
self.uiauto_params['tolerance'] = self.tolerance
self.uiauto_params['sampling_interval'] = self.sampling_interval
if self.video_name and self.video_name != "":
self.uiauto_params['video_name'] = self.video_name.replace(" ", "0space0") # hack to get around uiautomator limitation
self.uiauto_params['video_name'] = self.video_name
else:
self.uiauto_params['video_name'] = "abkk sathe {}".format(self.resolution).replace(" ", "0space0")
self.uiauto_params['video_name'] = "abkk sathe {}".format(self.resolution)
self.apk_file = context.resolver.get(wlauto.common.android.resources.ApkFile(self))
self.uiauto_file = context.resolver.get(wlauto.common.android.resources.JarFile(self))
self.device_uiauto_file = self.device.path.join(self.device.working_directory,

View File

@ -60,10 +60,9 @@ public class UiAutomation extends BaseUiAutomation {
if (parameters.size() <= 0)
return;
int tolerance = Integer.parseInt(parameters.getString("tolerance"));
int samplingInterval = Integer.parseInt(parameters
.getString("sampling_interval"));
String videoName = parameters.getString("video_name").replace("0space0", " "); //Hack to get around uiautomator limitation
int tolerance = parameters.getInt("tolerance");
int samplingInterval = parameters.getInt("sampling_interval");
String videoName = parameters.getString("video_name");
UiObject search = new UiObject(new UiSelector()
.className("android.widget.ImageButton").index(0));

View File

@ -86,7 +86,7 @@ class Youtube(AndroidUxPerfWorkload):
def validate(self):
super(Youtube, self).validate()
self.uiauto_params['video_source'] = self.video_source
self.uiauto_params['search_term'] = self.search_term.replace(' ', '0space0')
self.uiauto_params['search_term'] = self.search_term
# Make sure search term is set if video source is 'search'
if (self.video_source == 'search') and not self.search_term:
raise WorkloadError("Param 'search_term' must be specified when video source is 'search'")

View File

@ -46,9 +46,6 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
String videoSource = parameters.getString("video_source");
String searchTerm = parameters.getString("search_term");
if (searchTerm != null) {
searchTerm = searchTerm.replace("0space0", " ");
}
setScreenOrientation(ScreenOrientation.NATURAL);
runApplicationInitialization();