diff options
author | Vishal Bhoj <vishal.bhoj@linaro.org> | 2014-06-17 11:54:03 +0530 |
---|---|---|
committer | Vishal Bhoj <vishal.bhoj@linaro.org> | 2014-06-17 11:54:03 +0530 |
commit | 94240b110a6829e9e0dd8e480009bd416e657aca (patch) | |
tree | 3db094555dfb53495b70032d74c035335fe28897 |
Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
-rw-r--r-- | bin/com/linaro/ctshelper.class | bin | 0 -> 2719 bytes | |||
-rw-r--r-- | build.sh | 27 | ||||
-rw-r--r-- | build.xml | 92 | ||||
-rw-r--r-- | local.properties | 10 | ||||
-rw-r--r-- | project.properties | 14 | ||||
-rw-r--r-- | src/com/linaro/ctshelper.java | 90 |
6 files changed, 233 insertions, 0 deletions
diff --git a/bin/com/linaro/ctshelper.class b/bin/com/linaro/ctshelper.class Binary files differnew file mode 100644 index 0000000..27cd3c7 --- /dev/null +++ b/bin/com/linaro/ctshelper.class diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..5d531c5 --- /dev/null +++ b/build.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +if [ -z "$ANDROID_HOME" ]; then + echo "Please export the ANDORID_HOME environment variable as following:" + echo "export ANDORID_HOME=<sdk-path>" + exit 1 +fi + +if ! `which ant >&/dev/null`; then + echo "Please install the ant command which will be used for building the jar file" + exit 1 +fi + +parent=$(cd $(dirname $0);pwd) +proj_name=`basename $parent` + +${ANDROID_HOME}/tools/android create uitest-project -n $proj_name -t 1 -p $parent +if [ $? -ne 0 ]; then + echo "Failed to create the uitest-project with the source under this directory" + exit 1 +fi +ant build +if [ $? -ne 0 ]; then + echo "Failed to build the directory" + exit 1 +fi + diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..3be9e5d --- /dev/null +++ b/build.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="ctshelper" 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> diff --git a/local.properties b/local.properties new file mode 100644 index 0000000..e3d85fe --- /dev/null +++ b/local.properties @@ -0,0 +1,10 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. + +# location of the SDK. This is only used by Ant +# For customization when using a Version Control System, please read the +# header note. +sdk.dir=/work/sdk/android-sdk-linux diff --git a/project.properties b/project.properties new file mode 100644 index 0000000..a3ee5ab --- /dev/null +++ b/project.properties @@ -0,0 +1,14 @@ +# 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-17 diff --git a/src/com/linaro/ctshelper.java b/src/com/linaro/ctshelper.java new file mode 100644 index 0000000..0f5b85a --- /dev/null +++ b/src/com/linaro/ctshelper.java @@ -0,0 +1,90 @@ +/* + * Author: Linaro Android Team <linaro-dev@lists.linaro.org> + * + * These files are Copyright (C) 2012 Linaro Limited and they + * are licensed under the Apache License, Version 2.0. + * You may obtain a copy of this license at + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +package com.linaro; + +import java.io.File; + +import android.R.string; +import android.app.Activity; +import android.graphics.Point; +import android.os.Bundle; +import android.util.Log; +import android.view.KeyEvent; + +import com.android.uiautomator.core.UiDevice; +import com.android.uiautomator.core.UiObject; +import com.android.uiautomator.core.UiScrollable; +import com.android.uiautomator.core.UiSelector; +import com.android.uiautomator.testrunner.UiAutomatorTestCase; +import com.android.uiautomator.core.UiObjectNotFoundException; + +public class ctshelper extends UiAutomatorTestCase { + String[] DevAdminEntryList = { + "android.deviceadmin.cts.CtsDeviceAdminReceiver", + "android.deviceadmin.cts.CtsDeviceAdminReceiver2" }; + + public void SecurityHelper() { + UiScrollable settingsItem = new UiScrollable( + new UiSelector().className("android.widget.ListView")); + try { + UiObject security = settingsItem.getChildByText( + new UiSelector().className("android.widget.LinearLayout"), + "Security"); + security.click(); + UiScrollable securitylist = new UiScrollable( + new UiSelector().className("android.widget.ListView")); + UiObject deviceAdmin = securitylist.getChildByText( + new UiSelector().className("android.widget.LinearLayout"), + "Device administrators"); + deviceAdmin.click(); + UiScrollable devAdminList = new UiScrollable( + new UiSelector().className("android.widget.ListView")); + UiObject devAdminItem; + for (int i = 0; i < DevAdminEntryList.length; i++) { + devAdminItem = devAdminList.getChildByText( + new UiSelector().className("android.widget.TextView"), + DevAdminEntryList[i]); + devAdminItem.click(); + UiSelector selector = new UiSelector(); + UiObject btn_st = new UiObject(selector.text("Activate")); + btn_st.click(); + } + } catch (UiObjectNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void AccessibilityHelper() { + UiScrollable settingsItem = new UiScrollable( + new UiSelector().className("android.widget.ListView")); + try { + UiObject accessibility = settingsItem.getChildByText( + new UiSelector().className("android.widget.LinearLayout"), + "Accessibility"); + accessibility.click(); + UiScrollable accessibilitylist = new UiScrollable( + new UiSelector().className("android.widget.ListView")); + UiObject delegation = accessibilitylist.getChildByText( + new UiSelector().className("android.widget.LinearLayout"), + "Delegating Accessibility Service"); + delegation.click(); + UiSelector selector = new UiSelector(); + UiObject btn_st = new UiObject(selector.text("OFF")); + btn_st.click(); + UiSelector selector2 = new UiSelector(); + UiObject btn_st2 = new UiObject(selector2.text("OK")); + btn_st2.click(); + } catch (UiObjectNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} |