summaryrefslogtreecommitdiffstats
path: root/core/tests
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2012-06-08 13:47:46 -0700
committerKenny Root <kroot@google.com>2012-06-08 13:47:46 -0700
commite38b1c4d156a569efc646e86a72ab3a3e3ccf6fc (patch)
treeea11a80486d1d4d68828db9fb0660c256a1a1d10 /core/tests
parentaf2ab39abad1c0481af471e60a299fb2839d608d (diff)
parent9855f6e210afc8e88ec1da12abe3871ef70e1bea (diff)
downloadframeworks_base-e38b1c4d156a569efc646e86a72ab3a3e3ccf6fc.zip
frameworks_base-e38b1c4d156a569efc646e86a72ab3a3e3ccf6fc.tar.gz
frameworks_base-e38b1c4d156a569efc646e86a72ab3a3e3ccf6fc.tar.bz2
resolved conflicts for merge of 9855f6e2 to jb-dev-plus-aosp
Change-Id: I012bd3b5946dedba3439285caa93739d44ebc60f
Diffstat (limited to 'core/tests')
-rw-r--r--core/tests/coretests/src/android/os/SELinuxTest.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/core/tests/coretests/src/android/os/SELinuxTest.java b/core/tests/coretests/src/android/os/SELinuxTest.java
new file mode 100644
index 0000000..9b63a6b
--- /dev/null
+++ b/core/tests/coretests/src/android/os/SELinuxTest.java
@@ -0,0 +1,45 @@
+package android.os;
+
+import android.os.Process;
+import android.os.SELinux;
+import android.test.AndroidTestCase;
+import static junit.framework.Assert.assertEquals;
+
+public class SELinuxTest extends AndroidTestCase {
+
+ public void testgetFileCon() {
+ if(SELinux.isSELinuxEnabled() == false)
+ return;
+
+ String ctx = SELinux.getFileContext("/system/bin/toolbox");
+ assertEquals(ctx, "u:object_r:system_file:s0");
+ }
+
+ public void testgetCon() {
+ if(SELinux.isSELinuxEnabled() == false)
+ return;
+
+ String mycon = SELinux.getContext();
+ assertEquals(mycon, "u:r:untrusted_app:s0:c33");
+ }
+
+ public void testgetPidCon() {
+ if(SELinux.isSELinuxEnabled() == false)
+ return;
+
+ String mycon = SELinux.getPidContext(Process.myPid());
+ assertEquals(mycon, "u:r:untrusted_app:s0:c33");
+ }
+
+ public void testcheckSELinuxAccess() {
+ if(SELinux.isSELinuxEnabled() == false)
+ return;
+
+ String mycon = SELinux.getContext();
+ boolean ret;
+ ret = SELinux.checkSELinuxAccess(mycon, mycon, "process", "fork");
+ assertEquals(ret,"true");
+ ret = SELinux.checkSELinuxAccess(mycon, mycon, "memprotect", "mmap_zero");
+ assertEquals(ret,"true");
+ }
+}