summaryrefslogtreecommitdiffstats
path: root/core/tests
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-10-10 14:19:52 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-10 14:19:52 -0700
commit5bc3addb453ba1daad366862a24be654a06ff447 (patch)
treeef9e34008ce99b4f4cacb6c4fcdd979651a52ec0 /core/tests
parent3d59480dc201c893c6da5c3934b14a2d95a1bef9 (diff)
parent0689b60b8644d7c4c76e5cdf7e6ce5cc4c5be124 (diff)
downloadframeworks_base-5bc3addb453ba1daad366862a24be654a06ff447.zip
frameworks_base-5bc3addb453ba1daad366862a24be654a06ff447.tar.gz
frameworks_base-5bc3addb453ba1daad366862a24be654a06ff447.tar.bz2
am 0689b60b: am 54e01e0f: Merge "Symlink application lib directory when on SD card" into gingerbread
Merge commit '0689b60b8644d7c4c76e5cdf7e6ce5cc4c5be124' * commit '0689b60b8644d7c4c76e5cdf7e6ce5cc4c5be124': Symlink application lib directory when on SD card
Diffstat (limited to 'core/tests')
-rwxr-xr-xcore/tests/coretests/src/android/content/pm/PackageManagerTests.java44
1 files changed, 39 insertions, 5 deletions
diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index 276e281..d5f385b 100755
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -45,6 +45,7 @@ import android.util.DisplayMetrics;
import android.util.Log;
import java.io.File;
+import java.io.IOException;
import java.io.InputStream;
public class PackageManagerTests extends AndroidTestCase {
@@ -378,6 +379,18 @@ public class PackageManagerTests extends AndroidTestCase {
assertEquals(publicSrcPath, appInstallPath);
assertFalse((info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0);
assertTrue(info.nativeLibraryDir.startsWith(dataDir.getPath()));
+
+ // Make sure the native library dir is not a symlink
+ final File nativeLibDir = new File(info.nativeLibraryDir);
+ assertTrue("Native library dir should exist at " + info.nativeLibraryDir,
+ nativeLibDir.exists());
+ try {
+ assertEquals("Native library dir should not be a symlink",
+ info.nativeLibraryDir,
+ nativeLibDir.getCanonicalPath());
+ } catch (IOException e) {
+ fail("Can't read " + nativeLibDir.getPath());
+ }
} else if (rLoc == INSTALL_LOC_SD){
assertTrue("Application flags (" + info.flags
+ ") should contain FLAG_EXTERNAL_STORAGE",
@@ -391,6 +404,19 @@ public class PackageManagerTests extends AndroidTestCase {
assertTrue("The native library path (" + info.nativeLibraryDir
+ ") should start with " + SECURE_CONTAINERS_PREFIX,
info.nativeLibraryDir.startsWith(SECURE_CONTAINERS_PREFIX));
+
+ // Make sure the native library in /data/data/<app>/lib is a
+ // symlink to the ASEC
+ final File nativeLibSymLink = new File(info.dataDir, "lib");
+ assertTrue("Native library symlink should exist at " + nativeLibSymLink.getPath(),
+ nativeLibSymLink.exists());
+ try {
+ assertEquals(nativeLibSymLink.getPath() + " should be a symlink to "
+ + info.nativeLibraryDir, info.nativeLibraryDir, nativeLibSymLink
+ .getCanonicalPath());
+ } catch (IOException e) {
+ fail("Can't read " + nativeLibSymLink.getPath());
+ }
} else {
// TODO handle error. Install should have failed.
fail("Install should have failed");
@@ -1406,13 +1432,21 @@ public class PackageManagerTests extends AndroidTestCase {
receiver);
assertTrue(retCode);
ApplicationInfo info = getPm().getApplicationInfo(ip.pkg.packageName, 0);
- assertNotNull(info);
+ assertNotNull("ApplicationInfo for recently installed application should exist",
+ info);
if ((moveFlags & PackageManager.MOVE_INTERNAL) != 0) {
- assertTrue((info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0);
- assertTrue(info.nativeLibraryDir.startsWith(info.dataDir));
+ assertTrue("ApplicationInfo.FLAG_EXTERNAL_STORAGE flag should NOT be set",
+ (info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == 0);
+ assertTrue("ApplicationInfo.nativeLibraryDir should start with " + info.dataDir,
+ info.nativeLibraryDir.startsWith(info.dataDir));
} else if ((moveFlags & PackageManager.MOVE_EXTERNAL_MEDIA) != 0){
- assertTrue((info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0);
- assertTrue(info.nativeLibraryDir.startsWith(SECURE_CONTAINERS_PREFIX));
+ assertTrue("ApplicationInfo.FLAG_EXTERNAL_STORAGE flag should be set",
+ (info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0);
+ assertTrue("ApplicationInfo.nativeLibraryDir should start with " + SECURE_CONTAINERS_PREFIX,
+ info.nativeLibraryDir.startsWith(SECURE_CONTAINERS_PREFIX));
+ final File nativeLibSymLink = new File(info.dataDir, "lib");
+ assertTrue("The data directory should have a 'lib' symlink that points to the ASEC container",
+ nativeLibSymLink.getCanonicalPath().startsWith(SECURE_CONTAINERS_PREFIX));
}
}
} catch (NameNotFoundException e) {