From a9da693f8a3016edf96cfe4b29d304afdfb6b1b8 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Thu, 13 Mar 2014 09:03:38 -0700 Subject: [PATCH] testcode for 430243 --- .../pr430243/PackageManagerAspect.java | 32 ++++++++++++++++ tests/bugs175/pr430243/PolicyManager.java | 20 ++++++++++ .../pr430243/PolicyProviderConstants.java | 38 +++++++++++++++++++ .../pr430243/PolicyProviderInterface.java | 32 ++++++++++++++++ .../systemtest/ajc175/Ajc175Tests.java | 5 ++- .../org/aspectj/systemtest/ajc175/ajc175.xml | 7 ++++ 6 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 tests/bugs175/pr430243/PackageManagerAspect.java create mode 100644 tests/bugs175/pr430243/PolicyManager.java create mode 100644 tests/bugs175/pr430243/PolicyProviderConstants.java create mode 100644 tests/bugs175/pr430243/PolicyProviderInterface.java diff --git a/tests/bugs175/pr430243/PackageManagerAspect.java b/tests/bugs175/pr430243/PackageManagerAspect.java new file mode 100644 index 000000000..56c609e5f --- /dev/null +++ b/tests/bugs175/pr430243/PackageManagerAspect.java @@ -0,0 +1,32 @@ +package com.test; + +import java.util.ArrayList; +import java.util.List; + +import com.test2.PolicyManager; + +public aspect PackageManagerAspect { + pointcut intentquery () : execution(* foo(..)); + private static final String TAG = "PackageManagerAspect"; + + Object around(): intentquery() { +// return compute(); + switch (PolicyManager.getOpenInPolicy(false)) { + case UNRESTRICTED: break; + case RESTRICTED: break; + case BLOCKED: + default: break; + } + return ""; + } + + public Object compute() { + switch (PolicyManager.getOpenInPolicy(false)) { + case UNRESTRICTED: break; + case RESTRICTED: break; + case BLOCKED: + default: break; + } + return ""; + } +} diff --git a/tests/bugs175/pr430243/PolicyManager.java b/tests/bugs175/pr430243/PolicyManager.java new file mode 100644 index 000000000..f6e508f33 --- /dev/null +++ b/tests/bugs175/pr430243/PolicyManager.java @@ -0,0 +1,20 @@ +package com.test2; + +import com.test2.PolicyProviderConstants.OpenInPolicyValues; + +public class PolicyManager { + public static OpenInPolicyValues getOpenInPolicy (boolean showDialog) + { + OpenInPolicyValues value = PolicyProviderInterface.getOpenInPolicy(); + + return value; + } + + public static void main(String[] args) { + new PolicyManager().foo(); + } + + public String foo() { + return ""; + } +} \ No newline at end of file diff --git a/tests/bugs175/pr430243/PolicyProviderConstants.java b/tests/bugs175/pr430243/PolicyProviderConstants.java new file mode 100644 index 000000000..9a56fe1e6 --- /dev/null +++ b/tests/bugs175/pr430243/PolicyProviderConstants.java @@ -0,0 +1,38 @@ +package com.test2; + +public interface PolicyProviderConstants +{ + public static final String featureSMS = "Sms"; + public static final String featureCamera = "Camera"; + public static final String featureAudio = "Microphone"; + public static final String featureLocation = "Location"; + public static final String featureSensor = "Sensor"; + public static final String featureSnapshot = "ScreenCapture"; + public static final String featureNFC = "nfc"; + + public static final String featureClipboard = "CutAndCopy"; + public static final String featureOpenIn = "DocumentExchange"; + + public static final String policySecurityGroup = "SecurityGroup"; + + public static final String featureNetworkAccess = "NetworkAccess"; + + public static final String featureAuthSupport = "AuthSupport"; + public static final String featureNETWORKACCESSMODE = "PreferredVpnMode"; + public static final String policyOpenInExclusionList = "OpenInExclusionList"; + + public enum CutCopyPolicyValues + { + BLOCKED, + RESTRICTED, + UNRESTRICTED, + }; + + public enum OpenInPolicyValues + { + BLOCKED, + RESTRICTED, + UNRESTRICTED, + }; + +} diff --git a/tests/bugs175/pr430243/PolicyProviderInterface.java b/tests/bugs175/pr430243/PolicyProviderInterface.java new file mode 100644 index 000000000..5b14b85d5 --- /dev/null +++ b/tests/bugs175/pr430243/PolicyProviderInterface.java @@ -0,0 +1,32 @@ +package com.test2; + +import com.test2.PolicyProviderConstants.OpenInPolicyValues; + +//import android.content.ContentResolver; +//import android.database.Cursor; +//import android.net.Uri; +//import android.os.Binder; +//import android.text.TextUtils; +//import android.util.Log; + + +// Interface to calls to ManagedAppInfoProvider. this queries the policies and exposes interfaces for checks +public class PolicyProviderInterface +{ + private static final String TAG = "PolicyProviderInterface"; + + private static final String STR_SECURITY_GROUP = "SecurityGroup"; + private static final String STR_BLOCKED = "blocked"; + private static final String VALUE_SECUREBROWSE = "SecureBrowse"; + +// private static final String STR_PROVIDER_URI = PolicyProviderColumns.AUTHORITY + "." + PolicyManager.getPackageName() + "/" + PolicyProviderColumns.POLICY_INFO; +// private static final Uri providerURI = Uri.parse("content://"+ STR_PROVIDER_URI); + + + + public static OpenInPolicyValues getOpenInPolicy() + { + return OpenInPolicyValues.RESTRICTED; + } + +} diff --git a/tests/src/org/aspectj/systemtest/ajc175/Ajc175Tests.java b/tests/src/org/aspectj/systemtest/ajc175/Ajc175Tests.java index 54b38a265..7a31126c5 100644 --- a/tests/src/org/aspectj/systemtest/ajc175/Ajc175Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc175/Ajc175Tests.java @@ -21,6 +21,10 @@ import org.aspectj.testing.XMLBasedAjcTestCase; */ public class Ajc175Tests extends org.aspectj.testing.XMLBasedAjcTestCase { +// public void testIllegalAccessError_430243() throws Exception { +// runTest("illegalaccesserror"); +// } + public void testVertxVerifyError_423257() throws Exception { runTest("vertx verify error"); } @@ -31,7 +35,6 @@ public class Ajc175Tests extends org.aspectj.testing.XMLBasedAjcTestCase { return XMLBasedAjcTestCase.loadSuite(Ajc175Tests.class); } - @Override protected File getSpecFile() { return new File("../tests/src/org/aspectj/systemtest/ajc175/ajc175.xml"); } diff --git a/tests/src/org/aspectj/systemtest/ajc175/ajc175.xml b/tests/src/org/aspectj/systemtest/ajc175/ajc175.xml index dff61dd4a..2db4a984a 100644 --- a/tests/src/org/aspectj/systemtest/ajc175/ajc175.xml +++ b/tests/src/org/aspectj/systemtest/ajc175/ajc175.xml @@ -2,6 +2,13 @@ + + + + + + + -- 2.39.5