summaryrefslogtreecommitdiffstats
path: root/core/tests/coretests
diff options
context:
space:
mode:
Diffstat (limited to 'core/tests/coretests')
-rw-r--r--core/tests/coretests/apks/install_bad_dex/Android.mk10
-rw-r--r--core/tests/coretests/apks/install_bad_dex/AndroidManifest.xml24
-rw-r--r--core/tests/coretests/apks/install_bad_dex/classes.dex1
-rw-r--r--core/tests/coretests/apks/install_bad_dex/res/values/strings.xml6
-rw-r--r--core/tests/coretests/apks/install_bad_dex/src/com/android/frameworks/coretests/TestActivity.java24
-rw-r--r--core/tests/coretests/apks/install_jni_lib/Android.mk2
-rwxr-xr-xcore/tests/coretests/src/android/content/pm/PackageManagerTests.java19
7 files changed, 82 insertions, 4 deletions
diff --git a/core/tests/coretests/apks/install_bad_dex/Android.mk b/core/tests/coretests/apks/install_bad_dex/Android.mk
new file mode 100644
index 0000000..769a1b0
--- /dev/null
+++ b/core/tests/coretests/apks/install_bad_dex/Android.mk
@@ -0,0 +1,10 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := install_bad_dex
+
+LOCAL_JAVA_RESOURCE_FILES := $(LOCAL_PATH)/classes.dex
+
+include $(FrameworkCoreTests_BUILD_PACKAGE)
diff --git a/core/tests/coretests/apks/install_bad_dex/AndroidManifest.xml b/core/tests/coretests/apks/install_bad_dex/AndroidManifest.xml
new file mode 100644
index 0000000..fe4dd8e
--- /dev/null
+++ b/core/tests/coretests/apks/install_bad_dex/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.frameworks.coretests.install_loc">
+
+ <application android:hasCode="true">
+ <activity
+ android:name="com.android.frameworks.coretests.TestActivity">
+ </activity>
+ </application>
+</manifest>
diff --git a/core/tests/coretests/apks/install_bad_dex/classes.dex b/core/tests/coretests/apks/install_bad_dex/classes.dex
new file mode 100644
index 0000000..284b6d4
--- /dev/null
+++ b/core/tests/coretests/apks/install_bad_dex/classes.dex
@@ -0,0 +1 @@
+This is a bad dex
diff --git a/core/tests/coretests/apks/install_bad_dex/res/values/strings.xml b/core/tests/coretests/apks/install_bad_dex/res/values/strings.xml
new file mode 100644
index 0000000..3b8b3b1
--- /dev/null
+++ b/core/tests/coretests/apks/install_bad_dex/res/values/strings.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- Just need this dummy file to have something to build. -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="dummy">dummy</string>
+</resources>
diff --git a/core/tests/coretests/apks/install_bad_dex/src/com/android/frameworks/coretests/TestActivity.java b/core/tests/coretests/apks/install_bad_dex/src/com/android/frameworks/coretests/TestActivity.java
new file mode 100644
index 0000000..10d0551
--- /dev/null
+++ b/core/tests/coretests/apks/install_bad_dex/src/com/android/frameworks/coretests/TestActivity.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * 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.
+ *
+ */
+
+package com.android.frameworks.coretests;
+
+import android.app.Activity;
+
+public class TestActivity extends Activity {
+
+}
diff --git a/core/tests/coretests/apks/install_jni_lib/Android.mk b/core/tests/coretests/apks/install_jni_lib/Android.mk
index de2993a..b61ea8e 100644
--- a/core/tests/coretests/apks/install_jni_lib/Android.mk
+++ b/core/tests/coretests/apks/install_jni_lib/Android.mk
@@ -23,6 +23,6 @@ LOCAL_SHARED_LIBRARIES := \
libnativehelper
LOCAL_MODULE := libframeworks_coretests_jni
-LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_TAGS := tests
include $(BUILD_SHARED_LIBRARY)
diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index 785842f..5881aa1 100755
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -39,6 +39,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.StatFs;
import android.os.SystemClock;
+import android.os.UserManager;
import android.os.storage.IMountService;
import android.os.storage.StorageListener;
import android.os.storage.StorageManager;
@@ -562,6 +563,14 @@ public class PackageManagerTests extends AndroidTestCase {
fail(pkgName + " shouldnt be installed");
} catch (NameNotFoundException e) {
}
+
+ UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
+ List<UserInfo> users = um.getUsers();
+ for (UserInfo user : users) {
+ String dataDir = PackageManager.getDataDirForUser(user.id, pkgName);
+ assertFalse("Application data directory should not exist: " + dataDir,
+ new File(dataDir).exists());
+ }
}
class InstallParams {
@@ -707,9 +716,7 @@ public class PackageManagerTests extends AndroidTestCase {
PackageManager.GET_UNINSTALLED_PACKAGES);
GenericReceiver receiver = new DeleteReceiver(pkg.packageName);
invokeDeletePackage(pkg.packageName, 0, receiver);
- } catch (NameNotFoundException e1) {
- } catch (Exception e) {
- failStr(e);
+ } catch (NameNotFoundException e) {
}
}
try {
@@ -3476,6 +3483,12 @@ public class PackageManagerTests extends AndroidTestCase {
assertNotNull("signatures should not be null", packageInfo.signatures);
}
+ public void testInstall_BadDex_CleanUp() throws Exception {
+ int retCode = PackageManager.INSTALL_FAILED_DEXOPT;
+ installFromRawResource("install.apk", R.raw.install_bad_dex, 0, true, true, retCode,
+ PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
+ }
+
/*---------- Recommended install location tests ----*/
/*
* TODO's