mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-03-01 08:18:37 +00:00
Merge pull request #392 from marcbonnici/uiauto2
Upgrading to UiAutomator2
This commit is contained in:
commit
2fd7614d97
.gitignore
wlauto
commands
create.py
templates
common/android
ApplaunchInterface.classBaseUiAutomation$1.classBaseUiAutomation$ActionLogger.classBaseUiAutomation$Direction.classBaseUiAutomation$FindByCriteria.classBaseUiAutomation$PinchType.classBaseUiAutomation$ScreenOrientation.classBaseUiAutomation.classUiAutoUtils.classUxPerfUiAutomation$GestureTestParams.classUxPerfUiAutomation$GestureType.classUxPerfUiAutomation.classdevice.pyresources.pyuiauto.aarworkload.py
external/uiauto
app
build.gradlebuild.shbuild.xmlgradle/wrapper
gradlewgradlew.batproject.propertiessettings.gradleresource_getters
utils
workloads
adobereader
com.arm.wlauto.uiauto.adobereader.jarcom.arm.wlauto.uiauto.adobereader.uiautoapk
uiauto
andebench
com.arm.wlauto.uiauto.andebench.jarcom.arm.wlauto.uiauto.andebench.uiautoapk
uiauto
androbench
com.arm.wlauto.uiauto.androbench.jarcom.arm.wlauto.uiauto.androbench.uiautoapk
uiauto
antutu
15
.gitignore
vendored
15
.gitignore
vendored
@ -3,6 +3,7 @@
|
|||||||
*.bak
|
*.bak
|
||||||
*.o
|
*.o
|
||||||
*.cmd
|
*.cmd
|
||||||
|
*.iml
|
||||||
Module.symvers
|
Module.symvers
|
||||||
modules.order
|
modules.order
|
||||||
*~
|
*~
|
||||||
@ -14,9 +15,12 @@ wa_output/
|
|||||||
doc/source/api/
|
doc/source/api/
|
||||||
doc/source/extensions/
|
doc/source/extensions/
|
||||||
MANIFEST
|
MANIFEST
|
||||||
wlauto/external/uiauto/bin/
|
wlauto/external/uiauto/**/build/
|
||||||
wlauto/external/uiauto/*.properties
|
wlauto/external/uiauto/*.properties
|
||||||
wlauto/external/uiauto/build.xml
|
wlauto/external/uiauto/app/libs/
|
||||||
|
wlauto/external/uiauto/app/proguard-rules.pro
|
||||||
|
wlauto/external/uiauto/**/.gradle
|
||||||
|
wlauto/external/uiauto/**/.idea
|
||||||
*.orig
|
*.orig
|
||||||
local.properties
|
local.properties
|
||||||
wlauto/external/revent/libs/
|
wlauto/external/revent/libs/
|
||||||
@ -27,4 +31,9 @@ pmu_logger.mod.c
|
|||||||
.tmp_versions
|
.tmp_versions
|
||||||
obj/
|
obj/
|
||||||
libs/armeabi
|
libs/armeabi
|
||||||
wlauto/workloads/*/uiauto/bin/
|
wlauto/workloads/*/uiauto/**/build/
|
||||||
|
wlauto/workloads/*/uiauto/*.properties
|
||||||
|
wlauto/workloads/*/uiauto/app/libs/
|
||||||
|
wlauto/workloads/*/uiauto/app/proguard-rules.pro
|
||||||
|
wlauto/workloads/*/uiauto/**/.gradle
|
||||||
|
wlauto/workloads/*/uiauto/**/.idea
|
||||||
|
@ -22,7 +22,6 @@ import textwrap
|
|||||||
import argparse
|
import argparse
|
||||||
import shutil
|
import shutil
|
||||||
import getpass
|
import getpass
|
||||||
import subprocess
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
@ -30,8 +29,9 @@ import yaml
|
|||||||
from wlauto import ExtensionLoader, Command, settings
|
from wlauto import ExtensionLoader, Command, settings
|
||||||
from wlauto.exceptions import CommandError, ConfigError
|
from wlauto.exceptions import CommandError, ConfigError
|
||||||
from wlauto.utils.cli import init_argument_parser
|
from wlauto.utils.cli import init_argument_parser
|
||||||
from wlauto.utils.misc import (capitalize, check_output,
|
from wlauto.utils.misc import (capitalize,
|
||||||
ensure_file_directory_exists as _f, ensure_directory_exists as _d)
|
ensure_file_directory_exists as _f,
|
||||||
|
ensure_directory_exists as _d)
|
||||||
from wlauto.utils.types import identifier
|
from wlauto.utils.types import identifier
|
||||||
from wlauto.utils.doc import format_body
|
from wlauto.utils.doc import format_body
|
||||||
|
|
||||||
@ -41,20 +41,6 @@ __all__ = ['create_workload']
|
|||||||
|
|
||||||
TEMPLATES_DIR = os.path.join(os.path.dirname(__file__), 'templates')
|
TEMPLATES_DIR = os.path.join(os.path.dirname(__file__), 'templates')
|
||||||
|
|
||||||
UIAUTO_BUILD_SCRIPT = """#!/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', 'BaseUiAutomation.class')"`
|
|
||||||
mkdir -p $$class_dir
|
|
||||||
cp $$base_class $$class_dir
|
|
||||||
|
|
||||||
ant build
|
|
||||||
|
|
||||||
if [[ -f bin/${package_name}.jar ]]; then
|
|
||||||
cp bin/${package_name}.jar ..
|
|
||||||
fi
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class CreateSubcommand(object):
|
class CreateSubcommand(object):
|
||||||
|
|
||||||
@ -321,7 +307,7 @@ def create_basic_workload(path, name, class_name):
|
|||||||
|
|
||||||
|
|
||||||
def create_uiautomator_workload(path, name, class_name):
|
def create_uiautomator_workload(path, name, class_name):
|
||||||
uiauto_path = _d(os.path.join(path, 'uiauto'))
|
uiauto_path = os.path.join(path, 'uiauto')
|
||||||
create_uiauto_project(uiauto_path, name)
|
create_uiauto_project(uiauto_path, name)
|
||||||
source_file = os.path.join(path, '__init__.py')
|
source_file = os.path.join(path, '__init__.py')
|
||||||
with open(source_file, 'w') as wfh:
|
with open(source_file, 'w') as wfh:
|
||||||
@ -335,37 +321,34 @@ def create_android_benchmark(path, name, class_name):
|
|||||||
|
|
||||||
|
|
||||||
def create_android_uiauto_benchmark(path, name, class_name):
|
def create_android_uiauto_benchmark(path, name, class_name):
|
||||||
uiauto_path = _d(os.path.join(path, 'uiauto'))
|
uiauto_path = os.path.join(path, 'uiauto')
|
||||||
create_uiauto_project(uiauto_path, name)
|
create_uiauto_project(uiauto_path, name)
|
||||||
source_file = os.path.join(path, '__init__.py')
|
source_file = os.path.join(path, '__init__.py')
|
||||||
with open(source_file, 'w') as wfh:
|
with open(source_file, 'w') as wfh:
|
||||||
wfh.write(render_template('android_uiauto_benchmark', {'name': name, 'class_name': class_name}))
|
wfh.write(render_template('android_uiauto_benchmark', {'name': name, 'class_name': class_name}))
|
||||||
|
|
||||||
|
|
||||||
def create_uiauto_project(path, name, target='1'):
|
def create_uiauto_project(path, name):
|
||||||
sdk_path = get_sdk_path()
|
|
||||||
android_path = os.path.join(sdk_path, 'tools', 'android')
|
|
||||||
package_name = 'com.arm.wlauto.uiauto.' + name.lower()
|
package_name = 'com.arm.wlauto.uiauto.' + name.lower()
|
||||||
|
|
||||||
# ${ANDROID_HOME}/tools/android create uitest-project -n com.arm.wlauto.uiauto.linpack -t 1 -p ../test2
|
shutil.copytree(os.path.join(TEMPLATES_DIR, 'uiauto_template'), path)
|
||||||
command = '{} create uitest-project --name {} --target {} --path {}'.format(android_path,
|
|
||||||
package_name,
|
manifest_path = os.path.join(path, 'app', 'src', 'main')
|
||||||
target,
|
mainifest = os.path.join(_d(manifest_path), 'AndroidManifest.xml')
|
||||||
path)
|
with open(mainifest, 'w') as wfh:
|
||||||
try:
|
wfh.write(render_template('uiauto_AndroidManifest.xml', {'package_name': package_name}))
|
||||||
check_output(command, shell=True)
|
|
||||||
except subprocess.CalledProcessError as e:
|
build_gradle_path = os.path.join(path, 'app')
|
||||||
if 'is is not valid' in e.output:
|
build_gradle = os.path.join(_d(build_gradle_path), 'build.gradle')
|
||||||
message = 'No Android SDK target found; have you run "{} update sdk" and download a platform?'
|
with open(build_gradle, 'w') as wfh:
|
||||||
raise CommandError(message.format(android_path))
|
wfh.write(render_template('uiauto_build.gradle', {'package_name': package_name}))
|
||||||
|
|
||||||
build_script = os.path.join(path, 'build.sh')
|
build_script = os.path.join(path, 'build.sh')
|
||||||
with open(build_script, 'w') as wfh:
|
with open(build_script, 'w') as wfh:
|
||||||
template = string.Template(UIAUTO_BUILD_SCRIPT)
|
wfh.write(render_template('uiauto_build_script', {'package_name': package_name}))
|
||||||
wfh.write(template.substitute({'package_name': package_name}))
|
|
||||||
os.chmod(build_script, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
|
os.chmod(build_script, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
|
||||||
|
|
||||||
source_file = _f(os.path.join(path, 'src',
|
source_file = _f(os.path.join(path, 'app', 'src', 'main', 'java',
|
||||||
os.sep.join(package_name.split('.')[:-1]),
|
os.sep.join(package_name.split('.')[:-1]),
|
||||||
'UiAutomation.java'))
|
'UiAutomation.java'))
|
||||||
with open(source_file, 'w') as wfh:
|
with open(source_file, 'w') as wfh:
|
||||||
|
@ -2,23 +2,30 @@ package ${package_name};
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
// Import the uiautomator libraries
|
// Import the uiautomator libraries
|
||||||
import com.android.uiautomator.core.UiObject;
|
import android.support.test.uiautomator.UiObject;
|
||||||
import com.android.uiautomator.core.UiObjectNotFoundException;
|
import android.support.test.uiautomator.UiObjectNotFoundException;
|
||||||
import com.android.uiautomator.core.UiScrollable;
|
import android.support.test.uiautomator.UiScrollable;
|
||||||
import com.android.uiautomator.core.UiSelector;
|
import android.support.test.uiautomator.UiSelector;
|
||||||
import com.android.uiautomator.testrunner.UiAutomatorTestCase;
|
|
||||||
|
|
||||||
import com.arm.wlauto.uiauto.BaseUiAutomation;
|
import com.arm.wlauto.uiauto.BaseUiAutomation;
|
||||||
|
|
||||||
public class UiAutomation extends BaseUiAutomation {
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class UiAutomation extends BaseUiAutomation {
|
||||||
|
|
||||||
public static String TAG = "${name}";
|
public static String TAG = "${name}";
|
||||||
|
|
||||||
public void runUiAutomation() throws Exception {
|
@Test
|
||||||
|
public void runUiAutomation() throws Exception {
|
||||||
|
initialize_instrumentation();
|
||||||
// UI Automation code goes here
|
// UI Automation code goes here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
wlauto/commands/templates/uiauto_AndroidManifest.xml
Normal file
12
wlauto/commands/templates/uiauto_AndroidManifest.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="${package_name}"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
|
||||||
|
|
||||||
|
<instrumentation
|
||||||
|
android:name="android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
android:targetPackage="${package_name}"/>
|
||||||
|
|
||||||
|
</manifest>
|
33
wlauto/commands/templates/uiauto_build.gradle
Normal file
33
wlauto/commands/templates/uiauto_build.gradle
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 18
|
||||||
|
buildToolsVersion '25.0.0'
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "${package_name}"
|
||||||
|
minSdkVersion 18
|
||||||
|
targetSdkVersion 25
|
||||||
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
applicationVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
output.outputFile = file("$$project.buildDir/apk/${package_name}.apk")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
|
compile 'com.android.support.test:runner:0.5'
|
||||||
|
compile 'com.android.support.test:rules:0.5'
|
||||||
|
compile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
|
||||||
|
compile(name: 'uiauto', ext: 'aar')
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
flatDir {
|
||||||
|
dirs 'libs'
|
||||||
|
}
|
||||||
|
}
|
39
wlauto/commands/templates/uiauto_build_script
Normal file
39
wlauto/commands/templates/uiauto_build_script
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# CD into build dir if possible - allows building from any directory
|
||||||
|
script_path='.'
|
||||||
|
if `readlink -f $$0 &>/dev/null`; then
|
||||||
|
script_path=`readlink -f $$0 2>/dev/null`
|
||||||
|
fi
|
||||||
|
script_dir=`dirname $$script_path`
|
||||||
|
cd $$script_dir
|
||||||
|
|
||||||
|
# Ensure gradelw exists before starting
|
||||||
|
if [[ ! -f gradlew ]]; then
|
||||||
|
echo 'gradlew file not found! Check that you are in the right directory.'
|
||||||
|
exit 9
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy base class library from wlauto dist
|
||||||
|
libs_dir=app/libs
|
||||||
|
base_classes=`python -c "import os, wlauto; print os.path.join(os.path.dirname(wlauto.__file__), 'common', 'android', '*.aar')"`
|
||||||
|
mkdir -p $$libs_dir
|
||||||
|
cp $$base_classes $$libs_dir
|
||||||
|
|
||||||
|
# Build and return appropriate exit code if failed
|
||||||
|
# gradle build
|
||||||
|
./gradlew clean :app:assembleDebug
|
||||||
|
exit_code=$$?
|
||||||
|
if [[ $$exit_code -ne 0 ]]; then
|
||||||
|
echo "ERROR: 'gradle build' exited with code $$exit_code"
|
||||||
|
exit $$exit_code
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If successful move APK file to workload folder (overwrite previous)
|
||||||
|
rm -f ../$package_name
|
||||||
|
if [[ -f app/build/apk/$package_name.apk ]]; then
|
||||||
|
cp app/build/apk/$package_name.apk ../$package_name.uiautoapk
|
||||||
|
else
|
||||||
|
echo 'ERROR: UiAutomator apk could not be found!'
|
||||||
|
exit 9
|
||||||
|
fi
|
23
wlauto/commands/templates/uiauto_template/build.gradle
Normal file
23
wlauto/commands/templates/uiauto_template/build.gradle
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:2.3.1'
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
BIN
wlauto/commands/templates/uiauto_template/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
wlauto/commands/templates/uiauto_template/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
wlauto/commands/templates/uiauto_template/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
wlauto/commands/templates/uiauto_template/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#Wed May 03 15:42:44 BST 2017
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
160
wlauto/commands/templates/uiauto_template/gradlew
vendored
Executable file
160
wlauto/commands/templates/uiauto_template/gradlew
vendored
Executable file
@ -0,0 +1,160 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
wlauto/commands/templates/uiauto_template/gradlew.bat
vendored
Normal file
90
wlauto/commands/templates/uiauto_template/gradlew.bat
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
@ -0,0 +1 @@
|
|||||||
|
include ':app'
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -390,10 +390,10 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223
|
|||||||
else:
|
else:
|
||||||
return self.install_executable(filepath, with_name)
|
return self.install_executable(filepath, with_name)
|
||||||
|
|
||||||
def install_apk(self, filepath, timeout=default_timeout, replace=False, allow_downgrade=False): # pylint: disable=W0221
|
def install_apk(self, filepath, timeout=default_timeout, replace=False, allow_downgrade=False, force=False): # pylint: disable=W0221
|
||||||
self._check_ready()
|
self._check_ready()
|
||||||
ext = os.path.splitext(filepath)[1].lower()
|
ext = os.path.splitext(filepath)[1].lower()
|
||||||
if ext == '.apk':
|
if ext == '.apk' or force:
|
||||||
flags = []
|
flags = []
|
||||||
if replace:
|
if replace:
|
||||||
flags.append('-r') # Replace existing APK
|
flags.append('-r') # Replace existing APK
|
||||||
@ -722,7 +722,7 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223
|
|||||||
appropriate method of forcing a re-index of the mediaserver cache for a given
|
appropriate method of forcing a re-index of the mediaserver cache for a given
|
||||||
list of files.
|
list of files.
|
||||||
"""
|
"""
|
||||||
if self.device.is_rooted or self.device.get_sdk_version() < 24: # MM and below
|
if self.device.is_rooted or self.device.get_sdk_version() < 24: # MM and below
|
||||||
common_path = commonprefix(file_list, sep=self.device.path.sep)
|
common_path = commonprefix(file_list, sep=self.device.path.sep)
|
||||||
self.broadcast_media_mounted(common_path, self.device.is_rooted)
|
self.broadcast_media_mounted(common_path, self.device.is_rooted)
|
||||||
else:
|
else:
|
||||||
@ -743,9 +743,7 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223
|
|||||||
command = 'am broadcast -a android.intent.action.MEDIA_MOUNTED -d file://'
|
command = 'am broadcast -a android.intent.action.MEDIA_MOUNTED -d file://'
|
||||||
self.execute(command + dirpath, as_root=as_root)
|
self.execute(command + dirpath, as_root=as_root)
|
||||||
|
|
||||||
|
|
||||||
# Internal methods: do not use outside of the class.
|
# Internal methods: do not use outside of the class.
|
||||||
|
|
||||||
def _update_build_properties(self, props):
|
def _update_build_properties(self, props):
|
||||||
try:
|
try:
|
||||||
def strip(somestring):
|
def strip(somestring):
|
||||||
|
@ -41,3 +41,15 @@ class ApkFile(FileResource):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '<{}\'s {} APK>'.format(self.owner, self.platform)
|
return '<{}\'s {} APK>'.format(self.owner, self.platform)
|
||||||
|
|
||||||
|
|
||||||
|
class uiautoApkFile(FileResource):
|
||||||
|
|
||||||
|
name = 'uiautoapk'
|
||||||
|
|
||||||
|
def __init__(self, owner, platform=None):
|
||||||
|
super(uiautoApkFile, self).__init__(owner)
|
||||||
|
self.platform = platform
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return '<{}\'s {} UiAuto APK>'.format(self.owner, self.platform)
|
||||||
|
BIN
wlauto/common/android/uiauto.aar
Normal file
BIN
wlauto/common/android/uiauto.aar
Normal file
Binary file not shown.
@ -26,7 +26,8 @@ from wlauto.core.resource import NO_ONE
|
|||||||
from wlauto.common.android.resources import ApkFile, ReventFile
|
from wlauto.common.android.resources import ApkFile, ReventFile
|
||||||
from wlauto.common.resources import ExtensionAsset, Executable, File
|
from wlauto.common.resources import ExtensionAsset, Executable, File
|
||||||
from wlauto.exceptions import WorkloadError, ResourceError, DeviceError
|
from wlauto.exceptions import WorkloadError, ResourceError, DeviceError
|
||||||
from wlauto.utils.android import ApkInfo, ANDROID_NORMAL_PERMISSIONS, UNSUPPORTED_PACKAGES
|
from wlauto.utils.android import (ApkInfo, ANDROID_NORMAL_PERMISSIONS,
|
||||||
|
ANDROID_UNCHANGEABLE_PERMISSIONS, UNSUPPORTED_PACKAGES)
|
||||||
from wlauto.utils.types import boolean, ParameterDict
|
from wlauto.utils.types import boolean, ParameterDict
|
||||||
from wlauto.utils.revent import ReventRecording
|
from wlauto.utils.revent import ReventRecording
|
||||||
import wlauto.utils.statedetect as state_detector
|
import wlauto.utils.statedetect as state_detector
|
||||||
@ -44,12 +45,12 @@ DELAY = 5
|
|||||||
|
|
||||||
class UiAutomatorWorkload(Workload):
|
class UiAutomatorWorkload(Workload):
|
||||||
"""
|
"""
|
||||||
Base class for all workloads that rely on a UI Automator JAR file.
|
Base class for all workloads that rely on a UI Automator APK file.
|
||||||
|
|
||||||
This class should be subclassed by workloads that rely on android UiAutomator
|
This class should be subclassed by workloads that rely on android UiAutomator
|
||||||
to work. This class handles transferring the UI Automator JAR file to the device
|
to work. This class handles installing the UI Automator APK to the device
|
||||||
and invoking it to run the workload. By default, it will look for the JAR file in
|
and invoking it to run the workload. By default, it will look for the ``*.uiautoapk`` file
|
||||||
the same directory as the .py file for the workload (this can be changed by overriding
|
in the same directory as the .py file for the workload (this can be changed by overriding
|
||||||
the ``uiauto_file`` property in the subclassing workload).
|
the ``uiauto_file`` property in the subclassing workload).
|
||||||
|
|
||||||
To inintiate UI Automation, the fully-qualified name of the Java class and the
|
To inintiate UI Automation, the fully-qualified name of the Java class and the
|
||||||
@ -61,7 +62,7 @@ class UiAutomatorWorkload(Workload):
|
|||||||
match what is expected, or you could override ``uiauto_package``, ``uiauto_class`` and
|
match what is expected, or you could override ``uiauto_package``, ``uiauto_class`` and
|
||||||
``uiauto_method`` class attributes with the value that match your Java code.
|
``uiauto_method`` class attributes with the value that match your Java code.
|
||||||
|
|
||||||
You can also pass parameters to the JAR file. To do this add the parameters to
|
You can also pass parameters to the APK file. To do this add the parameters to
|
||||||
``self.uiauto_params`` dict inside your class's ``__init__`` or ``setup`` methods.
|
``self.uiauto_params`` dict inside your class's ``__init__`` or ``setup`` methods.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -70,8 +71,7 @@ class UiAutomatorWorkload(Workload):
|
|||||||
|
|
||||||
uiauto_package = ''
|
uiauto_package = ''
|
||||||
uiauto_class = 'UiAutomation'
|
uiauto_class = 'UiAutomation'
|
||||||
uiauto_method = 'runUiAutomation'
|
uiauto_method = 'android.support.test.runner.AndroidJUnitRunner'
|
||||||
|
|
||||||
# Can be overidden by subclasses to adjust to run time of specific
|
# Can be overidden by subclasses to adjust to run time of specific
|
||||||
# benchmarks.
|
# benchmarks.
|
||||||
run_timeout = 4 * 60 # seconds
|
run_timeout = 4 * 60 # seconds
|
||||||
@ -80,29 +80,31 @@ class UiAutomatorWorkload(Workload):
|
|||||||
if _call_super:
|
if _call_super:
|
||||||
Workload.__init__(self, device, **kwargs)
|
Workload.__init__(self, device, **kwargs)
|
||||||
self.uiauto_file = None
|
self.uiauto_file = None
|
||||||
self.device_uiauto_file = None
|
|
||||||
self.command = None
|
self.command = None
|
||||||
self.uiauto_params = ParameterDict()
|
self.uiauto_params = ParameterDict()
|
||||||
|
|
||||||
def init_resources(self, context):
|
def init_resources(self, context):
|
||||||
self.uiauto_file = context.resolver.get(wlauto.common.android.resources.JarFile(self))
|
self.uiauto_file = context.resolver.get(wlauto.common.android.resources.uiautoApkFile(self))
|
||||||
if not self.uiauto_file:
|
if not self.uiauto_file:
|
||||||
raise ResourceError('No UI automation JAR file found for workload {}.'.format(self.name))
|
raise ResourceError('No UI automation APK file found for workload {}.'.format(self.name))
|
||||||
self.device_uiauto_file = self.device.path.join(self.device.working_directory,
|
|
||||||
os.path.basename(self.uiauto_file))
|
|
||||||
if not self.uiauto_package:
|
if not self.uiauto_package:
|
||||||
self.uiauto_package = os.path.splitext(os.path.basename(self.uiauto_file))[0]
|
self.uiauto_package = os.path.splitext(os.path.basename(self.uiauto_file))[0]
|
||||||
|
|
||||||
def setup(self, context):
|
def setup(self, context):
|
||||||
Workload.setup(self, context)
|
Workload.setup(self, context)
|
||||||
method_string = '{}.{}#{}'.format(self.uiauto_package, self.uiauto_class, self.uiauto_method)
|
|
||||||
params_dict = self.uiauto_params
|
params_dict = self.uiauto_params
|
||||||
params_dict['workdir'] = self.device.working_directory
|
params_dict['workdir'] = self.device.working_directory
|
||||||
params = ''
|
params = ''
|
||||||
for k, v in self.uiauto_params.iter_encoded_items():
|
for k, v in self.uiauto_params.iter_encoded_items():
|
||||||
params += ' -e {} "{}"'.format(k, v)
|
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)
|
self.device.install_apk(self.uiauto_file, replace=True, force=True)
|
||||||
|
|
||||||
|
instrumention_string = 'am instrument -w -r {} -e class {}.{} {}/{}'
|
||||||
|
self.command = instrumention_string.format(params, self.uiauto_package,
|
||||||
|
self.uiauto_class, self.uiauto_package,
|
||||||
|
self.uiauto_method)
|
||||||
self.device.killall('uiautomator')
|
self.device.killall('uiautomator')
|
||||||
|
|
||||||
def run(self, context):
|
def run(self, context):
|
||||||
@ -117,11 +119,11 @@ class UiAutomatorWorkload(Workload):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def teardown(self, context):
|
def teardown(self, context):
|
||||||
self.device.delete_file(self.device_uiauto_file)
|
self.device.uninstall(self.uiauto_package)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if not self.uiauto_file:
|
if not self.uiauto_file:
|
||||||
raise WorkloadError('No UI automation JAR file found for workload {}.'.format(self.name))
|
raise WorkloadError('No UI automation APK file found for workload {}.'.format(self.name))
|
||||||
if not self.uiauto_package:
|
if not self.uiauto_package:
|
||||||
raise WorkloadError('No UI automation package specified for workload {}.'.format(self.name))
|
raise WorkloadError('No UI automation package specified for workload {}.'.format(self.name))
|
||||||
|
|
||||||
@ -445,16 +447,18 @@ class ApkWorkload(Workload):
|
|||||||
# "Normal" Permisions are automatically granted and cannot be changed
|
# "Normal" Permisions are automatically granted and cannot be changed
|
||||||
permission_name = permission.rsplit('.', 1)[1]
|
permission_name = permission.rsplit('.', 1)[1]
|
||||||
if permission_name not in ANDROID_NORMAL_PERMISSIONS:
|
if permission_name not in ANDROID_NORMAL_PERMISSIONS:
|
||||||
# On some API 23+ devices, this may fail with a SecurityException
|
# Some permissions are not allowed to be "changed"
|
||||||
# on previously granted permissions. In that case, just skip as it
|
if permission_name not in ANDROID_UNCHANGEABLE_PERMISSIONS:
|
||||||
# is not fatal to the workload execution
|
# On some API 23+ devices, this may fail with a SecurityException
|
||||||
try:
|
# on previously granted permissions. In that case, just skip as it
|
||||||
self.device.execute("pm grant {} {}".format(self.package, permission))
|
# is not fatal to the workload execution
|
||||||
except DeviceError as e:
|
try:
|
||||||
if "changeable permission" in e.message or "Unknown permission" in e.message:
|
self.device.execute("pm grant {} {}".format(self.package, permission))
|
||||||
self.logger.debug(e)
|
except DeviceError as e:
|
||||||
else:
|
if "changeable permission" in e.message or "Unknown permission" in e.message:
|
||||||
raise e
|
self.logger.debug(e)
|
||||||
|
else:
|
||||||
|
raise e
|
||||||
|
|
||||||
def do_post_install(self, context):
|
def do_post_install(self, context):
|
||||||
""" May be overwritten by derived classes."""
|
""" May be overwritten by derived classes."""
|
||||||
@ -681,7 +685,7 @@ class AndroidUxPerfWorkload(AndroidUiAutoBenchmark):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
super(AndroidUxPerfWorkload, self).validate()
|
super(AndroidUxPerfWorkload, self).validate()
|
||||||
self.uiauto_params['package'] = self.package
|
self.uiauto_params['package_name'] = self.package
|
||||||
self.uiauto_params['markers_enabled'] = self.markers_enabled
|
self.uiauto_params['markers_enabled'] = self.markers_enabled
|
||||||
|
|
||||||
def setup(self, context):
|
def setup(self, context):
|
||||||
|
18
wlauto/external/uiauto/app/build.gradle
vendored
Normal file
18
wlauto/external/uiauto/app/build.gradle
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 25
|
||||||
|
buildToolsVersion '25.0.3'
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 18
|
||||||
|
targetSdkVersion 25
|
||||||
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
|
compile 'com.android.support.test:runner:0.5'
|
||||||
|
compile 'com.android.support.test:rules:0.5'
|
||||||
|
compile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
|
||||||
|
}
|
9
wlauto/external/uiauto/app/src/main/AndroidManifest.xml
vendored
Normal file
9
wlauto/external/uiauto/app/src/main/AndroidManifest.xml
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.arm.wlauto.uiauto">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.READ_LOGS"/>
|
||||||
|
|
||||||
|
<application>
|
||||||
|
<uses-library android:name="android.test.runner"/>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
@ -17,10 +17,10 @@
|
|||||||
package com.arm.wlauto.uiauto;
|
package com.arm.wlauto.uiauto;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.support.test.uiautomator.UiObject;
|
||||||
|
|
||||||
// Import the uiautomator libraries
|
// Import the uiautomator libraries
|
||||||
import com.android.uiautomator.core.UiObject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ApplaunchInterface.java
|
* ApplaunchInterface.java
|
||||||
@ -51,4 +51,8 @@ public interface ApplaunchInterface {
|
|||||||
|
|
||||||
/** Passes the workload parameters. */
|
/** Passes the workload parameters. */
|
||||||
public void setWorkloadParameters(Bundle parameters);
|
public void setWorkloadParameters(Bundle parameters);
|
||||||
}
|
|
||||||
|
/** Initialize the instrumentation for the workload */
|
||||||
|
public void initialize_instrumentation();
|
||||||
|
|
||||||
|
}
|
181
wlauto/external/uiauto/src/com/arm/wlauto/uiauto/BaseUiAutomation.java → wlauto/external/uiauto/app/src/main/java/com/arm/wlauto/uiauto/BaseUiAutomation.java
vendored
Executable file → Normal file
181
wlauto/external/uiauto/src/com/arm/wlauto/uiauto/BaseUiAutomation.java → wlauto/external/uiauto/app/src/main/java/com/arm/wlauto/uiauto/BaseUiAutomation.java
vendored
Executable file → Normal file
@ -1,4 +1,4 @@
|
|||||||
/* Copyright 2013-2015 ARM Limited
|
/* Copyright 2013-2016 ARM Limited
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -13,36 +13,37 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package com.arm.wlauto.uiauto;
|
package com.arm.wlauto.uiauto;
|
||||||
|
|
||||||
import java.io.File;
|
import android.app.Instrumentation;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.support.test.InstrumentationRegistry;
|
||||||
|
import android.support.test.uiautomator.UiDevice;
|
||||||
|
import android.support.test.uiautomator.UiObject;
|
||||||
|
import android.support.test.uiautomator.UiSelector;
|
||||||
|
|
||||||
|
import android.graphics.Point;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
import android.support.test.uiautomator.UiObjectNotFoundException;
|
||||||
|
import android.support.test.uiautomator.UiScrollable;
|
||||||
|
import android.support.test.uiautomator.UiWatcher;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.concurrent.TimeoutException;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.TimeoutException;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import android.app.Activity;
|
import static android.support.test.InstrumentationRegistry.getArguments;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.SystemClock;
|
|
||||||
import android.graphics.Point;
|
|
||||||
import android.graphics.Rect;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
// Import the uiautomator libraries
|
public class BaseUiAutomation {
|
||||||
import com.android.uiautomator.core.UiObject;
|
|
||||||
import com.android.uiautomator.core.UiObjectNotFoundException;
|
|
||||||
import com.android.uiautomator.core.UiScrollable;
|
|
||||||
import com.android.uiautomator.core.UiSelector;
|
|
||||||
import com.android.uiautomator.core.UiDevice;
|
|
||||||
import com.android.uiautomator.core.UiWatcher;
|
|
||||||
import com.android.uiautomator.testrunner.UiAutomatorTestCase;
|
|
||||||
|
|
||||||
public class BaseUiAutomation extends UiAutomatorTestCase {
|
|
||||||
|
|
||||||
public long uiAutoTimeout = TimeUnit.SECONDS.toMillis(4);
|
public long uiAutoTimeout = TimeUnit.SECONDS.toMillis(4);
|
||||||
|
|
||||||
@ -53,6 +54,18 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
public static final int CLICK_REPEAT_INTERVAL_MINIMUM = 5;
|
public static final int CLICK_REPEAT_INTERVAL_MINIMUM = 5;
|
||||||
public static final int CLICK_REPEAT_INTERVAL_DEFAULT = 50;
|
public static final int CLICK_REPEAT_INTERVAL_DEFAULT = 50;
|
||||||
|
|
||||||
|
public Bundle parameters;
|
||||||
|
|
||||||
|
public Instrumentation mInstrumentation;
|
||||||
|
public Context mContext;
|
||||||
|
public UiDevice mDevice;
|
||||||
|
|
||||||
|
public void initialize_instrumentation(){
|
||||||
|
mInstrumentation = InstrumentationRegistry.getInstrumentation();
|
||||||
|
mDevice = UiDevice.getInstance(mInstrumentation);
|
||||||
|
mContext = mInstrumentation.getTargetContext();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Used by clickUiObject() methods in order to provide a consistent API
|
* Used by clickUiObject() methods in order to provide a consistent API
|
||||||
*/
|
*/
|
||||||
@ -101,7 +114,7 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void sleep(int second) {
|
public void sleep(int second) {
|
||||||
super.sleep(second * 1000);
|
SystemClock.sleep(second * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean takeScreenshot(String name) {
|
public boolean takeScreenshot(String name) {
|
||||||
@ -109,7 +122,7 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
String pngDir = params.getString("workdir");
|
String pngDir = params.getString("workdir");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return getUiDevice().takeScreenshot(new File(pngDir, name + ".png"));
|
return mDevice.takeScreenshot(new File(pngDir, name + ".png"));
|
||||||
} catch (NoSuchMethodError e) {
|
} catch (NoSuchMethodError e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -121,8 +134,8 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
|
|
||||||
public void waitText(String text, int second) throws UiObjectNotFoundException {
|
public void waitText(String text, int second) throws UiObjectNotFoundException {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject textObj = new UiObject(selector.text(text)
|
UiObject textObj = mDevice.findObject(selector.text(text)
|
||||||
.className("android.widget.TextView"));
|
.className("android.widget.TextView"));
|
||||||
waitObject(textObj, second);
|
waitObject(textObj, second);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,51 +226,51 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerWatcher(String name, UiWatcher watcher) {
|
public void registerWatcher(String name, UiWatcher watcher) {
|
||||||
UiDevice.getInstance().registerWatcher(name, watcher);
|
mDevice.registerWatcher(name, watcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runWatchers() {
|
public void runWatchers() {
|
||||||
UiDevice.getInstance().runWatchers();
|
mDevice.runWatchers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeWatcher(String name) {
|
public void removeWatcher(String name) {
|
||||||
UiDevice.getInstance().removeWatcher(name);
|
mDevice.removeWatcher(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pressEnter() {
|
public void pressEnter() {
|
||||||
UiDevice.getInstance().pressEnter();
|
mDevice.pressEnter();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pressHome() {
|
public void pressHome() {
|
||||||
UiDevice.getInstance().pressHome();
|
mDevice.pressHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pressBack() {
|
public void pressBack() {
|
||||||
UiDevice.getInstance().pressBack();
|
mDevice.pressBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pressDPadUp() {
|
public void pressDPadUp() {
|
||||||
UiDevice.getInstance().pressDPadUp();
|
mDevice.pressDPadUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pressDPadDown() {
|
public void pressDPadDown() {
|
||||||
UiDevice.getInstance().pressDPadDown();
|
mDevice.pressDPadDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pressDPadLeft() {
|
public void pressDPadLeft() {
|
||||||
UiDevice.getInstance().pressDPadLeft();
|
mDevice.pressDPadLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pressDPadRight() {
|
public void pressDPadRight() {
|
||||||
UiDevice.getInstance().pressDPadRight();
|
mDevice.pressDPadRight();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDisplayHeight() {
|
public int getDisplayHeight() {
|
||||||
return UiDevice.getInstance().getDisplayHeight();
|
return mDevice.getDisplayHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDisplayWidth() {
|
public int getDisplayWidth() {
|
||||||
return UiDevice.getInstance().getDisplayWidth();
|
return mDevice.getDisplayWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDisplayCentreWidth() {
|
public int getDisplayCentreWidth() {
|
||||||
@ -273,11 +286,11 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void tapDisplay(int x, int y) {
|
public void tapDisplay(int x, int y) {
|
||||||
UiDevice.getInstance().click(x, y);
|
mDevice.click(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uiDeviceSwipeUp(int steps) {
|
public void uiDeviceSwipeUp(int steps) {
|
||||||
UiDevice.getInstance().swipe(
|
mDevice.swipe(
|
||||||
getDisplayCentreWidth(),
|
getDisplayCentreWidth(),
|
||||||
(getDisplayCentreHeight() + (getDisplayCentreHeight() / 2)),
|
(getDisplayCentreHeight() + (getDisplayCentreHeight() / 2)),
|
||||||
getDisplayCentreWidth(),
|
getDisplayCentreWidth(),
|
||||||
@ -286,7 +299,7 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void uiDeviceSwipeDown(int steps) {
|
public void uiDeviceSwipeDown(int steps) {
|
||||||
UiDevice.getInstance().swipe(
|
mDevice.swipe(
|
||||||
getDisplayCentreWidth(),
|
getDisplayCentreWidth(),
|
||||||
(getDisplayCentreHeight() / 2),
|
(getDisplayCentreHeight() / 2),
|
||||||
getDisplayCentreWidth(),
|
getDisplayCentreWidth(),
|
||||||
@ -295,7 +308,7 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void uiDeviceSwipeLeft(int steps) {
|
public void uiDeviceSwipeLeft(int steps) {
|
||||||
UiDevice.getInstance().swipe(
|
mDevice.swipe(
|
||||||
(getDisplayCentreWidth() + (getDisplayCentreWidth() / 2)),
|
(getDisplayCentreWidth() + (getDisplayCentreWidth() / 2)),
|
||||||
getDisplayCentreHeight(),
|
getDisplayCentreHeight(),
|
||||||
(getDisplayCentreWidth() / 2),
|
(getDisplayCentreWidth() / 2),
|
||||||
@ -304,7 +317,7 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void uiDeviceSwipeRight(int steps) {
|
public void uiDeviceSwipeRight(int steps) {
|
||||||
UiDevice.getInstance().swipe(
|
mDevice.swipe(
|
||||||
(getDisplayCentreWidth() / 2),
|
(getDisplayCentreWidth() / 2),
|
||||||
getDisplayCentreHeight(),
|
getDisplayCentreHeight(),
|
||||||
(getDisplayCentreWidth() + (getDisplayCentreWidth() / 2)),
|
(getDisplayCentreWidth() + (getDisplayCentreWidth() / 2)),
|
||||||
@ -409,13 +422,13 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
public void setScreenOrientation(ScreenOrientation orientation) throws Exception {
|
public void setScreenOrientation(ScreenOrientation orientation) throws Exception {
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
getUiDevice().setOrientationRight();
|
mDevice.setOrientationRight();
|
||||||
break;
|
break;
|
||||||
case NATURAL:
|
case NATURAL:
|
||||||
getUiDevice().setOrientationNatural();
|
mDevice.setOrientationNatural();
|
||||||
break;
|
break;
|
||||||
case LEFT:
|
case LEFT:
|
||||||
getUiDevice().setOrientationLeft();
|
mDevice.setOrientationLeft();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception("No orientation specified");
|
throw new Exception("No orientation specified");
|
||||||
@ -423,25 +436,25 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void unsetScreenOrientation() throws Exception {
|
public void unsetScreenOrientation() throws Exception {
|
||||||
getUiDevice().unfreezeRotation();
|
mDevice.unfreezeRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uiObjectPerformLongClick(UiObject view, int steps) throws Exception {
|
public void uiObjectPerformLongClick(UiObject view, int steps) throws Exception {
|
||||||
Rect rect = view.getBounds();
|
Rect rect = view.getBounds();
|
||||||
UiDevice.getInstance().swipe(rect.centerX(), rect.centerY(),
|
mDevice.swipe(rect.centerX(), rect.centerY(),
|
||||||
rect.centerX(), rect.centerY(), steps);
|
rect.centerX(), rect.centerY(), steps);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uiDeviceSwipeVertical(int startY, int endY, int xCoordinate, int steps) {
|
public void uiDeviceSwipeVertical(int startY, int endY, int xCoordinate, int steps) {
|
||||||
getUiDevice().swipe(startY, xCoordinate, endY, xCoordinate, steps);
|
mDevice.swipe(startY, xCoordinate, endY, xCoordinate, steps);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uiDeviceSwipeHorizontal(int startX, int endX, int yCoordinate, int steps) {
|
public void uiDeviceSwipeHorizontal(int startX, int endX, int yCoordinate, int steps) {
|
||||||
getUiDevice().swipe(startX, yCoordinate, endX, yCoordinate, steps);
|
mDevice.swipe(startX, yCoordinate, endX, yCoordinate, steps);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void uiObjectPinch(UiObject view, PinchType direction, int steps,
|
public void uiObjectPinch(UiObject view, PinchType direction, int steps,
|
||||||
int percent) throws Exception {
|
int percent) throws Exception {
|
||||||
if (direction.equals(PinchType.IN)) {
|
if (direction.equals(PinchType.IN)) {
|
||||||
view.pinchIn(percent, steps);
|
view.pinchIn(percent, steps);
|
||||||
} else if (direction.equals(PinchType.OUT)) {
|
} else if (direction.equals(PinchType.OUT)) {
|
||||||
@ -450,7 +463,7 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void uiObjectVertPinch(UiObject view, PinchType direction,
|
public void uiObjectVertPinch(UiObject view, PinchType direction,
|
||||||
int steps, int percent) throws Exception {
|
int steps, int percent) throws Exception {
|
||||||
if (direction.equals(PinchType.IN)) {
|
if (direction.equals(PinchType.IN)) {
|
||||||
uiObjectVertPinchIn(view, steps, percent);
|
uiObjectVertPinchIn(view, steps, percent);
|
||||||
} else if (direction.equals(PinchType.OUT)) {
|
} else if (direction.equals(PinchType.OUT)) {
|
||||||
@ -515,20 +528,20 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public UiObject getUiObjectByResourceId(String resourceId, String className, long timeout) throws Exception {
|
public UiObject getUiObjectByResourceId(String resourceId, String className, long timeout) throws Exception {
|
||||||
UiObject object = new UiObject(new UiSelector().resourceId(resourceId)
|
UiObject object = mDevice.findObject(new UiSelector().resourceId(resourceId)
|
||||||
.className(className));
|
.className(className));
|
||||||
if (!object.waitForExists(timeout)) {
|
if (!object.waitForExists(timeout)) {
|
||||||
throw new UiObjectNotFoundException(String.format("Could not find \"%s\" \"%s\"",
|
throw new UiObjectNotFoundException(String.format("Could not find \"%s\" \"%s\"",
|
||||||
resourceId, className));
|
resourceId, className));
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UiObject getUiObjectByResourceId(String id) throws Exception {
|
public UiObject getUiObjectByResourceId(String id) throws Exception {
|
||||||
UiObject object = new UiObject(new UiSelector().resourceId(id));
|
UiObject object = mDevice.findObject(new UiSelector().resourceId(id));
|
||||||
|
|
||||||
if (!object.waitForExists(uiAutoTimeout)) {
|
if (!object.waitForExists(uiAutoTimeout)) {
|
||||||
throw new UiObjectNotFoundException("Could not find view with resource ID: " + id);
|
throw new UiObjectNotFoundException("Could not find view with resource ID: " + id);
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
@ -538,20 +551,20 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public UiObject getUiObjectByDescription(String description, String className, long timeout) throws Exception {
|
public UiObject getUiObjectByDescription(String description, String className, long timeout) throws Exception {
|
||||||
UiObject object = new UiObject(new UiSelector().descriptionContains(description)
|
UiObject object = mDevice.findObject(new UiSelector().descriptionContains(description)
|
||||||
.className(className));
|
.className(className));
|
||||||
if (!object.waitForExists(timeout)) {
|
if (!object.waitForExists(timeout)) {
|
||||||
throw new UiObjectNotFoundException(String.format("Could not find \"%s\" \"%s\"",
|
throw new UiObjectNotFoundException(String.format("Could not find \"%s\" \"%s\"",
|
||||||
description, className));
|
description, className));
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UiObject getUiObjectByDescription(String desc) throws Exception {
|
public UiObject getUiObjectByDescription(String desc) throws Exception {
|
||||||
UiObject object = new UiObject(new UiSelector().descriptionContains(desc));
|
UiObject object = mDevice.findObject(new UiSelector().descriptionContains(desc));
|
||||||
|
|
||||||
if (!object.waitForExists(uiAutoTimeout)) {
|
if (!object.waitForExists(uiAutoTimeout)) {
|
||||||
throw new UiObjectNotFoundException("Could not find view with description: " + desc);
|
throw new UiObjectNotFoundException("Could not find view with description: " + desc);
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
@ -561,8 +574,8 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public UiObject getUiObjectByText(String text, String className, long timeout) throws Exception {
|
public UiObject getUiObjectByText(String text, String className, long timeout) throws Exception {
|
||||||
UiObject object = new UiObject(new UiSelector().textContains(text)
|
UiObject object = mDevice.findObject(new UiSelector().textContains(text)
|
||||||
.className(className));
|
.className(className));
|
||||||
if (!object.waitForExists(timeout)) {
|
if (!object.waitForExists(timeout)) {
|
||||||
throw new UiObjectNotFoundException(String.format("Could not find \"%s\" \"%s\"",
|
throw new UiObjectNotFoundException(String.format("Could not find \"%s\" \"%s\"",
|
||||||
text, className));
|
text, className));
|
||||||
@ -571,10 +584,10 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public UiObject getUiObjectByText(String text) throws Exception {
|
public UiObject getUiObjectByText(String text) throws Exception {
|
||||||
UiObject object = new UiObject(new UiSelector().textContains(text));
|
UiObject object = mDevice.findObject(new UiSelector().textContains(text));
|
||||||
|
|
||||||
if (!object.waitForExists(uiAutoTimeout)) {
|
if (!object.waitForExists(uiAutoTimeout)) {
|
||||||
throw new UiObjectNotFoundException("Could not find view with text: " + text);
|
throw new UiObjectNotFoundException("Could not find view with text: " + text);
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
@ -582,10 +595,10 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
// Helper to select a folder in the gallery
|
// Helper to select a folder in the gallery
|
||||||
public void selectGalleryFolder(String directory) throws Exception {
|
public void selectGalleryFolder(String directory) throws Exception {
|
||||||
UiObject workdir =
|
UiObject workdir =
|
||||||
new UiObject(new UiSelector().text(directory)
|
mDevice.findObject(new UiSelector().text(directory)
|
||||||
.className("android.widget.TextView"));
|
.className("android.widget.TextView"));
|
||||||
UiScrollable scrollView =
|
UiScrollable scrollView =
|
||||||
new UiScrollable(new UiSelector().scrollable(true));
|
new UiScrollable(new UiSelector().scrollable(true));
|
||||||
|
|
||||||
// If the folder is not present wait for a short time for
|
// If the folder is not present wait for a short time for
|
||||||
// the media server to refresh its index.
|
// the media server to refresh its index.
|
||||||
@ -624,13 +637,13 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
// passing it to workloads.
|
// passing it to workloads.
|
||||||
public Bundle getParams() {
|
public Bundle getParams() {
|
||||||
// Get the original parameter bundle
|
// Get the original parameter bundle
|
||||||
Bundle parameters = super.getParams();
|
parameters = getArguments();
|
||||||
|
|
||||||
// Decode each parameter in the bundle, except null values and "jars", as this
|
// Decode each parameter in the bundle, except null values and "class", as this
|
||||||
// is automatically added and therefore not encoded.
|
// used to control instrumentation and therefore not encoded.
|
||||||
for (String key : parameters.keySet()) {
|
for (String key : parameters.keySet()) {
|
||||||
String param = parameters.getString(key);
|
String param = parameters.getString(key);
|
||||||
if (param != null && !key.equals("jars")) {
|
if (param != null && !key.equals("class")) {
|
||||||
param = android.net.Uri.decode(param);
|
param = android.net.Uri.decode(param);
|
||||||
parameters = decode(parameters, key, param);
|
parameters = decode(parameters, key, param);
|
||||||
}
|
}
|
||||||
@ -640,7 +653,7 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
|
|
||||||
// Helper function to decode a string and insert it as an appropriate type
|
// Helper function to decode a string and insert it as an appropriate type
|
||||||
// into a provided bundle with its key.
|
// into a provided bundle with its key.
|
||||||
// Each bundle parameter will be a urlencoded string with 2 characters prefixed to the value
|
// 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.
|
// used to store the original type information, e.g. 'fl' -> list of floats.
|
||||||
private Bundle decode(Bundle parameters, String key, String value) {
|
private Bundle decode(Bundle parameters, String key, String value) {
|
||||||
char value_type = value.charAt(0);
|
char value_type = value.charAt(0);
|
||||||
@ -661,25 +674,25 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
} else if (value_type == 'n') {
|
} else if (value_type == 'n') {
|
||||||
parameters.putString(key, "None");
|
parameters.putString(key, "None");
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Error decoding:" + key + value
|
throw new IllegalArgumentException("Error decoding:" + key + value
|
||||||
+ " - unknown format");
|
+ " - unknown format");
|
||||||
}
|
}
|
||||||
} else if (value_dimension == 'l') {
|
} else if (value_dimension == 'l') {
|
||||||
return decodeArray(parameters, key, value_type, param);
|
return decodeArray(parameters, key, value_type, param);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Error decoding:" + key + value
|
throw new IllegalArgumentException("Error decoding:" + key + value
|
||||||
+ " - unknown format");
|
+ " - unknown format");
|
||||||
}
|
}
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function to deal with decoding arrays and update the bundle with
|
// Helper function to deal with decoding arrays and update the bundle with
|
||||||
// an appropriate array type. The string "0newelement0" is used to distinguish
|
// an appropriate array type. The string "0newelement0" is used to distinguish
|
||||||
// each element for each other in the array when encoded.
|
// each element for each other in the array when encoded.
|
||||||
private Bundle decodeArray(Bundle parameters, String key, char type, String value) {
|
private Bundle decodeArray(Bundle parameters, String key, char type, String value) {
|
||||||
String[] string_list = value.split("0newelement0");
|
String[] string_list = value.split("0newelement0");
|
||||||
if (type == 's') {
|
if (type == 's') {
|
||||||
parameters.putStringArray(key, string_list);
|
parameters.putStringArray(key, string_list);
|
||||||
}
|
}
|
||||||
else if (type == 'i') {
|
else if (type == 'i') {
|
||||||
int[] int_list = new int[string_list.length];
|
int[] int_list = new int[string_list.length];
|
||||||
@ -707,7 +720,7 @@ public class BaseUiAutomation extends UiAutomatorTestCase {
|
|||||||
parameters.putBooleanArray(key, boolean_list);
|
parameters.putBooleanArray(key, boolean_list);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Error decoding array: " +
|
throw new IllegalArgumentException("Error decoding array: " +
|
||||||
value + " - unknown format");
|
value + " - unknown format");
|
||||||
}
|
}
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
@ -16,20 +16,19 @@
|
|||||||
package com.arm.wlauto.uiauto;
|
package com.arm.wlauto.uiauto;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
public final class UiAutoUtils {
|
public final class UiAutoUtils {
|
||||||
|
|
||||||
/** Construct launch command of an application. */
|
/** Construct launch command of an application. */
|
||||||
public static String createLaunchCommand(Bundle parameters) {
|
public static String createLaunchCommand(Bundle parameters) {
|
||||||
String launchCommand;
|
String launchCommand;
|
||||||
String activityName = parameters.getString("launch_activity");
|
String activityName = parameters.getString("launch_activity");
|
||||||
String packageName = parameters.getString("package");
|
String packageName = parameters.getString("package_name");
|
||||||
if (activityName.equals("None")) {
|
if (activityName.equals("None")) {
|
||||||
launchCommand = String.format("am start %s", packageName);
|
launchCommand = String.format("am start --user -3 %s", packageName);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
launchCommand = String.format("am start -n %s/%s", packageName, activityName);
|
launchCommand = String.format("am start --user -3 -n %s/%s", packageName, activityName);
|
||||||
}
|
}
|
||||||
return launchCommand;
|
return launchCommand;
|
||||||
}
|
}
|
@ -15,18 +15,19 @@
|
|||||||
|
|
||||||
package com.arm.wlauto.uiauto;
|
package com.arm.wlauto.uiauto;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class UxPerfUiAutomation extends BaseUiAutomation {
|
public class UxPerfUiAutomation extends BaseUiAutomation {
|
||||||
|
|
||||||
protected Bundle parameters;
|
protected Bundle parameters;
|
||||||
protected String packageName;
|
protected String packageName;
|
||||||
protected String packageID;
|
protected String packageID;
|
||||||
|
|
||||||
//Get application package parameters and create package ID
|
//Get application package parameters and create package ID
|
||||||
public void getPackageParameters() {
|
public void getPackageParameters() {
|
||||||
packageName = parameters.getString("package");
|
packageName = parameters.getString("package_name");
|
||||||
packageID = packageName + ":id/";
|
packageID = packageName + ":id/";
|
||||||
}
|
}
|
||||||
|
|
24
wlauto/external/uiauto/build.gradle
vendored
Normal file
24
wlauto/external/uiauto/build.gradle
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:2.3.2'
|
||||||
|
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
12
wlauto/external/uiauto/build.sh
vendored
12
wlauto/external/uiauto/build.sh
vendored
@ -14,14 +14,18 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Ensure gradelw exists before starting
|
||||||
|
if [[ ! -f gradlew ]]; then
|
||||||
|
echo 'gradlew file not found! Check that you are in the right directory.'
|
||||||
|
exit 9
|
||||||
|
fi
|
||||||
|
|
||||||
# Build and return appropriate exit code if failed
|
# Build and return appropriate exit code if failed
|
||||||
ant build
|
./gradlew clean :app:assembleDebug
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
if [ $exit_code -ne 0 ]; then
|
if [ $exit_code -ne 0 ]; then
|
||||||
echo "ERROR: 'ant build' exited with code $exit_code"
|
echo "ERROR: 'gradle build' exited with code $exit_code"
|
||||||
exit $exit_code
|
exit $exit_code
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp bin/classes/com/arm/wlauto/uiauto/*.class ../../common/android
|
cp app/build/outputs/aar/app-debug.aar ../../common/android/uiauto.aar
|
||||||
|
92
wlauto/external/uiauto/build.xml
vendored
92
wlauto/external/uiauto/build.xml
vendored
@ -1,92 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project name="com.arm.wlauto.uiauto" default="help">
|
|
||||||
|
|
||||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
|
||||||
It contains the path to the SDK. It should *NOT* be checked into
|
|
||||||
Version Control Systems. -->
|
|
||||||
<property file="local.properties" />
|
|
||||||
|
|
||||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
|
||||||
'android' tool to add properties to it.
|
|
||||||
This is the place to change some Ant specific build properties.
|
|
||||||
Here are some properties you may want to change/update:
|
|
||||||
|
|
||||||
source.dir
|
|
||||||
The name of the source directory. Default is 'src'.
|
|
||||||
out.dir
|
|
||||||
The name of the output directory. Default is 'bin'.
|
|
||||||
|
|
||||||
For other overridable properties, look at the beginning of the rules
|
|
||||||
files in the SDK, at tools/ant/build.xml
|
|
||||||
|
|
||||||
Properties related to the SDK location or the project target should
|
|
||||||
be updated using the 'android' tool with the 'update' action.
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems.
|
|
||||||
|
|
||||||
-->
|
|
||||||
<property file="ant.properties" />
|
|
||||||
|
|
||||||
<!-- if sdk.dir was not set from one of the property file, then
|
|
||||||
get it from the ANDROID_HOME env var.
|
|
||||||
This must be done before we load project.properties since
|
|
||||||
the proguard config can use sdk.dir -->
|
|
||||||
<property environment="env" />
|
|
||||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
|
||||||
<isset property="env.ANDROID_HOME" />
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<!-- The project.properties file is created and updated by the 'android'
|
|
||||||
tool, as well as ADT.
|
|
||||||
|
|
||||||
This contains project specific properties such as project target, and library
|
|
||||||
dependencies. Lower level build properties are stored in ant.properties
|
|
||||||
(or in .classpath for Eclipse projects).
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems. -->
|
|
||||||
<loadproperties srcFile="project.properties" />
|
|
||||||
|
|
||||||
<!-- quick check on sdk.dir -->
|
|
||||||
<fail
|
|
||||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
|
||||||
unless="sdk.dir"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Import per project custom build rules if present at the root of the project.
|
|
||||||
This is the place to put custom intermediary targets such as:
|
|
||||||
-pre-build
|
|
||||||
-pre-compile
|
|
||||||
-post-compile (This is typically used for code obfuscation.
|
|
||||||
Compiled code location: ${out.classes.absolute.dir}
|
|
||||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
|
||||||
-post-package
|
|
||||||
-post-build
|
|
||||||
-pre-clean
|
|
||||||
-->
|
|
||||||
<import file="custom_rules.xml" optional="true" />
|
|
||||||
|
|
||||||
<!-- Import the actual build file.
|
|
||||||
|
|
||||||
To customize existing targets, there are two options:
|
|
||||||
- Customize only one target:
|
|
||||||
- copy/paste the target into this file, *before* the
|
|
||||||
<import> task.
|
|
||||||
- customize it to your needs.
|
|
||||||
- Customize the whole content of build.xml
|
|
||||||
- copy/paste the content of the rules files (minus the top node)
|
|
||||||
into this file, replacing the <import> task.
|
|
||||||
- customize to your needs.
|
|
||||||
|
|
||||||
***********************
|
|
||||||
****** IMPORTANT ******
|
|
||||||
***********************
|
|
||||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
|
||||||
in order to avoid having your file be overridden by tools such as "android update project"
|
|
||||||
-->
|
|
||||||
<!-- version-tag: VERSION_TAG -->
|
|
||||||
<import file="${sdk.dir}/tools/ant/uibuild.xml" />
|
|
||||||
|
|
||||||
</project>
|
|
BIN
wlauto/external/uiauto/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
wlauto/external/uiauto/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
wlauto/external/uiauto/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
wlauto/external/uiauto/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#Wed May 03 15:42:44 BST 2017
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
160
wlauto/external/uiauto/gradlew
vendored
Executable file
160
wlauto/external/uiauto/gradlew
vendored
Executable file
@ -0,0 +1,160 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
wlauto/external/uiauto/gradlew.bat
vendored
Normal file
90
wlauto/external/uiauto/gradlew.bat
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
14
wlauto/external/uiauto/project.properties
vendored
14
wlauto/external/uiauto/project.properties
vendored
@ -1,14 +0,0 @@
|
|||||||
# This file is automatically generated by Android Tools.
|
|
||||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
|
||||||
#
|
|
||||||
# This file must be checked in Version Control Systems.
|
|
||||||
#
|
|
||||||
# To customize properties used by the Ant build system edit
|
|
||||||
# "ant.properties", and override values to adapt the script to your
|
|
||||||
# project structure.
|
|
||||||
#
|
|
||||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
|
||||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
|
||||||
|
|
||||||
# Project target.
|
|
||||||
target=android-18
|
|
1
wlauto/external/uiauto/settings.gradle
vendored
Normal file
1
wlauto/external/uiauto/settings.gradle
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
include ':app'
|
@ -122,6 +122,11 @@ class PackageApkGetter(PackageFileGetter):
|
|||||||
return get_from_location_by_extension(resource, resource_dir, self.extension, version, variant=variant)
|
return get_from_location_by_extension(resource, resource_dir, self.extension, version, variant=variant)
|
||||||
|
|
||||||
|
|
||||||
|
class PackageUiautoApkGetter(PackageApkGetter):
|
||||||
|
name = 'uiautoapk'
|
||||||
|
extension = 'uiautoapk'
|
||||||
|
|
||||||
|
|
||||||
class PackageJarGetter(PackageFileGetter):
|
class PackageJarGetter(PackageFileGetter):
|
||||||
name = 'package_jar'
|
name = 'package_jar'
|
||||||
extension = 'jar'
|
extension = 'jar'
|
||||||
@ -407,7 +412,7 @@ class HttpGetter(ResourceGetter):
|
|||||||
assets = self.index.get(resource.owner.name, {})
|
assets = self.index.get(resource.owner.name, {})
|
||||||
if not assets:
|
if not assets:
|
||||||
return {}
|
return {}
|
||||||
if resource.name in ['apk', 'jar']:
|
if resource.name in ['apk', 'jar', 'uiautoapk']:
|
||||||
paths = [a['path'] for a in assets]
|
paths = [a['path'] for a in assets]
|
||||||
version = getattr(resource, 'version', None)
|
version = getattr(resource, 'version', None)
|
||||||
found = get_from_list_by_extension(resource, paths, resource.name, version)
|
found = get_from_list_by_extension(resource, paths, resource.name, version)
|
||||||
@ -452,7 +457,7 @@ class RemoteFilerGetter(ResourceGetter):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
priority = GetterPriority.remote
|
priority = GetterPriority.remote
|
||||||
resource_type = ['apk', 'file', 'jar', 'revent']
|
resource_type = ['apk', 'file', 'jar', 'revent', 'uiautoapk']
|
||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
Parameter('remote_path', global_alias='remote_assets_path', default='',
|
Parameter('remote_path', global_alias='remote_assets_path', default='',
|
||||||
@ -500,7 +505,7 @@ class RemoteFilerGetter(ResourceGetter):
|
|||||||
|
|
||||||
def get_from(self, resource, version, location): # pylint: disable=no-self-use
|
def get_from(self, resource, version, location): # pylint: disable=no-self-use
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
if resource.name in ['apk', 'jar']:
|
if resource.name in ['apk', 'jar', 'uiautoapk']:
|
||||||
return get_from_location_by_extension(resource, location, resource.name, version)
|
return get_from_location_by_extension(resource, location, resource.name, version)
|
||||||
elif resource.name == 'file':
|
elif resource.name == 'file':
|
||||||
filepath = os.path.join(location, resource.path)
|
filepath = os.path.join(location, resource.path)
|
||||||
@ -553,15 +558,15 @@ def get_from_location_by_extension(resource, location, extension, version=None,
|
|||||||
|
|
||||||
|
|
||||||
def get_from_list_by_extension(resource, filelist, extension, version=None, variant=None):
|
def get_from_list_by_extension(resource, filelist, extension, version=None, variant=None):
|
||||||
filelist = [ff for ff in filelist if os.path.splitext(ff)[1].lower().endswith(extension)]
|
filelist = [ff for ff in filelist if os.path.splitext(ff)[1].lower().endswith('.' + extension)]
|
||||||
if variant:
|
if variant:
|
||||||
filelist = [ff for ff in filelist if variant.lower() in os.path.basename(ff).lower()]
|
filelist = [ff for ff in filelist if variant.lower() in os.path.basename(ff).lower()]
|
||||||
if version:
|
if version:
|
||||||
if extension == 'apk':
|
if extension in ['apk', 'uiautoapk']:
|
||||||
filelist = [ff for ff in filelist if version.lower() in ApkInfo(ff).version_name.lower()]
|
filelist = [ff for ff in filelist if version.lower() in ApkInfo(ff).version_name.lower()]
|
||||||
else:
|
else:
|
||||||
filelist = [ff for ff in filelist if version.lower() in os.path.basename(ff).lower()]
|
filelist = [ff for ff in filelist if version.lower() in os.path.basename(ff).lower()]
|
||||||
if extension == 'apk':
|
if extension in ['apk', 'uiautoapk']:
|
||||||
filelist = [ff for ff in filelist if not ApkInfo(ff).native_code or resource.platform in ApkInfo(ff).native_code]
|
filelist = [ff for ff in filelist if not ApkInfo(ff).native_code or resource.platform in ApkInfo(ff).native_code]
|
||||||
if len(filelist) == 1:
|
if len(filelist) == 1:
|
||||||
return filelist[0]
|
return filelist[0]
|
||||||
|
@ -103,6 +103,24 @@ ANDROID_NORMAL_PERMISSIONS = [
|
|||||||
'UNINSTALL_SHORTCUT',
|
'UNINSTALL_SHORTCUT',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
ANDROID_UNCHANGEABLE_PERMISSIONS = [
|
||||||
|
'USE_CREDENTIALS',
|
||||||
|
'MANAGE_ACCOUNTS',
|
||||||
|
'DOWNLOAD_WITHOUT_NOTIFICATION',
|
||||||
|
'AUTHENTICATE_ACCOUNTS',
|
||||||
|
'WRITE_SETTINGS',
|
||||||
|
'WRITE_SYNC_STATS',
|
||||||
|
'SUBSCRIBED_FEEDS_WRITE',
|
||||||
|
'SUBSCRIBED_FEEDS_READ',
|
||||||
|
'READ_PROFILE',
|
||||||
|
'WRITE_MEDIA_STORAGE',
|
||||||
|
'RESTART_PACKAGES',
|
||||||
|
'MOUNT_UNMOUNT_FILESYSTEMS',
|
||||||
|
'CLEAR_APP_CACHE',
|
||||||
|
'GET_TASKS',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# Package versions that are known to have problems with AndroidUiAutoBenchmark workloads.
|
# Package versions that are known to have problems with AndroidUiAutoBenchmark workloads.
|
||||||
# NOTE: ABI versions are not included.
|
# NOTE: ABI versions are not included.
|
||||||
UNSUPPORTED_PACKAGES = {
|
UNSUPPORTED_PACKAGES = {
|
||||||
|
@ -342,7 +342,7 @@ def record_state_transitions(reporter, stream):
|
|||||||
|
|
||||||
class PowerStateTransitions(object):
|
class PowerStateTransitions(object):
|
||||||
|
|
||||||
def __init__(self, filepath ):
|
def __init__(self, filepath):
|
||||||
self.filepath = filepath
|
self.filepath = filepath
|
||||||
self._wfh = open(filepath, 'w')
|
self._wfh = open(filepath, 'w')
|
||||||
self.writer = csv.writer(self._wfh)
|
self.writer = csv.writer(self._wfh)
|
||||||
|
Binary file not shown.
Binary file not shown.
35
wlauto/workloads/adobereader/uiauto/app/build.gradle
Normal file
35
wlauto/workloads/adobereader/uiauto/app/build.gradle
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
def packageName = "com.arm.wlauto.uiauto.adobereader"
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 25
|
||||||
|
buildToolsVersion '25.0.0'
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "${packageName}"
|
||||||
|
minSdkVersion 18
|
||||||
|
targetSdkVersion 25
|
||||||
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
applicationVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
output.outputFile = file("$project.buildDir/apk/${packageName}.apk")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
|
compile 'com.android.support.test:runner:0.5'
|
||||||
|
compile 'com.android.support.test:rules:0.5'
|
||||||
|
compile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
|
||||||
|
compile(name: 'uiauto', ext: 'aar')
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
flatDir {
|
||||||
|
dirs 'libs'
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.arm.wlauto.uiauto.adobereader"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
|
||||||
|
|
||||||
|
<instrumentation
|
||||||
|
android:name="android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
android:targetPackage="${applicationId}"/>
|
||||||
|
|
||||||
|
</manifest>
|
@ -1,3 +1,5 @@
|
|||||||
|
package com.arm.wlauto.uiauto.adobereader;
|
||||||
|
|
||||||
/* Copyright 2014-2016 ARM Limited
|
/* Copyright 2014-2016 ARM Limited
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -13,36 +15,40 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arm.wlauto.uiauto.adobereader;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
import android.support.test.uiautomator.UiObject;
|
||||||
|
import android.support.test.uiautomator.UiObjectNotFoundException;
|
||||||
|
import android.support.test.uiautomator.UiSelector;
|
||||||
|
|
||||||
// Import the uiautomator libraries
|
|
||||||
import com.android.uiautomator.core.UiObject;
|
|
||||||
import com.android.uiautomator.core.UiObjectNotFoundException;
|
|
||||||
import com.android.uiautomator.core.UiSelector;
|
|
||||||
|
|
||||||
import com.arm.wlauto.uiauto.UxPerfUiAutomation;
|
|
||||||
import com.arm.wlauto.uiauto.ApplaunchInterface;
|
import com.arm.wlauto.uiauto.ApplaunchInterface;
|
||||||
import com.arm.wlauto.uiauto.UiAutoUtils;
|
import com.arm.wlauto.uiauto.UiAutoUtils;
|
||||||
|
import com.arm.wlauto.uiauto.UxPerfUiAutomation;
|
||||||
|
|
||||||
import static com.arm.wlauto.uiauto.BaseUiAutomation.FindByCriteria.BY_ID;
|
import org.junit.Test;
|
||||||
import static com.arm.wlauto.uiauto.BaseUiAutomation.FindByCriteria.BY_TEXT;
|
import org.junit.runner.RunWith;
|
||||||
import static com.arm.wlauto.uiauto.BaseUiAutomation.FindByCriteria.BY_DESC;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import static com.arm.wlauto.uiauto.BaseUiAutomation.FindByCriteria.BY_DESC;
|
||||||
|
import static com.arm.wlauto.uiauto.BaseUiAutomation.FindByCriteria.BY_ID;
|
||||||
|
import static com.arm.wlauto.uiauto.BaseUiAutomation.FindByCriteria.BY_TEXT;
|
||||||
|
|
||||||
|
// Import the uiautomator libraries
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterface {
|
public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterface {
|
||||||
|
|
||||||
private long networkTimeout = TimeUnit.SECONDS.toMillis(20);
|
private long networkTimeout = TimeUnit.SECONDS.toMillis(20);
|
||||||
private long searchTimeout = TimeUnit.SECONDS.toMillis(20);
|
private long searchTimeout = TimeUnit.SECONDS.toMillis(20);
|
||||||
|
|
||||||
public void runUiAutomation() throws Exception {
|
@Test
|
||||||
|
public void runUiAutomation() throws Exception {
|
||||||
|
initialize_instrumentation();
|
||||||
parameters = getParams();
|
parameters = getParams();
|
||||||
|
|
||||||
String filename = parameters.getString("filename");
|
String filename = parameters.getString("filename");
|
||||||
@ -58,27 +64,27 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
|
|||||||
|
|
||||||
unsetScreenOrientation();
|
unsetScreenOrientation();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get application parameters and clear the initial run dialogues of the application launch.
|
// Get application parameters and clear the initial run dialogues of the application launch.
|
||||||
public void runApplicationInitialization() throws Exception {
|
public void runApplicationInitialization() throws Exception {
|
||||||
getPackageParameters();
|
getPackageParameters();
|
||||||
dismissWelcomeView();
|
dismissWelcomeView();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the UiObject that marks the end of the application launch.
|
// Sets the UiObject that marks the end of the application launch.
|
||||||
public UiObject getLaunchEndObject() {
|
public UiObject getLaunchEndObject() {
|
||||||
UiObject launchEndObject = new UiObject(new UiSelector().textContains("RECENT")
|
UiObject launchEndObject = mDevice.findObject(new UiSelector().textContains("RECENT")
|
||||||
.className("android.widget.TextView"));
|
.className("android.widget.TextView"));
|
||||||
return launchEndObject;
|
return launchEndObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the launch command for the application.
|
// Returns the launch command for the application.
|
||||||
public String getLaunchCommand() {
|
public String getLaunchCommand() {
|
||||||
String launch_command;
|
String launch_command;
|
||||||
launch_command = UiAutoUtils.createLaunchCommand(parameters);
|
launch_command = UiAutoUtils.createLaunchCommand(parameters);
|
||||||
return launch_command;
|
return launch_command;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass the workload parameters, used for applaunch
|
// Pass the workload parameters, used for applaunch
|
||||||
public void setWorkloadParameters(Bundle workload_parameters) {
|
public void setWorkloadParameters(Bundle workload_parameters) {
|
||||||
parameters = workload_parameters;
|
parameters = workload_parameters;
|
||||||
@ -91,7 +97,7 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
|
|||||||
welcomeView.swipeLeft(10);
|
welcomeView.swipeLeft(10);
|
||||||
|
|
||||||
UiObject onboarding_finish_button =
|
UiObject onboarding_finish_button =
|
||||||
new UiObject(new UiSelector().resourceId("com.adobe.reader:id/onboarding_finish_button"));
|
mDevice.findObject(new UiSelector().resourceId("com.adobe.reader:id/onboarding_finish_button"));
|
||||||
|
|
||||||
if (!onboarding_finish_button.exists()) {
|
if (!onboarding_finish_button.exists()) {
|
||||||
welcomeView.swipeLeft(10);
|
welcomeView.swipeLeft(10);
|
||||||
@ -101,22 +107,22 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
|
|||||||
|
|
||||||
// Deal with popup dialog message promoting Dropbox access
|
// Deal with popup dialog message promoting Dropbox access
|
||||||
UiObject dropBoxDialog =
|
UiObject dropBoxDialog =
|
||||||
new UiObject(new UiSelector().text("Now you can access your Dropbox files.")
|
mDevice.findObject(new UiSelector().text("Now you can access your Dropbox files.")
|
||||||
.className("android.widget.TextView"));
|
.className("android.widget.TextView"));
|
||||||
if (dropBoxDialog.exists()) {
|
if (dropBoxDialog.exists()) {
|
||||||
clickUiObject(BY_TEXT, "Remind Me Later", "android.widget.Button");
|
clickUiObject(BY_TEXT, "Remind Me Later", "android.widget.Button");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also deal with the Dropbox CoachMark blue hint popup
|
// Also deal with the Dropbox CoachMark blue hint popup
|
||||||
UiObject dropBoxcoachMark =
|
UiObject dropBoxcoachMark =
|
||||||
new UiObject(new UiSelector().description("CoachMark")
|
mDevice.findObject(new UiSelector().description("CoachMark")
|
||||||
.className("android.widget.LinearLayout"));
|
.className("android.widget.LinearLayout"));
|
||||||
if (dropBoxcoachMark.exists()) {
|
if (dropBoxcoachMark.exists()) {
|
||||||
tapDisplayCentre();
|
tapDisplayCentre();
|
||||||
}
|
}
|
||||||
|
|
||||||
UiObject actionBarTitle = new UiObject(new UiSelector().textContains("My Documents")
|
UiObject actionBarTitle = mDevice.findObject(new UiSelector().textContains("My Documents")
|
||||||
.className("android.widget.TextView"));
|
.className("android.widget.TextView"));
|
||||||
actionBarTitle.waitForExists(uiAutoTimeout);
|
actionBarTitle.waitForExists(uiAutoTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,14 +133,14 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
|
|||||||
// Select the local files list from the My Documents view
|
// Select the local files list from the My Documents view
|
||||||
clickUiObject(BY_TEXT, "LOCAL", "android.widget.TextView");
|
clickUiObject(BY_TEXT, "LOCAL", "android.widget.TextView");
|
||||||
UiObject directoryPath =
|
UiObject directoryPath =
|
||||||
new UiObject(new UiSelector().resourceId(packageID + "directoryPath"));
|
mDevice.findObject(new UiSelector().resourceId(packageID + "directoryPath"));
|
||||||
if (!directoryPath.waitForExists(TimeUnit.SECONDS.toMillis(60))) {
|
if (!directoryPath.waitForExists(TimeUnit.SECONDS.toMillis(60))) {
|
||||||
throw new UiObjectNotFoundException("Could not find any local files");
|
throw new UiObjectNotFoundException("Could not find any local files");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Click the button to search from the present file list view
|
// Click the button to search from the present file list view
|
||||||
UiObject searchButton =
|
UiObject searchButton =
|
||||||
new UiObject(new UiSelector().resourceId(packageID + "split_pane_search"));
|
mDevice.findObject(new UiSelector().resourceId(packageID + "split_pane_search"));
|
||||||
if (!searchButton.waitForExists(TimeUnit.SECONDS.toMillis(10))) {
|
if (!searchButton.waitForExists(TimeUnit.SECONDS.toMillis(10))) {
|
||||||
throw new UiObjectNotFoundException("Could not find search button");
|
throw new UiObjectNotFoundException("Could not find search button");
|
||||||
}
|
}
|
||||||
@ -142,8 +148,8 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
|
|||||||
|
|
||||||
// Enter search text into the file searchBox. This will automatically filter the list.
|
// Enter search text into the file searchBox. This will automatically filter the list.
|
||||||
UiObject searchBox =
|
UiObject searchBox =
|
||||||
new UiObject(new UiSelector().resourceIdMatches(".*search_src_text")
|
mDevice.findObject(new UiSelector().resourceIdMatches(".*search_src_text")
|
||||||
.classNameMatches("android.widget.Edit.*"));
|
.classNameMatches("android.widget.Edit.*"));
|
||||||
|
|
||||||
searchBox.setText(filename);
|
searchBox.setText(filename);
|
||||||
|
|
||||||
@ -155,7 +161,7 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
|
|||||||
fileObject.clickAndWaitForNewWindow(uiAutoTimeout);
|
fileObject.clickAndWaitForNewWindow(uiAutoTimeout);
|
||||||
// Wait for the doc to open by waiting for the viewPager UiObject to exist
|
// Wait for the doc to open by waiting for the viewPager UiObject to exist
|
||||||
UiObject viewPager =
|
UiObject viewPager =
|
||||||
new UiObject(new UiSelector().resourceId(packageID + "viewPager"));
|
mDevice.findObject(new UiSelector().resourceId(packageID + "viewPager"));
|
||||||
if (!viewPager.waitForExists(uiAutoTimeout)) {
|
if (!viewPager.waitForExists(uiAutoTimeout)) {
|
||||||
throw new UiObjectNotFoundException("Could not find \"viewPager\".");
|
throw new UiObjectNotFoundException("Could not find \"viewPager\".");
|
||||||
};
|
};
|
||||||
@ -182,13 +188,13 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
|
|||||||
uiDeviceSwipe(Direction.DOWN, 200);
|
uiDeviceSwipe(Direction.DOWN, 200);
|
||||||
|
|
||||||
UiObject view =
|
UiObject view =
|
||||||
new UiObject(new UiSelector().resourceId(packageID + "pageView"));
|
mDevice.findObject(new UiSelector().resourceId(packageID + "pageView"));
|
||||||
if (!view.waitForExists(TimeUnit.SECONDS.toMillis(10))) {
|
if (!view.waitForExists(TimeUnit.SECONDS.toMillis(10))) {
|
||||||
throw new UiObjectNotFoundException("Could not find page view");
|
throw new UiObjectNotFoundException("Could not find page view");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Map.Entry<String, GestureTestParams> pair = it.next();
|
Entry<String, GestureTestParams> pair = it.next();
|
||||||
GestureType type = pair.getValue().gestureType;
|
GestureType type = pair.getValue().gestureType;
|
||||||
Direction dir = pair.getValue().gestureDirection;
|
Direction dir = pair.getValue().gestureDirection;
|
||||||
PinchType pinch = pair.getValue().pinchType;
|
PinchType pinch = pair.getValue().pinchType;
|
||||||
@ -225,14 +231,14 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
|
|||||||
// and if not, tap again before continuing
|
// and if not, tap again before continuing
|
||||||
tapDisplayCentre();
|
tapDisplayCentre();
|
||||||
UiObject searchIcon =
|
UiObject searchIcon =
|
||||||
new UiObject(new UiSelector().resourceId(packageID + "document_view_search_icon"));
|
mDevice.findObject(new UiSelector().resourceId(packageID + "document_view_search_icon"));
|
||||||
if (!searchIcon.waitForExists(uiAutoTimeout)) {
|
if (!searchIcon.waitForExists(uiAutoTimeout)) {
|
||||||
tapDisplayCentre();
|
tapDisplayCentre();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!searchIcon.waitForExists(uiAutoTimeout)) {
|
if (!searchIcon.waitForExists(uiAutoTimeout)) {
|
||||||
searchIcon =
|
searchIcon =
|
||||||
new UiObject(new UiSelector().resourceId(packageID + "document_view_search"));
|
mDevice.findObject(new UiSelector().resourceId(packageID + "document_view_search"));
|
||||||
if (!searchIcon.waitForExists(uiAutoTimeout)) {
|
if (!searchIcon.waitForExists(uiAutoTimeout)) {
|
||||||
tapDisplayCentre();
|
tapDisplayCentre();
|
||||||
}
|
}
|
||||||
@ -247,20 +253,20 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
|
|||||||
searchIcon.clickAndWaitForNewWindow();
|
searchIcon.clickAndWaitForNewWindow();
|
||||||
|
|
||||||
UiObject searchBox =
|
UiObject searchBox =
|
||||||
new UiObject(new UiSelector().resourceIdMatches(".*search_src_text")
|
mDevice.findObject(new UiSelector().resourceIdMatches(".*search_src_text")
|
||||||
.className("android.widget.EditText"));
|
.className("android.widget.EditText"));
|
||||||
|
|
||||||
searchBox.setText(searchStrings[i]);
|
searchBox.setText(searchStrings[i]);
|
||||||
|
|
||||||
logger.start();
|
logger.start();
|
||||||
|
|
||||||
getUiDevice().getInstance().pressSearch();
|
mDevice.pressSearch();
|
||||||
pressEnter();
|
pressEnter();
|
||||||
|
|
||||||
// Check the progress bar icon. When this disappears the search is complete.
|
// Check the progress bar icon. When this disappears the search is complete.
|
||||||
UiObject progressBar =
|
UiObject progressBar =
|
||||||
new UiObject(new UiSelector().resourceId(packageID + "searchProgress")
|
mDevice.findObject(new UiSelector().resourceId(packageID + "searchProgress")
|
||||||
.className("android.widget.ProgressBar"));
|
.className("android.widget.ProgressBar"));
|
||||||
progressBar.waitForExists(uiAutoTimeout);
|
progressBar.waitForExists(uiAutoTimeout);
|
||||||
progressBar.waitUntilGone(searchTimeout);
|
progressBar.waitUntilGone(searchTimeout);
|
||||||
|
|
||||||
@ -268,8 +274,8 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
|
|||||||
|
|
||||||
// Get back to the main document view by clicking twice on the close button
|
// Get back to the main document view by clicking twice on the close button
|
||||||
UiObject searchCloseButton =
|
UiObject searchCloseButton =
|
||||||
new UiObject(new UiSelector().resourceIdMatches(".*search_close_btn")
|
mDevice.findObject(new UiSelector().resourceIdMatches(".*search_close_btn")
|
||||||
.className("android.widget.ImageView"));
|
.className("android.widget.ImageView"));
|
||||||
searchCloseButton.click();
|
searchCloseButton.click();
|
||||||
|
|
||||||
if (searchCloseButton.exists()){
|
if (searchCloseButton.exists()){
|
||||||
@ -285,39 +291,35 @@ public class UiAutomation extends UxPerfUiAutomation implements ApplaunchInterfa
|
|||||||
|
|
||||||
private void exitDocument() throws Exception {
|
private void exitDocument() throws Exception {
|
||||||
// Return from the document view to the file list view by pressing home and my documents.
|
// Return from the document view to the file list view by pressing home and my documents.
|
||||||
UiObject actionBar =
|
UiObject homeButton =
|
||||||
new UiObject(new UiSelector().resourceIdMatches(".*action_bar.*")
|
mDevice.findObject(new UiSelector().resourceId("android:id/home")
|
||||||
.classNameMatches("android.view.View.*"));
|
.className("android.widget.ImageView"));
|
||||||
if (!actionBar.exists()){
|
// Newer version of app have a menu button instead of home button.
|
||||||
|
UiObject menuButton =
|
||||||
|
mDevice.findObject(new UiSelector().description("Navigate up"));
|
||||||
|
|
||||||
|
if (!(homeButton.exists() || menuButton.exists())){
|
||||||
tapDisplayCentre();
|
tapDisplayCentre();
|
||||||
}
|
}
|
||||||
|
|
||||||
UiObject homeButton =
|
|
||||||
new UiObject(new UiSelector().resourceId("android:id/home")
|
|
||||||
.className("android.widget.ImageView"));
|
|
||||||
// Newer version of app have a menu button instead of home button.
|
|
||||||
UiObject menuButton =
|
|
||||||
new UiObject(new UiSelector().description("Navigate up")
|
|
||||||
.classNameMatches("android.widget.Image.*"));
|
|
||||||
|
|
||||||
if (homeButton.exists()){
|
if (homeButton.exists()){
|
||||||
homeButton.clickAndWaitForNewWindow();
|
homeButton.click();
|
||||||
}
|
}
|
||||||
else if (menuButton.exists()){
|
else if (menuButton.exists()){
|
||||||
menuButton.clickAndWaitForNewWindow();
|
menuButton.click();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
menuButton =
|
menuButton =
|
||||||
new UiObject(new UiSelector().resourceIdMatches(".*up.*")
|
mDevice.findObject(new UiSelector().resourceIdMatches(".*up.*")
|
||||||
.classNameMatches("android.widget.Image.*"));
|
.classNameMatches("android.widget.Image.*"));
|
||||||
menuButton.clickAndWaitForNewWindow();
|
menuButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
clickUiObject(BY_DESC, "My Documents", "android.widget.LinearLayout", true);
|
clickUiObject(BY_DESC, "My Documents", "android.widget.LinearLayout", true);
|
||||||
|
|
||||||
UiObject searchBackButton =
|
UiObject searchBackButton =
|
||||||
new UiObject(new UiSelector().description("Collapse")
|
mDevice.findObject(new UiSelector().description("Collapse")
|
||||||
.className("android.widget.ImageButton"));
|
.className("android.widget.ImageButton"));
|
||||||
if (searchBackButton.exists()){
|
if (searchBackButton.exists()){
|
||||||
searchBackButton.click();
|
searchBackButton.click();
|
||||||
}
|
}
|
23
wlauto/workloads/adobereader/uiauto/build.gradle
Normal file
23
wlauto/workloads/adobereader/uiauto/build.gradle
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:2.3.1'
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
@ -8,32 +8,33 @@ fi
|
|||||||
script_dir=`dirname $script_path`
|
script_dir=`dirname $script_path`
|
||||||
cd $script_dir
|
cd $script_dir
|
||||||
|
|
||||||
# Ensure build.xml exists before starting
|
# Ensure gradelw exists before starting
|
||||||
if [[ ! -f build.xml ]]; then
|
if [[ ! -f gradlew ]]; then
|
||||||
echo 'Ant build.xml file not found! Check that you are in the right directory.'
|
echo 'gradlew file not found! Check that you are in the right directory.'
|
||||||
exit 9
|
exit 9
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy base classes from wlauto dist
|
# Copy base class library from wlauto dist
|
||||||
class_dir=bin/classes/com/arm/wlauto/uiauto
|
libs_dir=app/libs
|
||||||
base_classes=`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', '*.aar')"`
|
||||||
mkdir -p $class_dir
|
mkdir -p $libs_dir
|
||||||
cp $base_classes $class_dir
|
cp $base_classes $libs_dir
|
||||||
|
|
||||||
# Build and return appropriate exit code if failed
|
# Build and return appropriate exit code if failed
|
||||||
ant build
|
# gradle build
|
||||||
|
./gradlew clean :app:assembleDebug
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
if [[ $exit_code -ne 0 ]]; then
|
if [[ $exit_code -ne 0 ]]; then
|
||||||
echo "ERROR: 'ant build' exited with code $exit_code"
|
echo "ERROR: 'gradle build' exited with code $exit_code"
|
||||||
exit $exit_code
|
exit $exit_code
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If successful move JAR file to workload folder (overwrite previous)
|
# If successful move APK file to workload folder (overwrite previous)
|
||||||
package=com.arm.wlauto.uiauto.adobereader.jar
|
package=com.arm.wlauto.uiauto.adobereader
|
||||||
rm -f ../$package
|
rm -f ../$package
|
||||||
if [[ -f bin/$package ]]; then
|
if [[ -f app/build/apk/$package.apk ]]; then
|
||||||
cp bin/$package ..
|
cp app/build/apk/$package.apk ../$package.uiautoapk
|
||||||
else
|
else
|
||||||
echo 'ERROR: UiAutomator JAR could not be found!'
|
echo 'ERROR: UiAutomator apk could not be found!'
|
||||||
exit 9
|
exit 9
|
||||||
fi
|
fi
|
||||||
|
@ -1,92 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project name="com.arm.wlauto.uiauto.adobereader" default="help">
|
|
||||||
|
|
||||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
|
||||||
It contains the path to the SDK. It should *NOT* be checked into
|
|
||||||
Version Control Systems. -->
|
|
||||||
<property file="local.properties" />
|
|
||||||
|
|
||||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
|
||||||
'android' tool to add properties to it.
|
|
||||||
This is the place to change some Ant specific build properties.
|
|
||||||
Here are some properties you may want to change/update:
|
|
||||||
|
|
||||||
source.dir
|
|
||||||
The name of the source directory. Default is 'src'.
|
|
||||||
out.dir
|
|
||||||
The name of the output directory. Default is 'bin'.
|
|
||||||
|
|
||||||
For other overridable properties, look at the beginning of the rules
|
|
||||||
files in the SDK, at tools/ant/build.xml
|
|
||||||
|
|
||||||
Properties related to the SDK location or the project target should
|
|
||||||
be updated using the 'android' tool with the 'update' action.
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems.
|
|
||||||
|
|
||||||
-->
|
|
||||||
<property file="ant.properties" />
|
|
||||||
|
|
||||||
<!-- if sdk.dir was not set from one of the property file, then
|
|
||||||
get it from the ANDROID_HOME env var.
|
|
||||||
This must be done before we load project.properties since
|
|
||||||
the proguard config can use sdk.dir -->
|
|
||||||
<property environment="env" />
|
|
||||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
|
||||||
<isset property="env.ANDROID_HOME" />
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<!-- The project.properties file is created and updated by the 'android'
|
|
||||||
tool, as well as ADT.
|
|
||||||
|
|
||||||
This contains project specific properties such as project target, and library
|
|
||||||
dependencies. Lower level build properties are stored in ant.properties
|
|
||||||
(or in .classpath for Eclipse projects).
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems. -->
|
|
||||||
<loadproperties srcFile="project.properties" />
|
|
||||||
|
|
||||||
<!-- quick check on sdk.dir -->
|
|
||||||
<fail
|
|
||||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
|
||||||
unless="sdk.dir"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Import per project custom build rules if present at the root of the project.
|
|
||||||
This is the place to put custom intermediary targets such as:
|
|
||||||
-pre-build
|
|
||||||
-pre-compile
|
|
||||||
-post-compile (This is typically used for code obfuscation.
|
|
||||||
Compiled code location: ${out.classes.absolute.dir}
|
|
||||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
|
||||||
-post-package
|
|
||||||
-post-build
|
|
||||||
-pre-clean
|
|
||||||
-->
|
|
||||||
<import file="custom_rules.xml" optional="true" />
|
|
||||||
|
|
||||||
<!-- Import the actual build file.
|
|
||||||
|
|
||||||
To customize existing targets, there are two options:
|
|
||||||
- Customize only one target:
|
|
||||||
- copy/paste the target into this file, *before* the
|
|
||||||
<import> task.
|
|
||||||
- customize it to your needs.
|
|
||||||
- Customize the whole content of build.xml
|
|
||||||
- copy/paste the content of the rules files (minus the top node)
|
|
||||||
into this file, replacing the <import> task.
|
|
||||||
- customize to your needs.
|
|
||||||
|
|
||||||
***********************
|
|
||||||
****** IMPORTANT ******
|
|
||||||
***********************
|
|
||||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
|
||||||
in order to avoid having your file be overridden by tools such as "android update project"
|
|
||||||
-->
|
|
||||||
<!-- version-tag: VERSION_TAG -->
|
|
||||||
<import file="${sdk.dir}/tools/ant/uibuild.xml" />
|
|
||||||
|
|
||||||
</project>
|
|
BIN
wlauto/workloads/adobereader/uiauto/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
wlauto/workloads/adobereader/uiauto/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
wlauto/workloads/adobereader/uiauto/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
wlauto/workloads/adobereader/uiauto/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#Wed May 03 15:42:44 BST 2017
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
160
wlauto/workloads/adobereader/uiauto/gradlew
vendored
Executable file
160
wlauto/workloads/adobereader/uiauto/gradlew
vendored
Executable file
@ -0,0 +1,160 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
wlauto/workloads/adobereader/uiauto/gradlew.bat
vendored
Normal file
90
wlauto/workloads/adobereader/uiauto/gradlew.bat
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
@ -1,14 +0,0 @@
|
|||||||
# This file is automatically generated by Android Tools.
|
|
||||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
|
||||||
#
|
|
||||||
# This file must be checked in Version Control Systems.
|
|
||||||
#
|
|
||||||
# To customize properties used by the Ant build system edit
|
|
||||||
# "ant.properties", and override values to adapt the script to your
|
|
||||||
# project structure.
|
|
||||||
#
|
|
||||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
|
||||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
|
||||||
|
|
||||||
# Project target.
|
|
||||||
target=android-18
|
|
1
wlauto/workloads/adobereader/uiauto/settings.gradle
Normal file
1
wlauto/workloads/adobereader/uiauto/settings.gradle
Normal file
@ -0,0 +1 @@
|
|||||||
|
include ':app'
|
Binary file not shown.
Binary file not shown.
35
wlauto/workloads/andebench/uiauto/app/build.gradle
Normal file
35
wlauto/workloads/andebench/uiauto/app/build.gradle
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
def packageName = "com.arm.wlauto.uiauto.andebench"
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 25
|
||||||
|
buildToolsVersion "25.0.3"
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "${packageName}"
|
||||||
|
minSdkVersion 18
|
||||||
|
targetSdkVersion 25
|
||||||
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
applicationVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
output.outputFile = file("$project.buildDir/apk/${packageName}.apk")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
compile 'com.android.support.test:runner:0.5'
|
||||||
|
compile 'com.android.support.test:rules:0.5'
|
||||||
|
compile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
|
||||||
|
compile(name: 'uiauto', ext:'aar')
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
flatDir {
|
||||||
|
dirs 'libs'
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.arm.wlauto.uiauto.andebench"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
|
||||||
|
<instrumentation
|
||||||
|
android:name="android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
android:targetPackage="${applicationId}"/>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
|
|
@ -16,20 +16,22 @@
|
|||||||
|
|
||||||
package com.arm.wlauto.uiauto.andebench;
|
package com.arm.wlauto.uiauto.andebench;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
import android.support.test.uiautomator.UiObject;
|
||||||
|
import android.support.test.uiautomator.UiObjectNotFoundException;
|
||||||
|
import android.support.test.uiautomator.UiSelector;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.uiautomator.core.UiObject;
|
|
||||||
import com.android.uiautomator.core.UiObjectNotFoundException;
|
|
||||||
import com.android.uiautomator.core.UiScrollable;
|
|
||||||
import com.android.uiautomator.core.UiSelector;
|
|
||||||
import com.android.uiautomator.testrunner.UiAutomatorTestCase;
|
|
||||||
|
|
||||||
import com.arm.wlauto.uiauto.BaseUiAutomation;
|
import com.arm.wlauto.uiauto.BaseUiAutomation;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class UiAutomation extends BaseUiAutomation {
|
public class UiAutomation extends BaseUiAutomation {
|
||||||
|
|
||||||
public static String TAG = "andebench";
|
public static String TAG = "andebench";
|
||||||
@ -37,24 +39,26 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
private static int initialTimeoutSeconds = 20;
|
private static int initialTimeoutSeconds = 20;
|
||||||
private static int shortDelaySeconds = 3;
|
private static int shortDelaySeconds = 3;
|
||||||
|
|
||||||
|
@Test
|
||||||
public void runUiAutomation() throws Exception{
|
public void runUiAutomation() throws Exception{
|
||||||
|
initialize_instrumentation();
|
||||||
Bundle status = new Bundle();
|
Bundle status = new Bundle();
|
||||||
Bundle params = getParams();
|
Bundle params = getParams();
|
||||||
String numThreads = params.getString("number_of_threads");
|
String numThreads = params.getString("number_of_threads");
|
||||||
Boolean nativeOnly = params.getBoolean("native_only");
|
Boolean nativeOnly = params.getBoolean("native_only");
|
||||||
status.putString("product", getUiDevice().getProductName());
|
status.putString("product", mDevice.getProductName());
|
||||||
|
|
||||||
waitForStartButton();
|
waitForStartButton();
|
||||||
setConfiguration(numThreads, nativeOnly);
|
setConfiguration(numThreads, nativeOnly);
|
||||||
hitStart();
|
hitStart();
|
||||||
waitForAndExtractResuts();
|
waitForAndExtractResuts();
|
||||||
|
|
||||||
getAutomationSupport().sendStatus(Activity.RESULT_OK, status);
|
mInstrumentation.sendStatus(Activity.RESULT_OK, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void waitForStartButton() throws Exception {
|
public void waitForStartButton() throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject startButton = new UiObject(selector.className("android.widget.ImageButton")
|
UiObject startButton = mDevice.findObject(selector.className("android.widget.ImageButton")
|
||||||
.packageName("com.eembc.coremark"));
|
.packageName("com.eembc.coremark"));
|
||||||
if (!startButton.waitForExists(TimeUnit.SECONDS.toMillis(initialTimeoutSeconds))) {
|
if (!startButton.waitForExists(TimeUnit.SECONDS.toMillis(initialTimeoutSeconds))) {
|
||||||
throw new UiObjectNotFoundException("Did not see start button.");
|
throw new UiObjectNotFoundException("Did not see start button.");
|
||||||
@ -63,21 +67,21 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
|
|
||||||
public void setConfiguration(String numThreads, boolean nativeOnly) throws Exception {
|
public void setConfiguration(String numThreads, boolean nativeOnly) throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
getUiDevice().pressMenu();
|
mDevice.pressMenu();
|
||||||
|
|
||||||
UiObject settingsButton = new UiObject(selector.clickable(true));
|
UiObject settingsButton = mDevice.findObject(selector.clickable(true));
|
||||||
settingsButton.click();
|
settingsButton.click();
|
||||||
|
|
||||||
if (nativeOnly) {
|
if (nativeOnly) {
|
||||||
UiObject nativeButton = new UiObject(selector.textContains("Native"));
|
UiObject nativeButton = mDevice.findObject(selector.textContains("Native"));
|
||||||
nativeButton.click();
|
nativeButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
UiObject threadNumberField = new UiObject(selector.className("android.widget.EditText"));
|
UiObject threadNumberField = mDevice.findObject(selector.className("android.widget.EditText"));
|
||||||
threadNumberField.clearTextField();
|
threadNumberField.clearTextField();
|
||||||
threadNumberField.setText(numThreads);
|
threadNumberField.setText(numThreads);
|
||||||
|
|
||||||
getUiDevice().pressBack();
|
mDevice.pressBack();
|
||||||
sleep(shortDelaySeconds);
|
sleep(shortDelaySeconds);
|
||||||
// If the device does not have a physical keyboard, a virtual one might have
|
// If the device does not have a physical keyboard, a virtual one might have
|
||||||
// poped up when setting the number of threads. If that happend, then the above
|
// poped up when setting the number of threads. If that happend, then the above
|
||||||
@ -85,14 +89,14 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
// from the settings screen.
|
// from the settings screen.
|
||||||
if(threadNumberField.exists())
|
if(threadNumberField.exists())
|
||||||
{
|
{
|
||||||
getUiDevice().pressBack();
|
mDevice.pressBack();
|
||||||
sleep(shortDelaySeconds);
|
sleep(shortDelaySeconds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hitStart() throws Exception {
|
public void hitStart() throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject startButton = new UiObject(selector.className("android.widget.ImageButton")
|
UiObject startButton = mDevice.findObject(selector.className("android.widget.ImageButton")
|
||||||
.packageName("com.eembc.coremark"));
|
.packageName("com.eembc.coremark"));
|
||||||
startButton.click();
|
startButton.click();
|
||||||
sleep(shortDelaySeconds);
|
sleep(shortDelaySeconds);
|
||||||
@ -100,12 +104,12 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
|
|
||||||
public void waitForAndExtractResuts() throws Exception {
|
public void waitForAndExtractResuts() throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject runningText = new UiObject(selector.textContains("Running...")
|
UiObject runningText = mDevice.findObject(selector.textContains("Running...")
|
||||||
.className("android.widget.TextView")
|
.className("android.widget.TextView")
|
||||||
.packageName("com.eembc.coremark"));
|
.packageName("com.eembc.coremark"));
|
||||||
runningText.waitUntilGone(TimeUnit.SECONDS.toMillis(600));
|
runningText.waitUntilGone(TimeUnit.SECONDS.toMillis(600));
|
||||||
|
|
||||||
UiObject resultText = new UiObject(selector.textContains("Results in Iterations/sec:")
|
UiObject resultText = mDevice.findObject(selector.textContains("Results in Iterations/sec:")
|
||||||
.className("android.widget.TextView")
|
.className("android.widget.TextView")
|
||||||
.packageName("com.eembc.coremark"));
|
.packageName("com.eembc.coremark"));
|
||||||
resultText.waitForExists(TimeUnit.SECONDS.toMillis(shortDelaySeconds));
|
resultText.waitForExists(TimeUnit.SECONDS.toMillis(shortDelaySeconds));
|
23
wlauto/workloads/andebench/uiauto/build.gradle
Normal file
23
wlauto/workloads/andebench/uiauto/build.gradle
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:2.3.1'
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
@ -1,29 +1,40 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Copyright 2013-2015 ARM Limited
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
# CD into build dir if possible - allows building from any directory
|
||||||
|
script_path='.'
|
||||||
class_dir=bin/classes/com/arm/wlauto/uiauto
|
if `readlink -f $0 &>/dev/null`; then
|
||||||
base_class=`python -c "import os, wlauto; print os.path.join(os.path.dirname(wlauto.__file__), 'common', 'android', 'BaseUiAutomation.class')"`
|
script_path=`readlink -f $0 2>/dev/null`
|
||||||
mkdir -p $class_dir
|
fi
|
||||||
cp $base_class $class_dir
|
script_dir=`dirname $script_path`
|
||||||
|
cd $script_dir
|
||||||
${ANDROID_HOME}/tools/android update project -p .
|
|
||||||
ant build
|
# Ensure gradelw exists before starting
|
||||||
|
if [[ ! -f gradlew ]]; then
|
||||||
if [[ -f bin/com.arm.wlauto.uiauto.andebench.jar ]]; then
|
echo 'gradlew file not found! Check that you are in the right directory.'
|
||||||
cp bin/com.arm.wlauto.uiauto.andebench.jar ..
|
exit 9
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy base class library from wlauto dist
|
||||||
|
libs_dir=app/libs
|
||||||
|
base_classes=`python -c "import os, wlauto; print os.path.join(os.path.dirname(wlauto.__file__), 'common', 'android', '*.aar')"`
|
||||||
|
mkdir -p $libs_dir
|
||||||
|
cp $base_classes $libs_dir
|
||||||
|
|
||||||
|
# Build and return appropriate exit code if failed
|
||||||
|
# gradle build
|
||||||
|
./gradlew clean :app:assembleDebug
|
||||||
|
exit_code=$?
|
||||||
|
if [[ $exit_code -ne 0 ]]; then
|
||||||
|
echo "ERROR: 'gradle build' exited with code $exit_code"
|
||||||
|
exit $exit_code
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If successful move APK file to workload folder (overwrite previous)
|
||||||
|
package=com.arm.wlauto.uiauto.andebench
|
||||||
|
rm -f ../$package
|
||||||
|
if [[ -f app/build/apk/$package.apk ]]; then
|
||||||
|
cp app/build/apk/$package.apk ../$package.uiautoapk
|
||||||
|
else
|
||||||
|
echo 'ERROR: UiAutomator apk could not be found!'
|
||||||
|
exit 9
|
||||||
fi
|
fi
|
||||||
|
@ -1,92 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project name="com.arm.wlauto.uiauto.andebench" default="help">
|
|
||||||
|
|
||||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
|
||||||
It contains the path to the SDK. It should *NOT* be checked into
|
|
||||||
Version Control Systems. -->
|
|
||||||
<property file="local.properties" />
|
|
||||||
|
|
||||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
|
||||||
'android' tool to add properties to it.
|
|
||||||
This is the place to change some Ant specific build properties.
|
|
||||||
Here are some properties you may want to change/update:
|
|
||||||
|
|
||||||
source.dir
|
|
||||||
The name of the source directory. Default is 'src'.
|
|
||||||
out.dir
|
|
||||||
The name of the output directory. Default is 'bin'.
|
|
||||||
|
|
||||||
For other overridable properties, look at the beginning of the rules
|
|
||||||
files in the SDK, at tools/ant/build.xml
|
|
||||||
|
|
||||||
Properties related to the SDK location or the project target should
|
|
||||||
be updated using the 'android' tool with the 'update' action.
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems.
|
|
||||||
|
|
||||||
-->
|
|
||||||
<property file="ant.properties" />
|
|
||||||
|
|
||||||
<!-- if sdk.dir was not set from one of the property file, then
|
|
||||||
get it from the ANDROID_HOME env var.
|
|
||||||
This must be done before we load project.properties since
|
|
||||||
the proguard config can use sdk.dir -->
|
|
||||||
<property environment="env" />
|
|
||||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
|
||||||
<isset property="env.ANDROID_HOME" />
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<!-- The project.properties file is created and updated by the 'android'
|
|
||||||
tool, as well as ADT.
|
|
||||||
|
|
||||||
This contains project specific properties such as project target, and library
|
|
||||||
dependencies. Lower level build properties are stored in ant.properties
|
|
||||||
(or in .classpath for Eclipse projects).
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems. -->
|
|
||||||
<loadproperties srcFile="project.properties" />
|
|
||||||
|
|
||||||
<!-- quick check on sdk.dir -->
|
|
||||||
<fail
|
|
||||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
|
||||||
unless="sdk.dir"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Import per project custom build rules if present at the root of the project.
|
|
||||||
This is the place to put custom intermediary targets such as:
|
|
||||||
-pre-build
|
|
||||||
-pre-compile
|
|
||||||
-post-compile (This is typically used for code obfuscation.
|
|
||||||
Compiled code location: ${out.classes.absolute.dir}
|
|
||||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
|
||||||
-post-package
|
|
||||||
-post-build
|
|
||||||
-pre-clean
|
|
||||||
-->
|
|
||||||
<import file="custom_rules.xml" optional="true" />
|
|
||||||
|
|
||||||
<!-- Import the actual build file.
|
|
||||||
|
|
||||||
To customize existing targets, there are two options:
|
|
||||||
- Customize only one target:
|
|
||||||
- copy/paste the target into this file, *before* the
|
|
||||||
<import> task.
|
|
||||||
- customize it to your needs.
|
|
||||||
- Customize the whole content of build.xml
|
|
||||||
- copy/paste the content of the rules files (minus the top node)
|
|
||||||
into this file, replacing the <import> task.
|
|
||||||
- customize to your needs.
|
|
||||||
|
|
||||||
***********************
|
|
||||||
****** IMPORTANT ******
|
|
||||||
***********************
|
|
||||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
|
||||||
in order to avoid having your file be overridden by tools such as "android update project"
|
|
||||||
-->
|
|
||||||
<!-- version-tag: VERSION_TAG -->
|
|
||||||
<import file="${sdk.dir}/tools/ant/uibuild.xml" />
|
|
||||||
|
|
||||||
</project>
|
|
BIN
wlauto/workloads/andebench/uiauto/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
wlauto/workloads/andebench/uiauto/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
wlauto/workloads/andebench/uiauto/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
wlauto/workloads/andebench/uiauto/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#Wed May 03 15:42:44 BST 2017
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
160
wlauto/workloads/andebench/uiauto/gradlew
vendored
Executable file
160
wlauto/workloads/andebench/uiauto/gradlew
vendored
Executable file
@ -0,0 +1,160 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
wlauto/workloads/andebench/uiauto/gradlew.bat
vendored
Normal file
90
wlauto/workloads/andebench/uiauto/gradlew.bat
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
@ -1,14 +0,0 @@
|
|||||||
# This file is automatically generated by Android Tools.
|
|
||||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
|
||||||
#
|
|
||||||
# This file must be checked in Version Control Systems.
|
|
||||||
#
|
|
||||||
# To customize properties used by the Ant build system edit
|
|
||||||
# "ant.properties", and override values to adapt the script to your
|
|
||||||
# project structure.
|
|
||||||
#
|
|
||||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
|
||||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
|
||||||
|
|
||||||
# Project target.
|
|
||||||
target=android-18
|
|
1
wlauto/workloads/andebench/uiauto/settings.gradle
Normal file
1
wlauto/workloads/andebench/uiauto/settings.gradle
Normal file
@ -0,0 +1 @@
|
|||||||
|
include ':app'
|
Binary file not shown.
Binary file not shown.
35
wlauto/workloads/androbench/uiauto/app/build.gradle
Normal file
35
wlauto/workloads/androbench/uiauto/app/build.gradle
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
def packageName = "com.arm.wlauto.uiauto.androbench"
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 25
|
||||||
|
buildToolsVersion "25.0.3"
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "${packageName}"
|
||||||
|
minSdkVersion 18
|
||||||
|
targetSdkVersion 25
|
||||||
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
applicationVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
output.outputFile = file("$project.buildDir/apk/${packageName}.apk")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
compile 'com.android.support.test:runner:0.5'
|
||||||
|
compile 'com.android.support.test:rules:0.5'
|
||||||
|
compile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
|
||||||
|
compile(name: 'uiauto', ext:'aar')
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
flatDir {
|
||||||
|
dirs 'libs'
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.arm.wlauto.uiauto.androbench"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
|
||||||
|
|
||||||
|
<instrumentation
|
||||||
|
android:name="android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
android:targetPackage="${applicationId}"/>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
|
|
@ -18,50 +18,51 @@ package com.arm.wlauto.uiauto.androbench;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
import android.support.test.uiautomator.UiObject;
|
||||||
// Import the uiautomator libraries
|
import android.support.test.uiautomator.UiSelector;
|
||||||
import com.android.uiautomator.core.UiObject;
|
|
||||||
import com.android.uiautomator.core.UiObjectNotFoundException;
|
|
||||||
import com.android.uiautomator.core.UiScrollable;
|
|
||||||
import com.android.uiautomator.core.UiSelector;
|
|
||||||
import com.android.uiautomator.testrunner.UiAutomatorTestCase;
|
|
||||||
|
|
||||||
import com.arm.wlauto.uiauto.BaseUiAutomation;
|
import com.arm.wlauto.uiauto.BaseUiAutomation;
|
||||||
|
|
||||||
public class UiAutomation extends BaseUiAutomation {
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
// Import the uiautomator libraries
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class UiAutomation extends BaseUiAutomation {
|
||||||
|
|
||||||
public static String TAG = "androbench";
|
public static String TAG = "androbench";
|
||||||
|
|
||||||
public void runUiAutomation() throws Exception {
|
@Test
|
||||||
|
public void runUiAutomation() throws Exception {
|
||||||
|
initialize_instrumentation();
|
||||||
Bundle status = new Bundle();
|
Bundle status = new Bundle();
|
||||||
status.putString("product", getUiDevice().getProductName());
|
status.putString("product", mDevice.getProductName());
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
sleep(3);
|
sleep(3);
|
||||||
UiObject btn_microbench = new UiObject(selector .textContains("Micro")
|
UiObject btn_microbench = mDevice.findObject(selector.textContains("Micro")
|
||||||
.className("android.widget.Button"));
|
.className("android.widget.Button"));
|
||||||
btn_microbench.click();
|
btn_microbench.click();
|
||||||
|
|
||||||
UiObject btn_yes= new UiObject(selector .textContains("Yes")
|
UiObject btn_yes= mDevice.findObject(selector.textContains("Yes")
|
||||||
.className("android.widget.Button"));
|
.className("android.widget.Button"));
|
||||||
btn_yes.click();
|
btn_yes.click();
|
||||||
|
|
||||||
|
try {
|
||||||
|
UiObject complete_text = mDevice.findObject(selector.text("Cancel")
|
||||||
|
.className("android.widget.Button"));
|
||||||
|
|
||||||
try{
|
waitObject(complete_text);
|
||||||
UiObject complete_text = new UiObject(selector .text("Cancel")
|
|
||||||
.className("android.widget.Button"));
|
|
||||||
|
|
||||||
waitObject(complete_text);
|
|
||||||
|
|
||||||
sleep(2);
|
sleep(2);
|
||||||
complete_text.click();
|
complete_text.click();
|
||||||
} finally{
|
} finally {
|
||||||
//complete_text.click();
|
//complete_text.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(5);
|
sleep(5);
|
||||||
takeScreenshot("Androbench");
|
takeScreenshot("Androbench");
|
||||||
getAutomationSupport().sendStatus(Activity.RESULT_OK, status);
|
mInstrumentation.sendStatus(Activity.RESULT_OK, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
23
wlauto/workloads/androbench/uiauto/build.gradle
Normal file
23
wlauto/workloads/androbench/uiauto/build.gradle
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:2.3.1'
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
@ -1,28 +1,40 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Copyright 2013-2015 ARM Limited
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
# CD into build dir if possible - allows building from any directory
|
||||||
|
script_path='.'
|
||||||
class_dir=bin/classes/com/arm/wlauto/uiauto
|
if `readlink -f $0 &>/dev/null`; then
|
||||||
base_class=`python -c "import os, wlauto; print os.path.join(os.path.dirname(wlauto.__file__), 'common', 'android', 'BaseUiAutomation.class')"`
|
script_path=`readlink -f $0 2>/dev/null`
|
||||||
mkdir -p $class_dir
|
fi
|
||||||
cp $base_class $class_dir
|
script_dir=`dirname $script_path`
|
||||||
|
cd $script_dir
|
||||||
ant build
|
|
||||||
|
# Ensure gradelw exists before starting
|
||||||
if [[ -f bin/com.arm.wlauto.uiauto.androbench.jar ]]; then
|
if [[ ! -f gradlew ]]; then
|
||||||
cp bin/com.arm.wlauto.uiauto.androbench.jar ..
|
echo 'gradlew file not found! Check that you are in the right directory.'
|
||||||
|
exit 9
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy base class library from wlauto dist
|
||||||
|
libs_dir=app/libs
|
||||||
|
base_classes=`python -c "import os, wlauto; print os.path.join(os.path.dirname(wlauto.__file__), 'common', 'android', '*.aar')"`
|
||||||
|
mkdir -p $libs_dir
|
||||||
|
cp $base_classes $libs_dir
|
||||||
|
|
||||||
|
# Build and return appropriate exit code if failed
|
||||||
|
# gradle build
|
||||||
|
./gradlew clean :app:assembleDebug
|
||||||
|
exit_code=$?
|
||||||
|
if [[ $exit_code -ne 0 ]]; then
|
||||||
|
echo "ERROR: 'gradle build' exited with code $exit_code"
|
||||||
|
exit $exit_code
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If successful move APK file to workload folder (overwrite previous)
|
||||||
|
package=com.arm.wlauto.uiauto.androbench
|
||||||
|
rm -f ../$package
|
||||||
|
if [[ -f app/build/apk/$package.apk ]]; then
|
||||||
|
cp app/build/apk/$package.apk ../$package.uiautoapk
|
||||||
|
else
|
||||||
|
echo 'ERROR: UiAutomator apk could not be found!'
|
||||||
|
exit 9
|
||||||
fi
|
fi
|
||||||
|
@ -1,92 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project name="com.arm.wlauto.uiauto.androbench" default="help">
|
|
||||||
|
|
||||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
|
||||||
It contains the path to the SDK. It should *NOT* be checked into
|
|
||||||
Version Control Systems. -->
|
|
||||||
<property file="local.properties" />
|
|
||||||
|
|
||||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
|
||||||
'android' tool to add properties to it.
|
|
||||||
This is the place to change some Ant specific build properties.
|
|
||||||
Here are some properties you may want to change/update:
|
|
||||||
|
|
||||||
source.dir
|
|
||||||
The name of the source directory. Default is 'src'.
|
|
||||||
out.dir
|
|
||||||
The name of the output directory. Default is 'bin'.
|
|
||||||
|
|
||||||
For other overridable properties, look at the beginning of the rules
|
|
||||||
files in the SDK, at tools/ant/build.xml
|
|
||||||
|
|
||||||
Properties related to the SDK location or the project target should
|
|
||||||
be updated using the 'android' tool with the 'update' action.
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems.
|
|
||||||
|
|
||||||
-->
|
|
||||||
<property file="ant.properties" />
|
|
||||||
|
|
||||||
<!-- if sdk.dir was not set from one of the property file, then
|
|
||||||
get it from the ANDROID_HOME env var.
|
|
||||||
This must be done before we load project.properties since
|
|
||||||
the proguard config can use sdk.dir -->
|
|
||||||
<property environment="env" />
|
|
||||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
|
||||||
<isset property="env.ANDROID_HOME" />
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<!-- The project.properties file is created and updated by the 'android'
|
|
||||||
tool, as well as ADT.
|
|
||||||
|
|
||||||
This contains project specific properties such as project target, and library
|
|
||||||
dependencies. Lower level build properties are stored in ant.properties
|
|
||||||
(or in .classpath for Eclipse projects).
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems. -->
|
|
||||||
<loadproperties srcFile="project.properties" />
|
|
||||||
|
|
||||||
<!-- quick check on sdk.dir -->
|
|
||||||
<fail
|
|
||||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
|
||||||
unless="sdk.dir"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Import per project custom build rules if present at the root of the project.
|
|
||||||
This is the place to put custom intermediary targets such as:
|
|
||||||
-pre-build
|
|
||||||
-pre-compile
|
|
||||||
-post-compile (This is typically used for code obfuscation.
|
|
||||||
Compiled code location: ${out.classes.absolute.dir}
|
|
||||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
|
||||||
-post-package
|
|
||||||
-post-build
|
|
||||||
-pre-clean
|
|
||||||
-->
|
|
||||||
<import file="custom_rules.xml" optional="true" />
|
|
||||||
|
|
||||||
<!-- Import the actual build file.
|
|
||||||
|
|
||||||
To customize existing targets, there are two options:
|
|
||||||
- Customize only one target:
|
|
||||||
- copy/paste the target into this file, *before* the
|
|
||||||
<import> task.
|
|
||||||
- customize it to your needs.
|
|
||||||
- Customize the whole content of build.xml
|
|
||||||
- copy/paste the content of the rules files (minus the top node)
|
|
||||||
into this file, replacing the <import> task.
|
|
||||||
- customize to your needs.
|
|
||||||
|
|
||||||
***********************
|
|
||||||
****** IMPORTANT ******
|
|
||||||
***********************
|
|
||||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
|
||||||
in order to avoid having your file be overridden by tools such as "android update project"
|
|
||||||
-->
|
|
||||||
<!-- version-tag: VERSION_TAG -->
|
|
||||||
<import file="${sdk.dir}/tools/ant/uibuild.xml" />
|
|
||||||
|
|
||||||
</project>
|
|
BIN
wlauto/workloads/androbench/uiauto/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
wlauto/workloads/androbench/uiauto/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
wlauto/workloads/androbench/uiauto/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
wlauto/workloads/androbench/uiauto/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#Wed May 03 15:42:44 BST 2017
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
160
wlauto/workloads/androbench/uiauto/gradlew
vendored
Executable file
160
wlauto/workloads/androbench/uiauto/gradlew
vendored
Executable file
@ -0,0 +1,160 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
wlauto/workloads/androbench/uiauto/gradlew.bat
vendored
Normal file
90
wlauto/workloads/androbench/uiauto/gradlew.bat
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
@ -1,14 +0,0 @@
|
|||||||
# This file is automatically generated by Android Tools.
|
|
||||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
|
||||||
#
|
|
||||||
# This file must be checked in Version Control Systems.
|
|
||||||
#
|
|
||||||
# To customize properties used by the Ant build system edit
|
|
||||||
# "ant.properties", and override values to adapt the script to your
|
|
||||||
# project structure.
|
|
||||||
#
|
|
||||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
|
||||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
|
||||||
|
|
||||||
# Project target.
|
|
||||||
target=android-18
|
|
1
wlauto/workloads/androbench/uiauto/settings.gradle
Normal file
1
wlauto/workloads/androbench/uiauto/settings.gradle
Normal file
@ -0,0 +1 @@
|
|||||||
|
include ':app'
|
Binary file not shown.
BIN
wlauto/workloads/antutu/com.arm.wlauto.uiauto.antutu.uiautoapk
Normal file
BIN
wlauto/workloads/antutu/com.arm.wlauto.uiauto.antutu.uiautoapk
Normal file
Binary file not shown.
35
wlauto/workloads/antutu/uiauto/app/build.gradle
Normal file
35
wlauto/workloads/antutu/uiauto/app/build.gradle
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
def packageName = "com.arm.wlauto.uiauto.antutu"
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 25
|
||||||
|
buildToolsVersion "25.0.3"
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "${packageName}"
|
||||||
|
minSdkVersion 18
|
||||||
|
targetSdkVersion 25
|
||||||
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
applicationVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
output.outputFile = file("$project.buildDir/apk/${packageName}.apk")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
compile 'com.android.support.test:runner:0.5'
|
||||||
|
compile 'com.android.support.test:rules:0.5'
|
||||||
|
compile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
|
||||||
|
compile(name: 'uiauto', ext:'aar')
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
flatDir {
|
||||||
|
dirs 'libs'
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.arm.wlauto.uiauto.antutu"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
|
||||||
|
|
||||||
|
<instrumentation
|
||||||
|
android:name="android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
android:targetPackage="${applicationId}"/>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
|
|
@ -16,24 +16,27 @@
|
|||||||
|
|
||||||
package com.arm.wlauto.uiauto.antutu;
|
package com.arm.wlauto.uiauto.antutu;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
import android.support.test.uiautomator.UiObject;
|
||||||
|
import android.support.test.uiautomator.UiObjectNotFoundException;
|
||||||
|
import android.support.test.uiautomator.UiScrollable;
|
||||||
|
import android.support.test.uiautomator.UiSelector;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
// Import the uiautomator libraries
|
|
||||||
import com.android.uiautomator.core.UiObject;
|
|
||||||
import com.android.uiautomator.core.UiObjectNotFoundException;
|
|
||||||
import com.android.uiautomator.core.UiScrollable;
|
|
||||||
import com.android.uiautomator.core.UiSelector;
|
|
||||||
import com.android.uiautomator.core.UiCollection;
|
|
||||||
import com.android.uiautomator.testrunner.UiAutomatorTestCase;
|
|
||||||
|
|
||||||
import com.arm.wlauto.uiauto.BaseUiAutomation;
|
import com.arm.wlauto.uiauto.BaseUiAutomation;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
// Import the uiautomator libraries
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class UiAutomation extends BaseUiAutomation {
|
public class UiAutomation extends BaseUiAutomation {
|
||||||
|
|
||||||
public static String TAG = "antutu";
|
public static String TAG = "antutu";
|
||||||
@ -41,7 +44,9 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
public static String TestButton6 = "com.antutu.ABenchMark:id/start_test_text";
|
public static String TestButton6 = "com.antutu.ABenchMark:id/start_test_text";
|
||||||
private static int initialTimeoutSeconds = 20;
|
private static int initialTimeoutSeconds = 20;
|
||||||
|
|
||||||
public void runUiAutomation() throws Exception{
|
@Test
|
||||||
|
public void runUiAutomation() throws Exception{
|
||||||
|
initialize_instrumentation();
|
||||||
Bundle parameters = getParams();
|
Bundle parameters = getParams();
|
||||||
|
|
||||||
String version = parameters.getString("version");
|
String version = parameters.getString("version");
|
||||||
@ -74,16 +79,15 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
hitTestButton();
|
hitTestButton();
|
||||||
hitTestButton();
|
hitTestButton();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
hitTestButton();
|
hitTestButton();
|
||||||
|
}
|
||||||
|
|
||||||
if(version.equals("6.0.1"))
|
if(version.equals("6.0.1")) {
|
||||||
{
|
|
||||||
waitForVersion6Results();
|
waitForVersion6Results();
|
||||||
extractResults6();
|
extractResults6();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
waitForVersion4Results();
|
waitForVersion4Results();
|
||||||
viewDetails();
|
viewDetails();
|
||||||
extractResults();
|
extractResults();
|
||||||
@ -101,12 +105,12 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bundle status = new Bundle();
|
Bundle status = new Bundle();
|
||||||
getAutomationSupport().sendStatus(Activity.RESULT_OK, status);
|
mInstrumentation.sendStatus(Activity.RESULT_OK, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean dismissNewVersionNotificationIfNecessary() throws Exception {
|
public boolean dismissNewVersionNotificationIfNecessary() throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject closeButton = new UiObject(selector.text("Cancel"));
|
UiObject closeButton = mDevice.findObject(selector.text("Cancel"));
|
||||||
if (closeButton.waitForExists(TimeUnit.SECONDS.toMillis(initialTimeoutSeconds))) {
|
if (closeButton.waitForExists(TimeUnit.SECONDS.toMillis(initialTimeoutSeconds))) {
|
||||||
closeButton.click();
|
closeButton.click();
|
||||||
sleep(1); // diaglog dismissal
|
sleep(1); // diaglog dismissal
|
||||||
@ -118,7 +122,7 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
|
|
||||||
public boolean dismissReleaseNotesDialogIfNecessary() throws Exception {
|
public boolean dismissReleaseNotesDialogIfNecessary() throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject closeButton = new UiObject(selector.text("Close"));
|
UiObject closeButton = mDevice.findObject(selector.text("Close"));
|
||||||
if (closeButton.waitForExists(TimeUnit.SECONDS.toMillis(initialTimeoutSeconds))) {
|
if (closeButton.waitForExists(TimeUnit.SECONDS.toMillis(initialTimeoutSeconds))) {
|
||||||
closeButton.click();
|
closeButton.click();
|
||||||
sleep(1); // diaglog dismissal
|
sleep(1); // diaglog dismissal
|
||||||
@ -130,7 +134,7 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
|
|
||||||
public boolean dismissRateDialogIfNecessary() throws Exception {
|
public boolean dismissRateDialogIfNecessary() throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject closeButton = new UiObject(selector.text("NOT NOW"));
|
UiObject closeButton = mDevice.findObject(selector.text("NOT NOW"));
|
||||||
boolean dismissed = false;
|
boolean dismissed = false;
|
||||||
// Sometimes, dismissing the dialog the first time does not work properly --
|
// Sometimes, dismissing the dialog the first time does not work properly --
|
||||||
// it starts to disappear but is then immediately re-created; so may need to
|
// it starts to disappear but is then immediately re-created; so may need to
|
||||||
@ -145,7 +149,7 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
|
|
||||||
public void hitTestButton() throws Exception {
|
public void hitTestButton() throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject test = new UiObject(selector.text("Test")
|
UiObject test = mDevice.findObject(selector.text("Test")
|
||||||
.className("android.widget.Button"));
|
.className("android.widget.Button"));
|
||||||
test.waitForExists(initialTimeoutSeconds);
|
test.waitForExists(initialTimeoutSeconds);
|
||||||
test.click();
|
test.click();
|
||||||
@ -156,7 +160,7 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
|
|
||||||
public void hitTestButtonVersion5(String id) throws Exception {
|
public void hitTestButtonVersion5(String id) throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject test = new UiObject(selector.resourceId(id)
|
UiObject test = mDevice.findObject(selector.resourceId(id)
|
||||||
.className("android.widget.TextView"));
|
.className("android.widget.TextView"));
|
||||||
test.waitForExists(initialTimeoutSeconds);
|
test.waitForExists(initialTimeoutSeconds);
|
||||||
test.click();
|
test.click();
|
||||||
@ -166,25 +170,25 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
|
|
||||||
public void hitTest() throws Exception {
|
public void hitTest() throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject test = new UiObject(selector.text("Test"));
|
UiObject test = mDevice.findObject(selector.text("Test"));
|
||||||
test.click();
|
test.click();
|
||||||
sleep(1); // possible tab transtion
|
sleep(1); // possible tab transtion
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableSdCardTests() throws Exception {
|
public void disableSdCardTests() throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject custom = new UiObject(selector.textContains("Custom"));
|
UiObject custom = mDevice.findObject(selector.textContains("Custom"));
|
||||||
custom.click();
|
custom.click();
|
||||||
sleep(1); // tab transition
|
sleep(1); // tab transition
|
||||||
|
|
||||||
UiObject sdCardButton = new UiObject(selector.text("SD card IO"));
|
UiObject sdCardButton = mDevice.findObject(selector.text("SD card IO"));
|
||||||
sdCardButton.click();
|
sdCardButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hitStart() throws Exception {
|
public void hitStart() throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
Log.v(TAG, "Start the test");
|
Log.v(TAG, "Start the test");
|
||||||
UiObject startButton = new UiObject(selector.text("Start Test")
|
UiObject startButton = mDevice.findObject(selector.text("Start Test")
|
||||||
.className("android.widget.Button"));
|
.className("android.widget.Button"));
|
||||||
startButton.click();
|
startButton.click();
|
||||||
}
|
}
|
||||||
@ -195,10 +199,10 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
// details screen. So we have to wait for either and then act appropriatesl (on the barchart
|
// details screen. So we have to wait for either and then act appropriatesl (on the barchart
|
||||||
// screen a back button press is required to get to the details screen.
|
// screen a back button press is required to get to the details screen.
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject barChart = new UiObject(new UiSelector().className("android.widget.TextView")
|
UiObject barChart = mDevice.findObject(new UiSelector().className("android.widget.TextView")
|
||||||
.text("Bar Chart"));
|
.text("Bar Chart"));
|
||||||
UiObject detailsButton = new UiObject(new UiSelector().className("android.widget.Button")
|
UiObject detailsButton = mDevice.findObject(new UiSelector().className("android.widget.Button")
|
||||||
.text("Details"));
|
.text("Details"));
|
||||||
for (int i = 0; i < 60; i++) {
|
for (int i = 0; i < 60; i++) {
|
||||||
if (detailsButton.exists() || barChart.exists()) {
|
if (detailsButton.exists() || barChart.exists()) {
|
||||||
break;
|
break;
|
||||||
@ -207,15 +211,17 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (barChart.exists()) {
|
if (barChart.exists()) {
|
||||||
getUiDevice().pressBack();
|
mDevice.pressBack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void waitForVersion6Results() throws Exception {
|
public void waitForVersion6Results() throws Exception {
|
||||||
UiObject qrText = new UiObject(new UiSelector().className("android.widget.TextView")
|
UiObject qrText = mDevice.findObject(new UiSelector().className("android.widget.TextView")
|
||||||
.text("QRCode of result"));
|
.text("QRCode of result"));
|
||||||
|
UiObject testAgain = mDevice.findObject(new UiSelector().className("android.widget.TextView")
|
||||||
|
.resourceIdMatches(".*tv_score.*"));
|
||||||
for (int i = 0; i < 120; i++) {
|
for (int i = 0; i < 120; i++) {
|
||||||
if (qrText.exists()) {
|
if (qrText.exists() || testAgain.exists()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sleep(5);
|
sleep(5);
|
||||||
@ -224,14 +230,14 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
|
|
||||||
public void viewDetails() throws Exception {
|
public void viewDetails() throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject detailsButton = new UiObject(new UiSelector().className("android.widget.Button")
|
UiObject detailsButton = mDevice.findObject(new UiSelector().className("android.widget.Button")
|
||||||
.text("Details"));
|
.text("Details"));
|
||||||
detailsButton.clickAndWaitForNewWindow();
|
detailsButton.clickAndWaitForNewWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void extractResults6() throws Exception {
|
public void extractResults6() throws Exception {
|
||||||
//Overal result
|
//Overal result
|
||||||
UiObject result = new UiObject(new UiSelector().resourceId("com.antutu.ABenchMark:id/tv_score_name"));
|
UiObject result = mDevice.findObject(new UiSelector().resourceId("com.antutu.ABenchMark:id/tv_score_name"));
|
||||||
if (result.exists()) {
|
if (result.exists()) {
|
||||||
Log.v(TAG, String.format("ANTUTU RESULT: Overall Score: %s", result.getText()));
|
Log.v(TAG, String.format("ANTUTU RESULT: Overall Score: %s", result.getText()));
|
||||||
}
|
}
|
||||||
@ -245,7 +251,7 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
|
|
||||||
public void extractSectionResults6(String section) throws Exception {
|
public void extractSectionResults6(String section) throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject resultLayout = new UiObject(selector.resourceId("com.antutu.ABenchMark:id/hcf_" + section));
|
UiObject resultLayout = mDevice.findObject(selector.resourceId("com.antutu.ABenchMark:id/hcf_" + section));
|
||||||
UiObject result = resultLayout.getChild(selector.resourceId("com.antutu.ABenchMark:id/tv_score_value"));
|
UiObject result = resultLayout.getChild(selector.resourceId("com.antutu.ABenchMark:id/tv_score_value"));
|
||||||
|
|
||||||
if (result.exists()) {
|
if (result.exists()) {
|
||||||
@ -262,7 +268,7 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiSelector resultTextSelector = selector.className("android.widget.TextView").index(0);
|
UiSelector resultTextSelector = selector.className("android.widget.TextView").index(0);
|
||||||
UiSelector relativeLayoutSelector = selector.className("android.widget.RelativeLayout").index(1);
|
UiSelector relativeLayoutSelector = selector.className("android.widget.RelativeLayout").index(1);
|
||||||
UiObject result = new UiObject(selector.className("android.widget.LinearLayout")
|
UiObject result = mDevice.findObject(selector.className("android.widget.LinearLayout")
|
||||||
.childSelector(relativeLayoutSelector)
|
.childSelector(relativeLayoutSelector)
|
||||||
.childSelector(resultTextSelector));
|
.childSelector(resultTextSelector));
|
||||||
if (result.exists()) {
|
if (result.exists()) {
|
||||||
@ -289,7 +295,7 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
|
|
||||||
for (int i = 1; i < 8; i += 2) {
|
for (int i = 1; i < 8; i += 2) {
|
||||||
UiObject table = new UiObject(selector.className("android.widget.TableLayout").index(i));
|
UiObject table = mDevice.findObject(selector.className("android.widget.TableLayout").index(i));
|
||||||
for (int j = 0; j < 3; j += 2) {
|
for (int j = 0; j < 3; j += 2) {
|
||||||
UiObject row = table.getChild(selector.className("android.widget.TableRow").index(j));
|
UiObject row = table.getChild(selector.className("android.widget.TableRow").index(j));
|
||||||
UiObject metric = row.getChild(selector.className("android.widget.TextView").index(0));
|
UiObject metric = row.getChild(selector.className("android.widget.TextView").index(0));
|
||||||
@ -307,23 +313,23 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void returnToTestScreen(String version) throws Exception {
|
public void returnToTestScreen(String version) throws Exception {
|
||||||
getUiDevice().pressBack();
|
mDevice.pressBack();
|
||||||
if (version.equals("5.3.0"))
|
if (version.equals("5.3.0"))
|
||||||
{
|
{
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject detailsButton = new UiObject(new UiSelector().className("android.widget.Button")
|
UiObject detailsButton = mDevice.findObject(new UiSelector().className("android.widget.Button")
|
||||||
.text("Details"));
|
.text("Details"));
|
||||||
sleep(1);
|
sleep(1);
|
||||||
getUiDevice().pressBack();
|
mDevice.pressBack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAgain() throws Exception {
|
public void testAgain() throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject retestButton = new UiObject(selector.text("Test Again")
|
UiObject retestButton = mDevice.findObject(selector.text("Test Again")
|
||||||
.className("android.widget.Button"));
|
.className("android.widget.Button"));
|
||||||
if (!retestButton.waitForExists(TimeUnit.SECONDS.toMillis(2))) {
|
if (!retestButton.waitForExists(TimeUnit.SECONDS.toMillis(2))) {
|
||||||
getUiDevice().pressBack();
|
mDevice.pressBack();
|
||||||
retestButton.waitForExists(TimeUnit.SECONDS.toMillis(2));
|
retestButton.waitForExists(TimeUnit.SECONDS.toMillis(2));
|
||||||
}
|
}
|
||||||
retestButton.clickAndWaitForNewWindow();
|
retestButton.clickAndWaitForNewWindow();
|
||||||
@ -331,11 +337,11 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
|
|
||||||
public void waitForAndViewResults() throws Exception {
|
public void waitForAndViewResults() throws Exception {
|
||||||
UiSelector selector = new UiSelector();
|
UiSelector selector = new UiSelector();
|
||||||
UiObject submitTextView = new UiObject(selector.text("Submit Scores")
|
UiObject submitTextView = mDevice.findObject(selector.text("Submit Scores")
|
||||||
.className("android.widget.TextView"));
|
.className("android.widget.TextView"));
|
||||||
UiObject detailTextView = new UiObject(selector.text("Detailed Scores")
|
UiObject detailTextView = mDevice.findObject(selector.text("Detailed Scores")
|
||||||
.className("android.widget.TextView"));
|
.className("android.widget.TextView"));
|
||||||
UiObject commentTextView = new UiObject(selector.text("User comment")
|
UiObject commentTextView = mDevice.findObject(selector.text("User comment")
|
||||||
.className("android.widget.TextView"));
|
.className("android.widget.TextView"));
|
||||||
boolean foundResults = false;
|
boolean foundResults = false;
|
||||||
for (int i = 0; i < 60; i++) {
|
for (int i = 0; i < 60; i++) {
|
||||||
@ -351,25 +357,25 @@ public class UiAutomation extends BaseUiAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (commentTextView.exists()) {
|
if (commentTextView.exists()) {
|
||||||
getUiDevice().pressBack();
|
mDevice.pressBack();
|
||||||
}
|
}
|
||||||
// Yes, sometimes, it needs to be done twice...
|
// Yes, sometimes, it needs to be done twice...
|
||||||
if (commentTextView.exists()) {
|
if (commentTextView.exists()) {
|
||||||
getUiDevice().pressBack();
|
mDevice.pressBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (detailTextView.exists()) {
|
if (detailTextView.exists()) {
|
||||||
detailTextView.click();
|
detailTextView.click();
|
||||||
sleep(1); // tab transition
|
sleep(1); // tab transition
|
||||||
|
|
||||||
UiObject testTextView = new UiObject(selector.text("Test")
|
UiObject testTextView = mDevice.findObject(selector.text("Test")
|
||||||
.className("android.widget.TextView"));
|
.className("android.widget.TextView"));
|
||||||
if (testTextView.exists()) {
|
if (testTextView.exists()) {
|
||||||
testTextView.click();
|
testTextView.click();
|
||||||
sleep(1); // tab transition
|
sleep(1); // tab transition
|
||||||
}
|
}
|
||||||
|
|
||||||
UiObject scoresTextView = new UiObject(selector.text("Scores")
|
UiObject scoresTextView = mDevice.findObject(selector.text("Scores")
|
||||||
.className("android.widget.TextView"));
|
.className("android.widget.TextView"));
|
||||||
if (scoresTextView.exists()) {
|
if (scoresTextView.exists()) {
|
||||||
scoresTextView.click();
|
scoresTextView.click();
|
23
wlauto/workloads/antutu/uiauto/build.gradle
Normal file
23
wlauto/workloads/antutu/uiauto/build.gradle
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:2.3.1'
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
@ -1,28 +1,40 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Copyright 2013-2015 ARM Limited
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
# CD into build dir if possible - allows building from any directory
|
||||||
|
script_path='.'
|
||||||
class_dir=bin/classes/com/arm/wlauto/uiauto
|
if `readlink -f $0 &>/dev/null`; then
|
||||||
base_class=`python -c "import os, wlauto; print os.path.join(os.path.dirname(wlauto.__file__), 'common', 'android', 'BaseUiAutomation.class')"`
|
script_path=`readlink -f $0 2>/dev/null`
|
||||||
mkdir -p $class_dir
|
fi
|
||||||
cp $base_class $class_dir
|
script_dir=`dirname $script_path`
|
||||||
|
cd $script_dir
|
||||||
ant build
|
|
||||||
|
# Ensure gradelw exists before starting
|
||||||
if [[ -f bin/com.arm.wlauto.uiauto.antutu.jar ]]; then
|
if [[ ! -f gradlew ]]; then
|
||||||
cp bin/com.arm.wlauto.uiauto.antutu.jar ..
|
echo 'gradlew file not found! Check that you are in the right directory.'
|
||||||
|
exit 9
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy base class library from wlauto dist
|
||||||
|
libs_dir=app/libs
|
||||||
|
base_classes=`python -c "import os, wlauto; print os.path.join(os.path.dirname(wlauto.__file__), 'common', 'android', '*.aar')"`
|
||||||
|
mkdir -p $libs_dir
|
||||||
|
cp $base_classes $libs_dir
|
||||||
|
|
||||||
|
# Build and return appropriate exit code if failed
|
||||||
|
# gradle build
|
||||||
|
./gradlew clean :app:assembleDebug
|
||||||
|
exit_code=$?
|
||||||
|
if [[ $exit_code -ne 0 ]]; then
|
||||||
|
echo "ERROR: 'gradle build' exited with code $exit_code"
|
||||||
|
exit $exit_code
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If successful move APK file to workload folder (overwrite previous)
|
||||||
|
package=com.arm.wlauto.uiauto.antutu
|
||||||
|
rm -f ../$package
|
||||||
|
if [[ -f app/build/apk/$package.apk ]]; then
|
||||||
|
cp app/build/apk/$package.apk ../$package.uiautoapk
|
||||||
|
else
|
||||||
|
echo 'ERROR: UiAutomator apk could not be found!'
|
||||||
|
exit 9
|
||||||
fi
|
fi
|
||||||
|
@ -1,92 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project name="com.arm.wlauto.uiauto.antutu" default="help">
|
|
||||||
|
|
||||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
|
||||||
It contains the path to the SDK. It should *NOT* be checked into
|
|
||||||
Version Control Systems. -->
|
|
||||||
<property file="local.properties" />
|
|
||||||
|
|
||||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
|
||||||
'android' tool to add properties to it.
|
|
||||||
This is the place to change some Ant specific build properties.
|
|
||||||
Here are some properties you may want to change/update:
|
|
||||||
|
|
||||||
source.dir
|
|
||||||
The name of the source directory. Default is 'src'.
|
|
||||||
out.dir
|
|
||||||
The name of the output directory. Default is 'bin'.
|
|
||||||
|
|
||||||
For other overridable properties, look at the beginning of the rules
|
|
||||||
files in the SDK, at tools/ant/build.xml
|
|
||||||
|
|
||||||
Properties related to the SDK location or the project target should
|
|
||||||
be updated using the 'android' tool with the 'update' action.
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems.
|
|
||||||
|
|
||||||
-->
|
|
||||||
<property file="ant.properties" />
|
|
||||||
|
|
||||||
<!-- if sdk.dir was not set from one of the property file, then
|
|
||||||
get it from the ANDROID_HOME env var.
|
|
||||||
This must be done before we load project.properties since
|
|
||||||
the proguard config can use sdk.dir -->
|
|
||||||
<property environment="env" />
|
|
||||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
|
||||||
<isset property="env.ANDROID_HOME" />
|
|
||||||
</condition>
|
|
||||||
|
|
||||||
<!-- The project.properties file is created and updated by the 'android'
|
|
||||||
tool, as well as ADT.
|
|
||||||
|
|
||||||
This contains project specific properties such as project target, and library
|
|
||||||
dependencies. Lower level build properties are stored in ant.properties
|
|
||||||
(or in .classpath for Eclipse projects).
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems. -->
|
|
||||||
<loadproperties srcFile="project.properties" />
|
|
||||||
|
|
||||||
<!-- quick check on sdk.dir -->
|
|
||||||
<fail
|
|
||||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
|
||||||
unless="sdk.dir"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Import per project custom build rules if present at the root of the project.
|
|
||||||
This is the place to put custom intermediary targets such as:
|
|
||||||
-pre-build
|
|
||||||
-pre-compile
|
|
||||||
-post-compile (This is typically used for code obfuscation.
|
|
||||||
Compiled code location: ${out.classes.absolute.dir}
|
|
||||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
|
||||||
-post-package
|
|
||||||
-post-build
|
|
||||||
-pre-clean
|
|
||||||
-->
|
|
||||||
<import file="custom_rules.xml" optional="true" />
|
|
||||||
|
|
||||||
<!-- Import the actual build file.
|
|
||||||
|
|
||||||
To customize existing targets, there are two options:
|
|
||||||
- Customize only one target:
|
|
||||||
- copy/paste the target into this file, *before* the
|
|
||||||
<import> task.
|
|
||||||
- customize it to your needs.
|
|
||||||
- Customize the whole content of build.xml
|
|
||||||
- copy/paste the content of the rules files (minus the top node)
|
|
||||||
into this file, replacing the <import> task.
|
|
||||||
- customize to your needs.
|
|
||||||
|
|
||||||
***********************
|
|
||||||
****** IMPORTANT ******
|
|
||||||
***********************
|
|
||||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
|
||||||
in order to avoid having your file be overridden by tools such as "android update project"
|
|
||||||
-->
|
|
||||||
<!-- version-tag: VERSION_TAG -->
|
|
||||||
<import file="${sdk.dir}/tools/ant/uibuild.xml" />
|
|
||||||
|
|
||||||
</project>
|
|
BIN
wlauto/workloads/antutu/uiauto/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
wlauto/workloads/antutu/uiauto/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
wlauto/workloads/antutu/uiauto/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
wlauto/workloads/antutu/uiauto/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#Wed May 03 15:42:44 BST 2017
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
160
wlauto/workloads/antutu/uiauto/gradlew
vendored
Executable file
160
wlauto/workloads/antutu/uiauto/gradlew
vendored
Executable file
@ -0,0 +1,160 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
wlauto/workloads/antutu/uiauto/gradlew.bat
vendored
Normal file
90
wlauto/workloads/antutu/uiauto/gradlew.bat
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user